coverage-report

Code coverage report for All files

npmtest-gojs (v0.0.1)

Code coverage report for All files

Statements: 2.47% (1845 / 74615)      Branches: 0.22% (126 / 56126)      Functions: 0.28% (28 / 9980)      Lines: 9.73% (1609 / 16533)      Ignored: 26 statements, 1 function, 30 branches     

File Statements Branches Functions Lines
node-npmtest-gojs/ 100% (153 / 153) 100% (126 / 126) 100% (28 / 28) 100% (153 / 153)
node-npmtest-gojs/node_modules/gojs/extensions/ 2.18% (278 / 12742) 0% (0 / 4245) 0% (0 / 1272) 2.37% (278 / 11724)
node-npmtest-gojs/node_modules/gojs/intro/ 4.59% (5 / 109) 0% (0 / 35) 0% (0 / 7) 5% (5 / 100)
node-npmtest-gojs/node_modules/gojs/projects/electron-circuit/ 3.7% (3 / 81) 0% (0 / 33) 0% (0 / 13) 4.17% (3 / 72)
node-npmtest-gojs/node_modules/gojs/projects/nw-circuit/ 3.03% (2 / 66) 0% (0 / 31) 0% (0 / 10) 3.51% (2 / 57)
node-npmtest-gojs/node_modules/gojs/projects/phantom-circuit/ 13.45% (16 / 119) 0% (0 / 33) 0% (0 / 28) 15.24% (16 / 105)
node-npmtest-gojs/node_modules/gojs/release/ 1.96% (1201 / 61158) 0% (0 / 51623) 0% (0 / 8622) 23.34% (965 / 4135)
node-npmtest-gojs/node_modules/gojs/samples/ 100% (187 / 187) 100% (0 / 0) 100% (0 / 0) 100% (187 / 187)
Code coverage report for node-npmtest-gojs/

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/

Statements: 100% (153 / 153)      Branches: 100% (126 / 126)      Functions: 100% (28 / 28)      Lines: 100% (153 / 153)      Ignored: 26 statements, 1 function, 30 branches     

All files » node-npmtest-gojs/
File Statements Branches Functions Lines
example.js 100% (83 / 83) 100% (73 / 73) 100% (12 / 12) 100% (83 / 83)
lib.npmtest_gojs.js 100% (16 / 16) 100% (14 / 14) 100% (3 / 3) 100% (16 / 16)
test.js 100% (54 / 54) 100% (39 / 39) 100% (13 / 13) 100% (54 / 54)
Code coverage report for node-npmtest-gojs/example.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/example.js

Statements: 100% (83 / 83)      Branches: 100% (73 / 73)      Functions: 100% (12 / 12)      Lines: 100% (83 / 83)      Ignored: 26 statements, 1 function, 30 branches     

All files » node-npmtest-gojs/ » example.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328                                                  2   2         2   2   2 2 2         1             2       2       2   2               1 2           2     2     2 2   1       2     1 1 1   1 1     1 1   1     1   2           1   1   1         1 2 2 3 3 3 3 1     3 3         3       1 3 1       1 1               1   1 1 1   1   1                                                                                                                                                                                       1 1                       1     6 6   1   2   1   2         1 1   1         1             1     1 1     1 1   1 1 1 1 1 1 1   1 1   1        
/*
example.js
 
quickstart example
 
instruction
    1. save this script as example.js
    2. run the shell command:
        $ npm install npmtest-gojs && PORT=8081 node example.js
    3. play with the browser-demo on http://127.0.0.1:8081
*/
 
 
 
/* istanbul instrument in package npmtest_gojs */
/*jslint
    bitwise: true,
    browser: true,
    maxerr: 8,
    maxlen: 96,
    node: true,
    nomen: true,
    regexp: true,
    stupid: true
*/
(function () {
    'use strict';
    var local;
 
 
 
    // run shared js-env code - pre-init
    (function () {
        // init local
        local = {};
        // init modeJs
        local.modeJs = (function () {
            try {
                return typeof navigator.userAgent === 'string' &&
                    typeof document.querySelector('body') === 'object' &&
                    typeof XMLHttpRequest.prototype.open === 'function' &&
                    'browser';
            } catch (errorCaughtBrowser) {
                return module.exports &&
                    typeof process.versions.node === 'string' &&
                    typeof require('http').createServer === 'function' &&
                    'node';
            }
        }());
        // init global
        local.global = local.modeJs === 'browser'
            ? window
            : global;
        // init utility2_rollup
        local = local.global.utility2_rollup || (local.modeJs === 'browser'
            ? local.global.utility2_npmtest_gojs
            : global.utility2_moduleExports);
        // export local
        local.global.local = local;
    }());
    switch (local.modeJs) {
 
 
 
    // post-init
    // run browser js-env code - post-init
    /* istanbul ignore next */
    case 'browser':
        local.testRunBrowser = function (event) {
            Eif (!event || (event &&
                    event.currentTarget &&
                    event.currentTarget.className &&
                    event.currentTarget.className.includes &&
                    event.currentTarget.className.includes('onreset'))) {
                // reset output
                Array.from(
                    document.querySelectorAll('body > .resettable')
                ).forEach(function (element) {
                    switch (element.tagName) {
                    case 'INPUT':
                    case 'TEXTAREA':
                        element.value = '';
                        break;
                    default:
                        element.textContent = '';
                    }
                });
            }
            switch (event && event.currentTarget && event.currentTarget.id) {
            case 'testRunButton1':
                // show tests
                Eif (document.querySelector('#testReportDiv1').style.display === 'none') {
                    document.querySelector('#testReportDiv1').style.display = 'block';
                    document.querySelector('#testRunButton1').textContent =
                        'hide internal test';
                    local.modeTest = true;
                    local.testRunDefault(local);
                // hide tests
                } else {
                    document.querySelector('#testReportDiv1').style.display = 'none';
                    document.querySelector('#testRunButton1').textContent = 'run internal test';
                }
                break;
            // custom-case
            default:
                break;
            }
            Iif (document.querySelector('#inputTextareaEval1') && (!event || (event &&
                    event.currentTarget &&
                    event.currentTarget.className &&
                    event.currentTarget.className.includes &&
                    event.currentTarget.className.includes('oneval')))) {
                // try to eval input-code
                try {
                    /*jslint evil: true*/
                    eval(document.querySelector('#inputTextareaEval1').value);
                } catch (errorCaught) {
                    console.error(errorCaught);
                }
            }
        };
        // log stderr and stdout to #outputTextareaStdout1
        ['error', 'log'].forEach(function (key) {
            console[key + '_original'] = console[key];
            console[key] = function () {
                var element;
                console[key + '_original'].apply(console, arguments);
                element = document.querySelector('#outputTextareaStdout1');
                Iif (!element) {
                    return;
                }
                // append text to #outputTextareaStdout1
                element.value += Array.from(arguments).map(function (arg) {
                    return typeof arg === 'string'
                        ? arg
                        : JSON.stringify(arg, null, 4);
                }).join(' ') + '\n';
                // scroll textarea to bottom
                element.scrollTop = element.scrollHeight;
            };
        });
        // init event-handling
        ['change', 'click', 'keyup'].forEach(function (event) {
            Array.from(document.querySelectorAll('.on' + event)).forEach(function (element) {
                element.addEventListener(event, local.testRunBrowser);
            });
        });
        // run tests
        local.testRunBrowser();
        break;
 
 
 
    // run node js-env code - post-init
    /* istanbul ignore next */
    case 'node':
        // export local
        module.exports = local;
        // require modules
        local.fs = require('fs');
        local.http = require('http');
        local.url = require('url');
        // init assets
        local.assetsDict = local.assetsDict || {};
        /* jslint-ignore-begin */
        local.assetsDict['/assets.index.template.html'] = '\
<!doctype html>\n\
<html lang="en">\n\
<head>\n\
<meta charset="UTF-8">\n\
<meta name="viewport" content="width=device-width, initial-scale=1">\n\
<title>{{env.npm_package_name}} (v{{env.npm_package_version}})</title>\n\
<style>\n\
/*csslint\n\
    box-sizing: false,\n\
    universal-selector: false\n\
*/\n\
* {\n\
    box-sizing: border-box;\n\
}\n\
body {\n\
    background: #dde;\n\
    font-family: Arial, Helvetica, sans-serif;\n\
    margin: 2rem;\n\
}\n\
body > * {\n\
    margin-bottom: 1rem;\n\
}\n\
.utility2FooterDiv {\n\
    margin-top: 20px;\n\
    text-align: center;\n\
}\n\
</style>\n\
<style>\n\
/*csslint\n\
*/\n\
textarea {\n\
    font-family: monospace;\n\
    height: 10rem;\n\
    width: 100%;\n\
}\n\
textarea[readonly] {\n\
    background: #ddd;\n\
}\n\
</style>\n\
</head>\n\
<body>\n\
<!-- utility2-comment\n\
<div id="ajaxProgressDiv1" style="background: #d00; height: 2px; left: 0; margin: 0; padding: 0; position: fixed; top: 0; transition: background 0.5s, width 1.5s; width: 25%;"></div>\n\
utility2-comment -->\n\
<h1>\n\
<!-- utility2-comment\n\
    <a\n\
        {{#if env.npm_package_homepage}}\n\
        href="{{env.npm_package_homepage}}"\n\
        {{/if env.npm_package_homepage}}\n\
        target="_blank"\n\
    >\n\
utility2-comment -->\n\
        {{env.npm_package_name}} (v{{env.npm_package_version}})\n\
<!-- utility2-comment\n\
    </a>\n\
utility2-comment -->\n\
</h1>\n\
<h3>{{env.npm_package_description}}</h3>\n\
<!-- utility2-comment\n\
<h4><a download href="assets.app.js">download standalone app</a></h4>\n\
<button class="onclick onreset" id="testRunButton1">run internal test</button><br>\n\
<div id="testReportDiv1" style="display: none;"></div>\n\
utility2-comment -->\n\
\n\
\n\
\n\
<label>stderr and stdout</label>\n\
<textarea class="resettable" id="outputTextareaStdout1" readonly></textarea>\n\
<!-- utility2-comment\n\
{{#if isRollup}}\n\
<script src="assets.app.js"></script>\n\
{{#unless isRollup}}\n\
utility2-comment -->\n\
<script src="assets.utility2.rollup.js"></script>\n\
<script src="jsonp.utility2._stateInit?callback=window.utility2._stateInit"></script>\n\
<script src="assets.npmtest_gojs.rollup.js"></script>\n\
<script src="assets.example.js"></script>\n\
<script src="assets.test.js"></script>\n\
<!-- utility2-comment\n\
{{/if isRollup}}\n\
utility2-comment -->\n\
<div class="utility2FooterDiv">\n\
    [ this app was created with\n\
    <a href="https://github.com/kaizhu256/node-utility2" target="_blank">utility2</a>\n\
    ]\n\
</div>\n\
</body>\n\
</html>\n\
';
        /* jslint-ignore-end */
        Iif (local.templateRender) {
            local.assetsDict['/'] = local.templateRender(
                local.assetsDict['/assets.index.template.html'],
                {
                    env: local.objectSetDefault(local.env, {
                        npm_package_description: 'the greatest app in the world!',
                        npm_package_name: 'my-app',
                        npm_package_nameAlias: 'my_app',
                        npm_package_version: '0.0.1'
                    })
                }
            );
        } else {
            local.assetsDict['/'] = local.assetsDict['/assets.index.template.html']
                .replace((/\{\{env\.(\w+?)\}\}/g), function (match0, match1) {
                    // jslint-hack
                    String(match0);
                    switch (match1) {
                    case 'npm_package_description':
                        return 'the greatest app in the world!';
                    case 'npm_package_name':
                        return 'my-app';
                    case 'npm_package_nameAlias':
                        return 'my_app';
                    case 'npm_package_version':
                        return '0.0.1';
                    }
                });
        }
        // run the cli
        Eif (local.global.utility2_rollup || module !== require.main) {
            break;
        }
        local.assetsDict['/assets.example.js'] =
            local.assetsDict['/assets.example.js'] ||
            local.fs.readFileSync(__filename, 'utf8');
        // bug-workaround - long $npm_package_buildCustomOrg
        /* jslint-ignore-begin */
        local.assetsDict['/assets.npmtest_gojs.rollup.js'] =
            local.assetsDict['/assets.npmtest_gojs.rollup.js'] ||
            local.fs.readFileSync(
                local.npmtest_gojs.__dirname + '/lib.npmtest_gojs.js',
                'utf8'
            ).replace((/^#!/), '//');
        /* jslint-ignore-end */
        local.assetsDict['/favicon.ico'] = local.assetsDict['/favicon.ico'] || '';
        // if $npm_config_timeout_exit exists,
        // then exit this process after $npm_config_timeout_exit ms
        if (Number(process.env.npm_config_timeout_exit)) {
            setTimeout(process.exit, Number(process.env.npm_config_timeout_exit));
        }
        // start server
        if (local.global.utility2_serverHttp1) {
            break;
        }
        process.env.PORT = process.env.PORT || '8081';
        console.error('server starting on port ' + process.env.PORT);
        local.http.createServer(function (request, response) {
            request.urlParsed = local.url.parse(request.url);
            if (local.assetsDict[request.urlParsed.pathname] !== undefined) {
                response.end(local.assetsDict[request.urlParsed.pathname]);
                return;
            }
            response.statusCode = 404;
            response.end();
        }).listen(process.env.PORT);
        break;
    }
}());
 
 
Code coverage report for node-npmtest-gojs/lib.npmtest_gojs.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/lib.npmtest_gojs.js

Statements: 100% (16 / 16)      Branches: 100% (14 / 14)      Functions: 100% (3 / 3)      Lines: 100% (16 / 16)      Ignored: none     

All files » node-npmtest-gojs/ » lib.npmtest_gojs.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55                      2   2         2   2   2 2 2         1             2       2   2   2 1   1 1 1          
/* istanbul instrument in package npmtest_gojs */
/*jslint
    bitwise: true,
    browser: true,
    maxerr: 8,
    maxlen: 96,
    node: true,
    nomen: true,
    regexp: true,
    stupid: true
*/
(function () {
    'use strict';
    var local;
 
 
 
    // run shared js-env code - pre-init
    (function () {
        // init local
        local = {};
        // init modeJs
        local.modeJs = (function () {
            try {
                return typeof navigator.userAgent === 'string' &&
                    typeof document.querySelector('body') === 'object' &&
                    typeof XMLHttpRequest.prototype.open === 'function' &&
                    'browser';
            } catch (errorCaughtBrowser) {
                return module.exports &&
                    typeof process.versions.node === 'string' &&
                    typeof require('http').createServer === 'function' &&
                    'node';
            }
        }());
        // init global
        local.global = local.modeJs === 'browser'
            ? window
            : global;
        // init utility2_rollup
        local = local.global.utility2_rollup || local;
        // init lib
        local.local = local.npmtest_gojs = local;
        // init exports
        if (local.modeJs === 'browser') {
            local.global.utility2_npmtest_gojs = local;
        } else {
            module.exports = local;
            module.exports.__dirname = __dirname;
            module.exports.module = module;
        }
    }());
}());
 
 
Code coverage report for node-npmtest-gojs/test.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/test.js

Statements: 100% (54 / 54)      Branches: 100% (39 / 39)      Functions: 100% (13 / 13)      Lines: 100% (54 / 54)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197                      2   2         2   2   2 2 2         1             2     2     1       1     1   1     2           2 2   2           1           1           2 2   2           1             1       1     1             1             1 1     1             1 1 1 1 1 1     1         2 2     1             2 2     1             2 2     1             2 2     1             1 1       1 1        
/* istanbul instrument in package npmtest_gojs */
/*jslint
    bitwise: true,
    browser: true,
    maxerr: 8,
    maxlen: 96,
    node: true,
    nomen: true,
    regexp: true,
    stupid: true
*/
(function () {
    'use strict';
    var local;
 
 
 
    // run shared js-env code - pre-init
    (function () {
        // init local
        local = {};
        // init modeJs
        local.modeJs = (function () {
            try {
                return typeof navigator.userAgent === 'string' &&
                    typeof document.querySelector('body') === 'object' &&
                    typeof XMLHttpRequest.prototype.open === 'function' &&
                    'browser';
            } catch (errorCaughtBrowser) {
                return module.exports &&
                    typeof process.versions.node === 'string' &&
                    typeof require('http').createServer === 'function' &&
                    'node';
            }
        }());
        // init global
        local.global = local.modeJs === 'browser'
            ? window
            : global;
        switch (local.modeJs) {
        // re-init local from window.local
        case 'browser':
            local = local.global.utility2.objectSetDefault(
                local.global.utility2_rollup || local.global.local,
                local.global.utility2
            );
            break;
        // re-init local from example.js
        case 'node':
            local = (local.global.utility2_rollup || require('utility2'))
                .requireReadme();
            break;
        }
        // export local
        local.global.local = local;
    }());
 
 
 
    // run shared js-env code - function
    (function () {
        return;
    }());
    switch (local.modeJs) {
 
 
 
    // run browser js-env code - function
    case 'browser':
        break;
 
 
 
    // run node js-env code - function
    case 'node':
        break;
    }
 
 
 
    // run shared js-env code - post-init
    (function () {
        return;
    }());
    switch (local.modeJs) {
 
 
 
    // run browser js-env code - post-init
    case 'browser':
        local.testCase_browser_nullCase = local.testCase_browser_nullCase || function (
            options,
            onError
        ) {
        /*
         * this function will test browsers's null-case handling-behavior-behavior
         */
            onError(null, options);
        };
 
        // run tests
        local.nop(local.modeTest &&
            document.querySelector('#testRunButton1') &&
            document.querySelector('#testRunButton1').click());
        break;
 
 
 
    // run node js-env code - post-init
    /* istanbul ignore next */
    case 'node':
        local.testCase_buildApidoc_default = local.testCase_buildApidoc_default || function (
            options,
            onError
        ) {
        /*
         * this function will test buildApidoc's default handling-behavior-behavior
         */
            options = { modulePathList: module.paths };
            local.buildApidoc(options, onError);
        };
 
        local.testCase_buildApp_default = local.testCase_buildApp_default || function (
            options,
            onError
        ) {
        /*
         * this function will test buildApp's default handling-behavior-behavior
         */
            local.testCase_buildReadme_default(options, local.onErrorThrow);
            local.testCase_buildLib_default(options, local.onErrorThrow);
            local.testCase_buildTest_default(options, local.onErrorThrow);
            local.testCase_buildCustomOrg_default(options, local.onErrorThrow);
            options = [];
            local.buildApp(options, onError);
        };
 
        local.testCase_buildCustomOrg_default = local.testCase_buildCustomOrg_default ||
            function (options, onError) {
            /*
             * this function will test buildCustomOrg's default handling-behavior
             */
                options = {};
                local.buildCustomOrg(options, onError);
            };
 
        local.testCase_buildLib_default = local.testCase_buildLib_default || function (
            options,
            onError
        ) {
        /*
         * this function will test buildLib's default handling-behavior
         */
            options = {};
            local.buildLib(options, onError);
        };
 
        local.testCase_buildReadme_default = local.testCase_buildReadme_default || function (
            options,
            onError
        ) {
        /*
         * this function will test buildReadme's default handling-behavior-behavior
         */
            options = {};
            local.buildReadme(options, onError);
        };
 
        local.testCase_buildTest_default = local.testCase_buildTest_default || function (
            options,
            onError
        ) {
        /*
         * this function will test buildTest's default handling-behavior
         */
            options = {};
            local.buildTest(options, onError);
        };
 
        local.testCase_webpage_default = local.testCase_webpage_default || function (
            options,
            onError
        ) {
        /*
         * this function will test webpage's default handling-behavior
         */
            options = { modeCoverageMerge: true, url: local.serverLocalHost + '?modeTest=1' };
            local.browserTest(options, onError);
        };
 
        // run test-server
        local.testRunServer(local);
        break;
    }
}());
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/

Statements: 2.18% (278 / 12742)      Branches: 0% (0 / 4245)      Functions: 0% (0 / 1272)      Lines: 2.37% (278 / 11724)      Ignored: none     

All files » node-npmtest-gojs/node_modules/gojs/extensions/
File Statements Branches Functions Lines
Arrowheads.js 1.25% (1 / 80) 100% (0 / 0) 100% (0 / 0) 1.25% (1 / 80)
BPMN.js 8.57% (51 / 595) 0% (0 / 249) 0% (0 / 115) 9.29% (51 / 549)
BPMNClasses.js 4% (3 / 75) 0% (0 / 60) 0% (0 / 9) 4.76% (3 / 63)
BalloonLink.js 3.92% (2 / 51) 0% (0 / 34) 0% (0 / 5) 5% (2 / 40)
Buttons.js 0.75% (1 / 133) 0% (0 / 68) 0% (0 / 18) 0.85% (1 / 117)
ColumnResizingTool.js 1.31% (2 / 153) 0% (0 / 70) 0% (0 / 19) 1.46% (2 / 137)
CurvedLinkReshapingTool.js 4.65% (2 / 43) 0% (0 / 19) 0% (0 / 5) 4.88% (2 / 41)
DataInspector.js 7.34% (13 / 177) 0% (0 / 105) 0% (0 / 15) 8.84% (13 / 147)
DebugInspector.js 5.6% (32 / 571) 0% (0 / 242) 0% (0 / 43) 5.94% (32 / 539)
DimensioningLink.js 2% (2 / 100) 0% (0 / 33) 0% (0 / 10) 2.08% (2 / 96)
DragCreatingTool.js 1.8% (2 / 111) 0% (0 / 48) 0% (0 / 14) 2.08% (2 / 96)
DragZoomingTool.js 1.72% (2 / 116) 0% (0 / 50) 0% (0 / 14) 1.96% (2 / 102)
DrawCommandHandler.js 0.8% (2 / 249) 0% (0 / 112) 0% (0 / 40) 0.9% (2 / 221)
ExtendedBrush.js 0.39% (2 / 507) 0% (0 / 234) 0% (0 / 37) 0.42% (2 / 473)
Figures.js 0.42% (17 / 4002) 0% (0 / 342) 0% (0 / 262) 0.43% (17 / 3927)
FishboneLayout.js 1.75% (3 / 171) 0% (0 / 113) 0% (0 / 13) 1.92% (3 / 156)
FloorPlanner.js 3.31% (52 / 1569) 0% (0 / 768) 0% (0 / 215) 3.92% (52 / 1327)
FreehandDrawingTool.js 2.04% (2 / 98) 0% (0 / 41) 0% (0 / 14) 2.22% (2 / 90)
GeometryReshapingTool.js 0.96% (2 / 208) 0% (0 / 85) 0% (0 / 20) 1.12% (2 / 178)
GuidedDraggingTool.js 0.78% (2 / 256) 0% (0 / 115) 0% (0 / 30) 0.96% (2 / 208)
HyperlinkText.js 3.92% (2 / 51) 0% (0 / 37) 0% (0 / 10) 4.88% (2 / 41)
LightBoxContextMenu.js 3.7% (3 / 81) 0% (0 / 8) 0% (0 / 34) 4.23% (3 / 71)
LinkLabelDraggingTool.js 2.38% (2 / 84) 0% (0 / 40) 0% (0 / 10) 2.7% (2 / 74)
LinkShiftingTool.js 1.18% (2 / 169) 0% (0 / 105) 0% (0 / 11) 1.27% (2 / 157)
LocalStorageCommandHandler.js 4.44% (2 / 45) 0% (0 / 22) 0% (0 / 4) 4.88% (2 / 41)
NodeLabelDraggingTool.js 3.03% (2 / 66) 0% (0 / 27) 0% (0 / 10) 3.51% (2 / 57)
OrthogonalLinkReshapingTool.js 2.47% (2 / 81) 0% (0 / 40) 0% (0 / 6) 2.47% (2 / 81)
ParallelLayout.js 3.03% (2 / 66) 0% (0 / 40) 0% (0 / 4) 3.33% (2 / 60)
PolygonDrawingTool.js 1.24% (2 / 161) 0% (0 / 69) 0% (0 / 21) 1.34% (2 / 149)
PolylineLinkingTool.js 1.92% (2 / 104) 0% (0 / 54) 0% (0 / 10) 2.04% (2 / 98)
PortShiftingTool.js 3.03% (2 / 66) 0% (0 / 31) 0% (0 / 10) 3.51% (2 / 57)
RadialLayout.js 2.58% (4 / 155) 0% (0 / 48) 0% (0 / 21) 2.84% (4 / 141)
RealtimeDragSelectingTool.js 2.67% (2 / 75) 0% (0 / 34) 0% (0 / 20) 3.77% (2 / 53)
ResizeMultipleTool.js 7.14% (2 / 28) 0% (0 / 22) 0% (0 / 3) 7.69% (2 / 26)
Robot.js 6.35% (8 / 126) 0% (0 / 78) 0% (0 / 8) 8.08% (8 / 99)
RotateMultipleTool.js 3.85% (3 / 78) 0% (0 / 35) 0% (0 / 9) 4.23% (3 / 71)
RoundedRectangles.js 3.85% (1 / 26) 0% (0 / 12) 0% (0 / 2) 4.17% (1 / 24)
RowResizingTool.js 1.31% (2 / 153) 0% (0 / 70) 0% (0 / 19) 1.46% (2 / 137)
ScrollingTable.js 9.8% (5 / 51) 0% (0 / 28) 0% (0 / 10) 11.36% (5 / 44)
SectorReshapingTool.js 1.82% (2 / 110) 0% (0 / 57) 0% (0 / 14) 2% (2 / 100)
SerpentineLayout.js 2.2% (2 / 91) 0% (0 / 42) 0% (0 / 7) 2.35% (2 / 85)
SnapLinkReshapingTool.js 6.25% (2 / 32) 0% (0 / 15) 0% (0 / 8) 7.41% (2 / 27)
SpiralLayout.js 2.2% (2 / 91) 0% (0 / 48) 0% (0 / 10) 2.38% (2 / 84)
TableLayout.js 0.41% (2 / 486) 0% (0 / 242) 0% (0 / 15) 0.46% (2 / 431)
Templates.js 4.23% (11 / 260) 100% (0 / 0) 0% (0 / 11) 4.23% (11 / 260)
TextEditor.js 1.2% (1 / 83) 0% (0 / 32) 0% (0 / 8) 1.35% (1 / 74)
TextEditorRadioButtons.js 1.39% (1 / 72) 0% (0 / 22) 0% (0 / 6) 1.52% (1 / 66)
TextEditorSelectBox.js 2.38% (1 / 42) 0% (0 / 12) 0% (0 / 5) 2.63% (1 / 38)
TreeMapLayout.js 2.41% (2 / 83) 0% (0 / 30) 0% (0 / 15) 2.67% (2 / 75)
WallBuildingTool.js 2.44% (2 / 82) 0% (0 / 19) 0% (0 / 14) 2.63% (2 / 76)
WallReshapingTool.js 1.32% (5 / 379) 0% (0 / 138) 0% (0 / 39) 1.47% (5 / 340)
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/Arrowheads.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/Arrowheads.js

Statements: 1.25% (1 / 80)      Branches: 100% (0 / 0)      Functions: 100% (0 / 0)      Lines: 1.25% (1 / 80)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111                                    2                                                                                                                                                                                        
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// These are the definitions for all of the predefined arrowheads.
// You do not need to load this file in order to use arrowheads.
 
// Typical custom definition:
//   go.Shape.defineArrowheadGeometry("Zigzag", "M0,4 L1,8 3,0 5,8 7,0 8,4");
 
// Typical usage in a link template:
//   myDiagram.linkTemplate =
//     $(go.Link,
//       $(go.Shape),
//       $(go.Shape, { toArrow: "Zigzag" })
//     );
 
go.Shape.defineArrowheadGeometry("Standard", "F1 m 0,0 l 8,4 -8,4 2,-4 z");
go.Shape.defineArrowheadGeometry("Backward", "F1 m 8,0 l -2,4 2,4 -8,-4 z");
go.Shape.defineArrowheadGeometry("Triangle", "F1 m 0,0 l 8,4.62 -8,4.62 z");
go.Shape.defineArrowheadGeometry("BackwardTriangle", "F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z");
go.Shape.defineArrowheadGeometry("Boomerang", "F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z");
go.Shape.defineArrowheadGeometry("BackwardBoomerang", "F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z");
go.Shape.defineArrowheadGeometry("SidewaysV", "m 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z");
go.Shape.defineArrowheadGeometry("BackwardV", "m 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z");
 
go.Shape.defineArrowheadGeometry("OpenTriangle", "m 0,0 l 8,4 -8,4");
go.Shape.defineArrowheadGeometry("BackwardOpenTriangle", "m 8,0 l -8,4 8,4");
go.Shape.defineArrowheadGeometry("OpenTriangleLine", "m 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8");
go.Shape.defineArrowheadGeometry("BackwardOpenTriangleLine", "m 8,0 l  -8,4 8,4 m -8.5,0 l 0,-8");
 
go.Shape.defineArrowheadGeometry("OpenTriangleTop", "m 0,0 l 8,4 m 0,4");
go.Shape.defineArrowheadGeometry("BackwardOpenTriangleTop", "m 8,0 l -8,4 m 0,4");
go.Shape.defineArrowheadGeometry("OpenTriangleBottom", "m 0,8 l 8,-4");
go.Shape.defineArrowheadGeometry("BackwardOpenTriangleBottom", "m 0,4 l 8,4");
 
go.Shape.defineArrowheadGeometry("HalfTriangleTop", "F1 m 0,0 l 0,4 8,0 z m 0,8");
go.Shape.defineArrowheadGeometry("BackwardHalfTriangleTop", "F1 m 8,0 l 0,4 -8,0 z m 0,8");
go.Shape.defineArrowheadGeometry("HalfTriangleBottom", "F1 m 0,4 l 0,4 8,-4 z");
go.Shape.defineArrowheadGeometry("BackwardHalfTriangleBottom", "F1 m 8,4 l 0,4 -8,-4 z");
 
go.Shape.defineArrowheadGeometry("ForwardSemiCircle", "m 4,0 b 270 180 0 4 4");
go.Shape.defineArrowheadGeometry("BackwardSemiCircle", "m 4,8 b 90 180 0 -4 4");
 
go.Shape.defineArrowheadGeometry("Feather", "m 0,0 l 3,4 -3,4");
go.Shape.defineArrowheadGeometry("BackwardFeather", "m 3,0 l -3,4 3,4");
go.Shape.defineArrowheadGeometry("DoubleFeathers", "m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4");
go.Shape.defineArrowheadGeometry("BackwardDoubleFeathers", "m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4");
go.Shape.defineArrowheadGeometry("TripleFeathers", "m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4");
go.Shape.defineArrowheadGeometry("BackwardTripleFeathers", "m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4");
 
go.Shape.defineArrowheadGeometry("ForwardSlash", "m 0,8 l 5,-8");
go.Shape.defineArrowheadGeometry("BackSlash", "m 0,0 l 5,8");
go.Shape.defineArrowheadGeometry("DoubleForwardSlash", "m 0,8 l 4,-8 m -2,8 l 4,-8");
go.Shape.defineArrowheadGeometry("DoubleBackSlash", "m 0,0 l 4,8 m -2,-8 l 4,8");
go.Shape.defineArrowheadGeometry("TripleForwardSlash", "m 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8");
go.Shape.defineArrowheadGeometry("TripleBackSlash", "m 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8");
 
go.Shape.defineArrowheadGeometry("Fork", "m 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4");
go.Shape.defineArrowheadGeometry("BackwardFork", "m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4");
go.Shape.defineArrowheadGeometry("LineFork", "m 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4");
go.Shape.defineArrowheadGeometry("BackwardLineFork", "m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8");
go.Shape.defineArrowheadGeometry("CircleFork", "F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4");
go.Shape.defineArrowheadGeometry("BackwardCircleFork", "F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3");
go.Shape.defineArrowheadGeometry("CircleLineFork", "F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4");
go.Shape.defineArrowheadGeometry("BackwardCircleLineFork", "F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3");
 
go.Shape.defineArrowheadGeometry("Circle", "F1 m 8,4 b 0 360 -4 0 4 z");
go.Shape.defineArrowheadGeometry("Block", "F1 m 0,0 l 0,8 8,0 0,-8 z");
go.Shape.defineArrowheadGeometry("StretchedDiamond", "F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z");
go.Shape.defineArrowheadGeometry("Diamond", "F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z");
go.Shape.defineArrowheadGeometry("Chevron", "F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z");
go.Shape.defineArrowheadGeometry("StretchedChevron", "F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z");
 
go.Shape.defineArrowheadGeometry("NormalArrow", "F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z");
go.Shape.defineArrowheadGeometry("X", "m 0,0 l 8,8 m 0,-8 l -8,8");
go.Shape.defineArrowheadGeometry("TailedNormalArrow", "F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z");
go.Shape.defineArrowheadGeometry("DoubleTriangle", "F1 m 0,0 l 4,4 -4,4 0,-8 z  m 4,0 l 4,4 -4,4 0,-8 z");
go.Shape.defineArrowheadGeometry("BigEndArrow" , "F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z");
go.Shape.defineArrowheadGeometry("ConcaveTailArrow", "F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z");
go.Shape.defineArrowheadGeometry("RoundedTriangle", "F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z");
go.Shape.defineArrowheadGeometry("SimpleArrow", "F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z");
go.Shape.defineArrowheadGeometry("AccelerationArrow" , "F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z");
go.Shape.defineArrowheadGeometry("BoxArrow" , "F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z");
go.Shape.defineArrowheadGeometry("TriangleLine" , "F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8");
 
go.Shape.defineArrowheadGeometry("CircleEndedArrow" , "F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z");
 
go.Shape.defineArrowheadGeometry("DynamicWidthArrow" , "F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z");
go.Shape.defineArrowheadGeometry("EquilibriumArrow" , "m 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3");
go.Shape.defineArrowheadGeometry("FastForward" , "F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z");
go.Shape.defineArrowheadGeometry("Kite", "F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z");
go.Shape.defineArrowheadGeometry("HalfArrowTop", "F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8");
go.Shape.defineArrowheadGeometry("HalfArrowBottom", "F1 m 0,8 l 4,-4 4,0 -8,4 z");
go.Shape.defineArrowheadGeometry("OpposingDirectionDoubleArrow" , "F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z");
go.Shape.defineArrowheadGeometry("PartialDoubleTriangle" , "F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z");
go.Shape.defineArrowheadGeometry("LineCircle", "F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z");
go.Shape.defineArrowheadGeometry("DoubleLineCircle" , "F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z");
go.Shape.defineArrowheadGeometry("TripleLineCircle" , "F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z");
go.Shape.defineArrowheadGeometry("CircleLine" , "F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8");
go.Shape.defineArrowheadGeometry("DiamondCircle", "F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z");
go.Shape.defineArrowheadGeometry("PlusCircle" , "F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8");
go.Shape.defineArrowheadGeometry("OpenRightTriangleTop", "m 8,0 l 0,4 -8,0 m 0,4");
go.Shape.defineArrowheadGeometry("OpenRightTriangleBottom" , "m 8,8 l 0,-4 -8,0");
go.Shape.defineArrowheadGeometry("Line", "m 0,0 l 0,8");
go.Shape.defineArrowheadGeometry("DoubleLine", "m 0,0 l 0,8 m 2,0 l 0,-8");
go.Shape.defineArrowheadGeometry("TripleLine", "m 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8");
go.Shape.defineArrowheadGeometry("PentagonArrow", "F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z");
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/BPMN.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/BPMN.js

Statements: 8.57% (51 / 595)      Branches: 0% (0 / 249)      Functions: 0% (0 / 115)      Lines: 9.29% (51 / 549)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787                  1   1                                                                                                                                                                                                                                                                                                                             1                           1               1       1                                     1         1                                   1                                                                                                                                               1                 1                                                                                                                                                                                                                                                                                                                                                                                                                 1                           1                       1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   1                           1                             1                                                                                                                                                                                                                                                                                                                                                                                                                                                                     1                           1                                                                                                                                                                                                                                 1                                                                                                                                                                                                                                                                                                                                                                                                 2 2         1             1                               1                                 1             1     2                                                                                                             1                                                                                                             1                                                         1                 1               1                         1             1             1               1                           1                   1         1                           1                         1                         1               1                                           1                             1         1               1                             1                                 1                 1              
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// This file holds all of the JavaScript code specific to the BPMN.html page.
 
// Setup all of the Diagrams and what they need.
// This is called after the page is loaded.
function init() {
 
    function checkLocalStorage() {
        try {
            window.localStorage.setItem('item', 'item');
            window.localStorage.removeItem('item');
            return true;
        } catch (e) {
            return false;
        }
    }
 
  if (!checkLocalStorage()) {
    var currentFile = document.getElementById("currentFile");
    currentFile.textContent = "Sorry! No web storage support. If you're using Internet Explorer / Microsoft Edge, you must load the page from a server for local storage to work.";
  }
 
// setup the menubar
jQuery( "#menuui" ).menu();
jQuery(function() {
        jQuery( "#menuui" ).menu({ position: { my: "left top", at: "left top+30" } });
        });
jQuery( "#menuui" ).menu({
  icons: { submenu: "ui-icon-triangle-1-s" }
});
 
  // hides open HTML Element
  var openDocument = document.getElementById("openDocument");
  openDocument.style.visibility = "hidden";
  // hides remove HTML Element
  var removeDocument = document.getElementById("removeDocument");
  removeDocument.style.visibility = "hidden";
 
 
  var $ = go.GraphObject.make;  // for more concise visual tree definitions
 
  // constants for design choices
 
  var GradientYellow = $(go.Brush, "Linear", { 0: "LightGoldenRodYellow", 1: "#FFFF66" });
  var GradientLightGreen = $(go.Brush, "Linear", { 0: "#E0FEE0", 1: "PaleGreen" });
  var GradientLightGray = $(go.Brush, "Linear", { 0: "White", 1: "#DADADA" });
 
  var ActivityNodeFill = $(go.Brush, "Linear", { 0: "OldLace", 1: "PapayaWhip" });
  var ActivityNodeStroke = "#CDAA7D";
  var ActivityMarkerStrokeWidth = 1.5;
  var ActivityNodeWidth = 120;
  var ActivityNodeHeight = 80;
  var ActivityNodeStrokeWidth = 1;
  var ActivityNodeStrokeWidthIsCall = 4;
 
  var SubprocessNodeFill = ActivityNodeFill;
  var SubprocessNodeStroke = ActivityNodeStroke;
 
  var EventNodeSize = 42;
  var EventNodeInnerSize = EventNodeSize - 6;
  var EventNodeSymbolSize = EventNodeInnerSize - 14;
  var EventEndOuterFillColor = "pink";
  var EventBackgroundColor = GradientLightGreen;
  var EventSymbolLightFill = "white";
  var EventSymbolDarkFill = "dimgray";
  var EventDimensionStrokeColor = "green";
  var EventDimensionStrokeEndColor = "red";
  var EventNodeStrokeWidthIsEnd = 4;
 
  var GatewayNodeSize = 80;
  var GatewayNodeSymbolSize = 45;
  var GatewayNodeFill = GradientYellow;
  var GatewayNodeStroke = "darkgoldenrod";
  var GatewayNodeSymbolStroke = "darkgoldenrod";
  var GatewayNodeSymbolFill = GradientYellow;
  var GatewayNodeSymbolStrokeWidth = 3;
 
  var DataFill = GradientLightGray;
 
 
  // custom figures for Shapes
 
  go.Shape.defineFigureGenerator("Empty", function(shape, w, h) {
    return new go.Geometry();
  });
 
  var annotationStr = "M 150,0L 0,0L 0,600L 150,600 M 800,0";
  var annotationGeo = go.Geometry.parse(annotationStr);
  annotationGeo.normalize();
  go.Shape.defineFigureGenerator("Annotation", function(shape, w, h) {
    var geo = annotationGeo.copy();
    // calculate how much to scale the Geometry so that it fits in w x h
    var bounds = geo.bounds;
    var scale = Math.min(w / bounds.width, h / bounds.height);
    geo.scale(scale, scale);
    return geo;
  });
 
  var gearStr = "F M 391,5L 419,14L 444.5,30.5L 451,120.5L 485.5,126L 522,141L 595,83L 618.5,92L 644,106.5" +
    "L 660.5,132L 670,158L 616,220L 640.5,265.5L 658.122,317.809L 753.122,322.809L 770.122,348.309L 774.622,374.309" +
    "L 769.5,402L 756.622,420.309L 659.122,428.809L 640.5,475L 616.5,519.5L 670,573.5L 663,600L 646,626.5" +
    "L 622,639L 595,645.5L 531.5,597.5L 493.192,613.462L 450,627.5L 444.5,718.5L 421.5,733L 393,740.5L 361.5,733.5" +
    "L 336.5,719L 330,627.5L 277.5,611.5L 227.5,584.167L 156.5,646L 124.5,641L 102,626.5L 82,602.5L 78.5,572.5" +
    "L 148.167,500.833L 133.5,466.833L 122,432.5L 26.5,421L 11,400.5L 5,373.5L 12,347.5L 26.5,324L 123.5,317.5" +
    "L 136.833,274.167L 154,241L 75.5,152.5L 85.5,128.5L 103,105.5L 128.5,88.5001L 154.872,82.4758L 237,155" +
    "L 280.5,132L 330,121L 336,30L 361,15L 391,5 Z M 398.201,232L 510.201,275L 556.201,385L 505.201,491L 399.201,537" +
    "L 284.201,489L 242.201,385L 282.201,273L 398.201,232 Z";
  var gearGeo = go.Geometry.parse(gearStr);
  gearGeo.normalize();
 
  go.Shape.defineFigureGenerator("BpmnTaskService", function(shape, w, h) {
    var geo = gearGeo.copy();
    // calculate how much to scale the Geometry so that it fits in w x h
    var bounds = geo.bounds;
    var scale = Math.min(w / bounds.width, h / bounds.height);
    geo.scale(scale, scale);
    // text should go in the hand
    geo.spot1 = new go.Spot(0, 0.6, 10, 0);
    geo.spot2 = new go.Spot(1, 1);
    return geo;
  });
 
  var handGeo = go.Geometry.parse("F1M18.13,10.06 C18.18,10.07 18.22,10.07 18.26,10.08 18.91," +
    "10.20 21.20,10.12 21.28,12.93 21.36,15.75 21.42,32.40 21.42,32.40 21.42," +
    "32.40 21.12,34.10 23.08,33.06 23.08,33.06 22.89,24.76 23.80,24.17 24.72," +
    "23.59 26.69,23.81 27.19,24.40 27.69,24.98 28.03,24.97 28.03,33.34 28.03," +
    "33.34 29.32,34.54 29.93,33.12 30.47,31.84 29.71,27.11 30.86,26.56 31.80," +
    "26.12 34.53,26.12 34.72,28.29 34.94,30.82 34.22,36.12 35.64,35.79 35.64," +
    "35.79 36.64,36.08 36.72,34.54 36.80,33.00 37.17,30.15 38.42,29.90 39.67," +
    "29.65 41.22,30.20 41.30,32.29 41.39,34.37 42.30,46.69 38.86,55.40 35.75," +
    "63.29 36.42,62.62 33.47,63.12 30.76,63.58 26.69,63.12 26.69,63.12 26.69," +
    "63.12 17.72,64.45 15.64,57.62 13.55,50.79 10.80,40.95 7.30,38.95 3.80," +
    "36.95 4.24,36.37 4.28,35.35 4.32,34.33 7.60,31.25 12.97,35.75 12.97," +
    "35.75 16.10,39.79 16.10,42.00 16.10,42.00 15.69,14.30 15.80,12.79 15.96," +
    "10.75 17.42,10.04 18.13,10.06z ");
  handGeo.rotate(90, 0, 0);
  handGeo.normalize();
  go.Shape.defineFigureGenerator("BpmnTaskManual", function(shape, w, h) {
    var geo = handGeo.copy();
    // calculate how much to scale the Geometry so that it fits in w x h
    var bounds = geo.bounds;
    var scale = Math.min(w / bounds.width, h / bounds.height);
    geo.scale(scale, scale);
    // guess where text should go (in the hand)
    geo.spot1 = new go.Spot(0, 0.6, 10, 0);
    geo.spot2 = new go.Spot(1, 1);
    return geo;
  });
 
 
  // define the appearance of tooltips, shared by various templates
  var tooltiptemplate =
    $(go.Adornment, go.Panel.Auto,
      $(go.Shape, "RoundedRectangle",
        { fill: "whitesmoke", stroke: "gray" }),
      $(go.TextBlock,
        { margin: 3, editable: true },
        new go.Binding("text", "", function (data) {
          if (data.item !== undefined) return data.item;
          return "(unnamed item)";
        }))
    );
 
 
  // conversion functions used by data Bindings
 
  function nodeActivityTaskTypeConverter(s) {
    var tasks = ["Empty",
                  "BpmnTaskMessage",
                  "BpmnTaskUser",
                  "BpmnTaskManual",   // Custom hand symbol
                  "BpmnTaskScript",
                  "BpmnTaskMessage",  // should be black on white
                  "BpmnTaskService",  // Custom gear symbol
                  "InternalStorage"];
    if (s < tasks.length) return tasks[s];
    return "NotAllowed"; // error
  }
 
  // location of event on boundary of Activity is based on the index of the event in the boundaryEventArray
  function nodeActivityBESpotConverter(s) {
    var x = 10 + (EventNodeSize / 2);
    if (s === 0) return new go.Spot(0, 1, x, 0);    // bottom left
    if (s === 1) return new go.Spot(1, 1, -x, 0);   // bottom right
    if (s === 2) return new go.Spot(1, 0, -x, 0);   // top right
    return new go.Spot(1, 0, -x - (s - 2) * EventNodeSize, 0);    // top ... right-to-left-ish spread
  }
 
  function nodeActivityTaskTypeColorConverter(s) {
    return (s == 5) ? "dimgray" : "white";
  }
 
  function nodeEventTypeConverter(s) {  // order here from BPMN 2.0 poster
    var tasks = [ "NotAllowed",
                  "Empty",
                  "BpmnTaskMessage",
                  "BpmnEventTimer",
                  "BpmnEventEscalation",
                  "BpmnEventConditional",
                  "Arrow",
                  "BpmnEventError",
                  "ThinX",
                  "BpmnActivityCompensation",
                  "Triangle",
                  "Pentagon",
                  "ThickCross",
                  "Circle"];
    if (s < tasks.length) return tasks[s];
    return "NotAllowed"; // error
  }
 
  function nodeEventDimensionStrokeColorConverter(s) {
    if (s === 8) return EventDimensionStrokeEndColor;
    return EventDimensionStrokeColor;
  }
 
  function nodeEventDimensionSymbolFillConverter(s) {
    if (s <= 6) return EventSymbolLightFill;
    return EventSymbolDarkFill;
  }
 
 
  //------------------------------------------  Activity Node Boundary Events   ----------------------------------------------
 
  var boundaryEventMenu =  // context menu for each boundaryEvent on Activity node
  $(go.Adornment, "Vertical",
    $("ContextMenuButton",
      $(go.TextBlock, "Remove event"),
      // in the click event handler, the obj.part is the Adornment; its adornedObject is the port
      { click: function(e, obj) { removeActivityNodeBoundaryEvent(obj.part.adornedObject); } })
   );
 
  // removing a boundary event doesn't not reposition other BE circles on the node
  // just reassigning alignmentIndex in remaining BE would do that.
  function removeActivityNodeBoundaryEvent(obj) {
    myDiagram.startTransaction("removeBoundaryEvent");
    var pid = obj.portId;
    var arr = obj.panel.itemArray;
    for (var i = 0; i < arr.length; i++) {
      if (arr[i].portId === pid) {
        myDiagram.model.removeArrayItem(arr, i);
        break;
      }
    }
    myDiagram.commitTransaction("removeBoundaryEvent");
  }
 
  var boundaryEventItemTemplate =
    $(go.Panel, "Spot",
       { contextMenu: boundaryEventMenu,
         alignmentFocus: go.Spot.Center,
         fromLinkable: true, toLinkable: false, cursor: "pointer", fromSpot: go.Spot.Bottom,
         fromMaxLinks: 1, toMaxLinks: 0
       },
       new go.Binding("portId", "portId"),
       new go.Binding("alignment", "alignmentIndex", nodeActivityBESpotConverter),
      $(go.Shape, "Circle",
        { desiredSize: new go.Size(EventNodeSize, EventNodeSize) },
        new go.Binding("strokeDashArray", "eventDimension", function(s) { return (s === 6) ? [4, 2] : null; }),
        new go.Binding("fromSpot", "alignmentIndex",
          function(s) {
            //  nodeActivityBEFromSpotConverter, 0 & 1 go on bottom, all others on top of activity
            if (s < 2) return go.Spot.Bottom;
            return go.Spot.Top;
          }),
        new go.Binding("fill", "color")),
      $(go.Shape, "Circle",
         { alignment: go.Spot.Center,
           desiredSize: new go.Size(EventNodeInnerSize, EventNodeInnerSize), fill: null },
         new go.Binding("strokeDashArray", "eventDimension", function(s) { return (s === 6) ? [4, 2] : null; })
       ),
      $(go.Shape, "NotAllowed",
          { alignment: go.Spot.Center,
            desiredSize: new go.Size(EventNodeSymbolSize, EventNodeSymbolSize), fill: "white" },
            new go.Binding("figure", "eventType", nodeEventTypeConverter)
        )
    );
 
  //------------------------------------------  Activity Node contextMenu   ----------------------------------------------
 
  var activityNodeMenu =
       $(go.Adornment, "Vertical",
         $("ContextMenuButton",
             $(go.TextBlock, "Add Email Event", { margin: 3 }),
             { click: function(e, obj) { addActivityNodeBoundaryEvent(2, 5); } }),
         $("ContextMenuButton",
             $(go.TextBlock, "Add Timer Event", { margin: 3 }),
             { click: function(e, obj) { addActivityNodeBoundaryEvent(3, 5); } }),
         $("ContextMenuButton",
             $(go.TextBlock, "Add Escalation Event", { margin: 3 }),
             { click: function(e, obj) { addActivityNodeBoundaryEvent(4, 5); } }),
         $("ContextMenuButton",
             $(go.TextBlock, "Add Error Event", { margin: 3 }),
             { click: function(e, obj) { addActivityNodeBoundaryEvent(7, 5); } }),
         $("ContextMenuButton",
             $(go.TextBlock, "Add Signal Event", { margin: 3 }),
             { click: function(e, obj) { addActivityNodeBoundaryEvent(10, 5); } }),
         $("ContextMenuButton",
             $(go.TextBlock, "Add N-I Escalation Event", { margin: 3 }),
             { click: function(e, obj) { addActivityNodeBoundaryEvent(4, 6); } }),
         $("ContextMenuButton",
             $(go.TextBlock, "Rename", { margin: 3 }),
             { click: function(e, obj) { rename(obj); } }));
 
 
  // sub-process,  loop, parallel, sequential, ad doc and compensation markers in horizontal array
  function makeSubButton(sub) {
    if (sub)
      return [$("SubGraphExpanderButton"),
              { margin: 2, visible: false },
                   new go.Binding("visible", "isSubProcess")];
    return [];
  }
 
  // sub-process,  loop, parallel, sequential, ad doc and compensation markers in horizontal array
  function makeMarkerPanel(sub, scale) {
    return $(go.Panel, "Horizontal",
            { alignment: go.Spot.MiddleBottom, alignmentFocus: go.Spot.MiddleBottom },
            $(go.Shape, "BpmnActivityLoop",
              { width: 12 / scale, height: 12 / scale, margin: 2, visible: false, strokeWidth: ActivityMarkerStrokeWidth },
              new go.Binding("visible", "isLoop")),
            $(go.Shape, "BpmnActivityParallel",
              { width: 12 / scale, height: 12 / scale, margin: 2, visible: false, strokeWidth: ActivityMarkerStrokeWidth },
              new go.Binding("visible", "isParallel")),
            $(go.Shape, "BpmnActivitySequential",
              { width: 12 / scale, height: 12 / scale, margin: 2, visible: false, strokeWidth: ActivityMarkerStrokeWidth },
              new go.Binding("visible", "isSequential")),
            $(go.Shape, "BpmnActivityAdHoc",
              { width: 12 / scale, height: 12 / scale, margin: 2, visible: false, strokeWidth: ActivityMarkerStrokeWidth },
              new go.Binding("visible", "isAdHoc")),
            $(go.Shape, "BpmnActivityCompensation",
              { width: 12 / scale, height: 12 / scale, margin: 2, visible: false, strokeWidth: ActivityMarkerStrokeWidth, fill: null },
              new go.Binding("visible", "isCompensation")),
            makeSubButton(sub)
          ); // end activity markers horizontal panel
  }
 
  var activityNodeTemplate =
  $(go.Node, "Spot",
     { locationObjectName: "SHAPE", locationSpot: go.Spot.Center,
       resizable: true, resizeObjectName: "PANEL",
       toolTip: tooltiptemplate,
       selectionAdorned: false,  // use a Binding on the Shape.stroke to show selection
       contextMenu: activityNodeMenu,
       itemTemplate: boundaryEventItemTemplate
     },
     new go.Binding("itemArray", "boundaryEventArray"),
     new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
     // move a selected part into the Foreground layer, so it isn"t obscured by any non-selected parts
     new go.Binding("layerName", "isSelected", function(s) { return s ? "Foreground" : ""; }).ofObject(),
    $(go.Panel, "Auto",
      { name: "PANEL",
          minSize: new go.Size(ActivityNodeWidth, ActivityNodeHeight),
          desiredSize: new go.Size(ActivityNodeWidth, ActivityNodeHeight)
      },
      new go.Binding("desiredSize", "size", go.Size.parse).makeTwoWay(go.Size.stringify),
       $(go.Panel, "Spot",
        $(go.Shape, "RoundedRectangle",  // the outside rounded rectangle
          { name: "SHAPE",
              fill: ActivityNodeFill, stroke: ActivityNodeStroke,
            parameter1: 10, // corner size
            portId: "", fromLinkable: true, toLinkable: true, cursor: "pointer",
            fromSpot: go.Spot.RightSide, toSpot: go.Spot.LeftSide
          },
          new go.Binding("fill", "color"),
          new go.Binding("strokeWidth", "isCall",
               function(s) { return s ? ActivityNodeStrokeWidthIsCall : ActivityNodeStrokeWidth; })
         ),
//        $(go.Shape, "RoundedRectangle",  // the inner "Transaction" rounded rectangle
//          { margin: 3,
//            stretch: go.GraphObject.Fill,
  //            stroke: ActivityNodeStroke,
//            parameter1: 8, fill: null, visible: false
//          },
//          new go.Binding("visible", "isTransaction")
//         ),
        // task icon
        $(go.Shape, "BpmnTaskScript",    // will be None, Script, Manual, Service, etc via converter
          { alignment: new go.Spot(0, 0, 5, 5), alignmentFocus: go.Spot.TopLeft,
            width: 22, height: 22
          },
          new go.Binding("fill", "taskType", nodeActivityTaskTypeColorConverter),
          new go.Binding("figure", "taskType", nodeActivityTaskTypeConverter)
          ), // end Task Icon
        makeMarkerPanel(false, 1) // sub-process,  loop, parallel, sequential, ad doc and compensation markers
        ),  // end main body rectangles spot panel
      $(go.TextBlock,  // the center text
        { alignment: go.Spot.Center, textAlign: "center", margin: 12,
          editable: true
        },
        new go.Binding("text").makeTwoWay())
      )  // end Auto Panel
    );  // end go.Node, which is a Spot Panel with bound itemArray
 
  // ------------------------------- template for Activity / Task node in Palette  -------------------------------
 
  var palscale = 2;
  var activityNodeTemplateForPalette =
  $(go.Node, "Vertical",
     { locationObjectName: "SHAPE",
       locationSpot: go.Spot.Center,
       selectionAdorned: false
     },
    new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
    $(go.Panel, "Spot",
      { name: "PANEL",
          desiredSize: new go.Size(ActivityNodeWidth / palscale, ActivityNodeHeight / palscale)
      },
      $(go.Shape, "RoundedRectangle",  // the outside rounded rectangle
        { name: "SHAPE",
            fill: ActivityNodeFill, stroke: ActivityNodeStroke,
          parameter1: 10 / palscale  // corner size (default 10)
        },
        new go.Binding("strokeWidth", "isCall",
            function(s) { return s ? ActivityNodeStrokeWidthIsCall : ActivityNodeStrokeWidth; })),
      $(go.Shape, "RoundedRectangle",  // the inner "Transaction" rounded rectangle
        { margin: 3,
          stretch: go.GraphObject.Fill,
            stroke: ActivityNodeStroke,
          parameter1: 8 / palscale, fill: null, visible: false
        },
        new go.Binding("visible", "isTransaction")),
      // task icon
      $(go.Shape, "BpmnTaskScript",    // will be None, Script, Manual, Service, etc via converter
        { alignment: new go.Spot(0, 0, 5, 5), alignmentFocus: go.Spot.TopLeft,
          width: 22 / palscale, height: 22 / palscale
        },
        new go.Binding("fill", "taskType", nodeActivityTaskTypeColorConverter),
        new go.Binding("figure", "taskType", nodeActivityTaskTypeConverter)),
      makeMarkerPanel(false, palscale) // sub-process,  loop, parallel, sequential, ad doc and compensation markers
    ), // End Spot panel
    $(go.TextBlock,  // the center text
        { alignment: go.Spot.Center, textAlign: "center", margin: 2 },
        new go.Binding("text"))
    );  // End Node
 
  var subProcessGroupTemplateForPalette =
  $(go.Group, "Vertical",
     { locationObjectName: "SHAPE",
       locationSpot: go.Spot.Center,
       isSubGraphExpanded: false,
       selectionAdorned: false
     },
    $(go.Panel, "Spot",
      { name: "PANEL",
          desiredSize: new go.Size(ActivityNodeWidth / palscale, ActivityNodeHeight / palscale)
      },
      $(go.Shape, "RoundedRectangle",  // the outside rounded rectangle
            { name: "SHAPE",
                fill: ActivityNodeFill, stroke: ActivityNodeStroke,
              parameter1: 10 / palscale  // corner size (default 10)
            },
              new go.Binding("strokeWidth", "isCall", function(s) { return s ? ActivityNodeStrokeWidthIsCall : ActivityNodeStrokeWidth; })
          ),
      $(go.Shape, "RoundedRectangle",  // the inner "Transaction" rounded rectangle
        { margin: 3,
          stretch: go.GraphObject.Fill,
            stroke: ActivityNodeStroke,
          parameter1: 8 / palscale, fill: null, visible: false
        },
        new go.Binding("visible", "isTransaction")),
        makeMarkerPanel(true, palscale) // sub-process,  loop, parallel, sequential, ad doc and compensation markers
      ), // end main body rectangles spot panel
      $(go.TextBlock,  // the center text
        { alignment: go.Spot.Center, textAlign: "center", margin: 2 },
        new go.Binding("text"))
    );  // end go.Group
 
  //------------------------------------------  Event Node Template  ----------------------------------------------
 
  var eventNodeTemplate =
    $(go.Node, "Vertical",
      { locationObjectName: "SHAPE",
        locationSpot: go.Spot.Center,
        toolTip: tooltiptemplate
      },
      new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
      // move a selected part into the Foreground layer, so it isn't obscured by any non-selected parts
      new go.Binding("layerName", "isSelected", function(s) { return s ? "Foreground" : ""; }).ofObject(),
      // can be resided according to the user's desires
      { resizable: false, resizeObjectName: "SHAPE" },
        $(go.Panel, "Spot",
          $(go.Shape, "Circle",  // Outer circle
            { strokeWidth: 1,
              name: "SHAPE",
              desiredSize: new go.Size(EventNodeSize, EventNodeSize),
              portId: "", fromLinkable: true, toLinkable: true, cursor: "pointer",
              fromSpot: go.Spot.RightSide, toSpot: go.Spot.LeftSide
            },
            // allows the color to be determined by the node data
            new go.Binding("fill", "eventDimension", function(s) { return (s === 8) ? EventEndOuterFillColor : EventBackgroundColor; }),
            new go.Binding("strokeWidth", "eventDimension", function(s) { return s === 8 ? EventNodeStrokeWidthIsEnd : 1; }),
            new go.Binding("stroke", "eventDimension", nodeEventDimensionStrokeColorConverter),
            new go.Binding("strokeDashArray", "eventDimension", function(s) { return (s === 3 || s === 6) ? [4, 2] : null; }),
            new go.Binding("desiredSize", "size", go.Size.parse).makeTwoWay(go.Size.stringify)
          ),  // end main shape
          $(go.Shape, "Circle",  // Inner circle
              { alignment: go.Spot.Center, desiredSize: new go.Size(EventNodeInnerSize, EventNodeInnerSize), fill: null },
              new go.Binding("stroke", "eventDimension", nodeEventDimensionStrokeColorConverter),
              new go.Binding("strokeDashArray", "eventDimension", function(s) { return (s === 3 || s === 6) ? [4, 2] : null; }), // dashes for non-interrupting
              new go.Binding("visible", "eventDimension", function(s) { return s > 3 && s <= 7; }) // inner  only visible for 4 thru 7
            ),
$(go.Shape, "NotAllowed",
              { alignment: go.Spot.Center, desiredSize: new go.Size(EventNodeSymbolSize, EventNodeSymbolSize), stroke: "black" },
                new go.Binding("figure", "eventType", nodeEventTypeConverter),
                new go.Binding("fill", "eventDimension", nodeEventDimensionSymbolFillConverter)
            )
        ),  // end Auto Panel
        $(go.TextBlock,
          { alignment: go.Spot.Center, textAlign: "center", margin: 5, editable: true },
          new go.Binding("text").makeTwoWay())
 
      ); // end go.Node Vertical
 
  //------------------------------------------  Gateway Node Template   ----------------------------------------------
 
  function nodeGatewaySymbolTypeConverter(s) {
    var tasks =  ["NotAllowed",
                  "ThinCross",      // 1 - Parallel
                  "Circle",         // 2 - Inclusive
                  "AsteriskLine",   // 3 - Complex
                  "ThinX",          // 4 - Exclusive  (exclusive can also be no symbol, just bind to visible=false for no symbol)
                  "Pentagon",       // 5 - double cicle event based gateway
                  "Pentagon",       // 6 - exclusive event gateway to start a process (single circle)
                  "ThickCross"]     // 7 - parallel event gateway to start a process (single circle)
    if (s < tasks.length) return tasks[s];
    return "NotAllowed"; // error
  }
 
  // tweak the size of some of the gateway icons
  function nodeGatewaySymbolSizeConverter(s) {
    var size = new go.Size(GatewayNodeSymbolSize, GatewayNodeSymbolSize);
    if (s === 4) {
      size.width = size.width / 4 * 3;
      size.height = size.height / 4 * 3;
    }
    else if (s > 4) {
      size.width = size.width / 1.6;
      size.height = size.height / 1.6;
    }
    return size;
  }
  function nodePalGatewaySymbolSizeConverter(s) {
    var size = nodeGatewaySymbolSizeConverter(s);
    size.width = size.width / 2;
    size.height = size.height / 2;
    return size;
  }
 
  var gatewayNodeTemplate =
    $(go.Node, "Vertical",
      { locationObjectName: "SHAPE",
        locationSpot: go.Spot.Center,
        toolTip: tooltiptemplate
      },
      new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
      // move a selected part into the Foreground layer, so it isn't obscured by any non-selected parts
      new go.Binding("layerName", "isSelected", function(s) { return s ? "Foreground" : ""; }).ofObject(),
      // can be resided according to the user's desires
      { resizable: false, resizeObjectName: "SHAPE" },
        $(go.Panel, "Spot",
          $(go.Shape, "Diamond",
            { strokeWidth: 1, fill: GatewayNodeFill, stroke: GatewayNodeStroke,
              name: "SHAPE",
              desiredSize: new go.Size(GatewayNodeSize, GatewayNodeSize),
              portId: "", fromLinkable: true, toLinkable: true, cursor: "pointer",
              fromSpot: go.Spot.NotLeftSide, toSpot: go.Spot.MiddleLeft
            },
            new go.Binding("desiredSize", "size", go.Size.parse).makeTwoWay(go.Size.stringify)),  // end main shape
          $(go.Shape, "NotAllowed",
              { alignment: go.Spot.Center, stroke: GatewayNodeSymbolStroke, fill: GatewayNodeSymbolFill },
                new go.Binding("figure", "gatewayType", nodeGatewaySymbolTypeConverter),
                //new go.Binding("visible", "gatewayType", function(s) { return s !== 4; }),   // comment out if you want exclusive gateway to be X instead of blank.
                new go.Binding("strokeWidth", "gatewayType", function(s) { return (s <=4 ) ? GatewayNodeSymbolStrokeWidth : 1; }),
                new go.Binding("desiredSize", "gatewayType", nodeGatewaySymbolSizeConverter)),
          // the next 2 circles only show up for event gateway
          $(go.Shape, "Circle",  // Outer circle
            { strokeWidth: 1, stroke: GatewayNodeSymbolStroke, fill: null, desiredSize: new go.Size(EventNodeSize, EventNodeSize)
            },
            new go.Binding("visible", "gatewayType", function(s) { return s >= 5; }) // only visible for > 5
          ),  // end main shape
          $(go.Shape, "Circle",  // Inner circle
              { alignment: go.Spot.Center, stroke: GatewayNodeSymbolStroke,
                desiredSize: new go.Size(EventNodeInnerSize, EventNodeInnerSize),
                fill: null },
              new go.Binding("visible", "gatewayType", function(s) { return s === 5; }) // inner  only visible for == 5
            )
         ),
        $(go.TextBlock,
          { alignment: go.Spot.Center, textAlign: "center", margin: 5, editable: true },
          new go.Binding("text").makeTwoWay())
      ); // end go.Node Vertical
 
  //--------------------------------------------------------------------------------------------------------------
 
  var gatewayNodeTemplateForPalette =
    $(go.Node, "Vertical",
      { toolTip: tooltiptemplate,
        resizable: false,
        locationObjectName: "SHAPE",
        locationSpot: go.Spot.Center,
        resizeObjectName: "SHAPE" },
      new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
      $(go.Panel, "Spot",
        $(go.Shape, "Diamond",
          { strokeWidth: 1, fill: GatewayNodeFill, stroke: GatewayNodeStroke, name: "SHAPE",
            desiredSize: new go.Size(GatewayNodeSize / 2, GatewayNodeSize / 2)
          }),
        $(go.Shape, "NotAllowed",
            { alignment: go.Spot.Center, stroke: GatewayNodeSymbolStroke, strokeWidth: GatewayNodeSymbolStrokeWidth, fill: GatewayNodeSymbolFill },
              new go.Binding("figure", "gatewayType", nodeGatewaySymbolTypeConverter),
              //new go.Binding("visible", "gatewayType", function(s) { return s !== 4; }),   // comment out if you want exclusive gateway to be X instead of blank.
              new go.Binding("strokeWidth", "gatewayType", function(s) { return (s <=4 ) ? GatewayNodeSymbolStrokeWidth : 1; }),
              new go.Binding("desiredSize", "gatewayType", nodePalGatewaySymbolSizeConverter)),
          // the next 2 circles only show up for event gateway
          $(go.Shape, "Circle",  // Outer circle
            { strokeWidth: 1, stroke: GatewayNodeSymbolStroke, fill: null, desiredSize: new go.Size(EventNodeSize/2, EventNodeSize/2)
            },
            //new go.Binding("desiredSize", "gatewayType", new go.Size(EventNodeSize/2, EventNodeSize/2)),
            new go.Binding("visible", "gatewayType", function(s) { return s >= 5; }) // only visible for > 5
          ),  // end main shape
          $(go.Shape, "Circle",  // Inner circle
              { alignment: go.Spot.Center, stroke: GatewayNodeSymbolStroke,
                desiredSize: new go.Size(EventNodeInnerSize/2, EventNodeInnerSize/2),
                fill: null },
              new go.Binding("visible", "gatewayType", function(s) { return s === 5; }) // inner  only visible for == 5
            )),
 
      $(go.TextBlock,
        { alignment: go.Spot.Center, textAlign: "center", margin: 5, editable: false },
        new go.Binding("text"))
    );
 
  //--------------------------------------------------------------------------------------------------------------
 
  var annotationNodeTemplate =
    $(go.Node, "Auto",
      { background: GradientLightGray, locationSpot: go.Spot.Center },
      new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
      $(go.Shape, "Annotation", // A left bracket shape
        { portId: "", fromLinkable: true, cursor: "pointer", fromSpot: go.Spot.Left, strokeWidth: 2, stroke: "gray" }),
      $(go.TextBlock,
        { margin: 5, editable: true },
        new go.Binding("text").makeTwoWay())
    );
 
  var dataObjectNodeTemplate =
    $(go.Node, "Vertical",
      { locationObjectName: "SHAPE", locationSpot: go.Spot.Center },
      new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
      $(go.Shape, "File",
        { name: "SHAPE", portId: "", fromLinkable: true, toLinkable: true, cursor: "pointer",
          fill: DataFill, desiredSize: new go.Size(EventNodeSize * 0.8, EventNodeSize)}),
      $(go.TextBlock,
        { margin: 5,
          editable: true },
          new go.Binding("text").makeTwoWay())
    );
 
  var dataStoreNodeTemplate =
    $(go.Node, "Vertical",
      { locationObjectName: "SHAPE", locationSpot: go.Spot.Center },
      new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
      $(go.Shape, "Database",
        { name: "SHAPE", portId: "", fromLinkable: true, toLinkable: true, cursor: "pointer",
          fill: DataFill, desiredSize: new go.Size(EventNodeSize, EventNodeSize) }),
      $(go.TextBlock,
        { margin: 5, editable: true },
        new go.Binding("text").makeTwoWay())
    );
 
  //------------------------------------------  private process Node Template Map   ----------------------------------------------
 
  var privateProcessNodeTemplate =
    $(go.Node, "Auto",
      { layerName: "Background", resizable: true, resizeObjectName: "LANE" },
      new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
      $(go.Shape, "Rectangle",
        { fill: null }),
      $(go.Panel, "Table",     // table with 2 cells to hold header and lane
        { desiredSize: new go.Size(ActivityNodeWidth * 6, ActivityNodeHeight),
          background: DataFill, name: "LANE", minSize: new go.Size(ActivityNodeWidth, ActivityNodeHeight * 0.667)
        },
        new go.Binding("desiredSize", "size", go.Size.parse).makeTwoWay(go.Size.stringify),
        $(go.TextBlock,
          { row: 0, column: 0,
            angle: 270, margin: 5,
            editable: true, textAlign: "center"
          },
          new go.Binding("text").makeTwoWay()),
        $(go.RowColumnDefinition, { column: 1, separatorStrokeWidth: 1, separatorStroke: "black" }),
        $(go.Shape, "Rectangle",
          { row: 0, column: 1,
            stroke: null, fill: "transparent",
            portId: "", fromLinkable: true, toLinkable: true,
            fromSpot: go.Spot.TopBottomSides, toSpot: go.Spot.TopBottomSides,
            cursor: "pointer", stretch: go.GraphObject.Fill })
       )
    );
 
  var privateProcessNodeTemplateForPalette =
    $(go.Node, "Vertical",
      { locationSpot: go.Spot.Center },
      $(go.Shape, "Process",
        { fill: DataFill, desiredSize: new go.Size(GatewayNodeSize / 2, GatewayNodeSize / 4) }),
      $(go.TextBlock,
        { margin: 5, editable: true },
        new go.Binding("text"))
    );
 
  var poolTemplateForPalette =
    $(go.Group, "Vertical",
      { locationSpot: go.Spot.Center,
        computesBoundsIncludingLinks: false,
        isSubGraphExpanded: false
      },
      $(go.Shape, "Process",
        { fill: "white", desiredSize: new go.Size(GatewayNodeSize / 2, GatewayNodeSize / 4) }),
      $(go.Shape, "Process",
        { fill: "white", desiredSize: new go.Size(GatewayNodeSize / 2, GatewayNodeSize / 4) }),
      $(go.TextBlock,
        { margin: 5, editable: true },
        new go.Binding("text"))
    );
 
  var swimLanesGroupTemplateForPalette =
    $(go.Group, "Vertical" ); // empty in the palette
 
  var subProcessGroupTemplate =
    $(go.Group, "Spot",
      { locationSpot: go.Spot.Center,
        locationObjectName: "PH",
        //locationSpot: go.Spot.Center,
        isSubGraphExpanded: false,
        memberValidation: function(group, part) {
          return !(part instanceof go.Group) ||
                 (part.category !== "Pool" && part.category !== "Lane");
        },
        mouseDrop: function(e, grp) {
          var ok = grp.addMembers(grp.diagram.selection, true);
          if (!ok) grp.diagram.currentTool.doCancel();
        },
        contextMenu: activityNodeMenu,
        itemTemplate: boundaryEventItemTemplate
      },
      new go.Binding("itemArray", "boundaryEventArray"),
      new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
      // move a selected part into the Foreground layer, so it isn't obscured by any non-selected parts
      // new go.Binding("layerName", "isSelected", function (s) { return s ? "Foreground" : ""; }).ofObject(),
      $(go.Panel, "Auto",
        $(go.Shape, "RoundedRectangle",
            {
              name: "PH", fill: SubprocessNodeFill, stroke: SubprocessNodeStroke,
              minSize: new go.Size(ActivityNodeWidth, ActivityNodeHeight),
              portId: "", fromLinkable: true, toLinkable: true, cursor: "pointer",
              fromSpot: go.Spot.RightSide, toSpot: go.Spot.LeftSide
            },
            new go.Binding("strokeWidth", "isCall", function(s) { return s ? ActivityNodeStrokeWidthIsCall : ActivityNodeStrokeWidth; })
           ),
          $(go.Panel, "Vertical",
            { defaultAlignment: go.Spot.Left },
            $(go.TextBlock,  // label
              { margin: 3, editable: true },
              new go.Binding("text", "text").makeTwoWay(),
              new go.Binding("alignment", "isSubGraphExpanded", function(s) { return s ? go.Spot.TopLeft : go.Spot.Center; })),
            // create a placeholder to represent the area where the contents of the group are
            $(go.Placeholder,
              { padding: new go.Margin(5, 5) }),
            makeMarkerPanel(true, 1)  // sub-process,  loop, parallel, sequential, ad doc and compensation markers
          )  // end Vertical Panel
        )
      );  // end Group
 
    //** need this in the subprocess group template above.
    //        $(go.Shape, "RoundedRectangle",  // the inner "Transaction" rounded rectangle
    //          { margin: 3,
    //            stretch: go.GraphObject.Fill,
    //            stroke: ActivityNodeStroke,
    //            parameter1: 8, fill: null, visible: false
    //          },
    //          new go.Binding("visible", "isTransaction")
    //         ),
 
 
  function groupStyle() {  // common settings for both Lane and Pool Groups
      return [
        {
            layerName: "Background",  // all pools and lanes are always behind all nodes and links
            background: "transparent",  // can grab anywhere in bounds
            movable: true, // allows users to re-order by dragging
            copyable: false,  // can't copy lanes or pools
            avoidable: false  // don't impede AvoidsNodes routed Links
        },
        new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify)
      ];
  }
 
    // hide links between lanes when either lane is collapsed
  function updateCrossLaneLinks(group) {
    group.findExternalLinksConnected().each(function(l) {
          l.visible = (l.fromNode.isVisible() && l.toNode.isVisible());
      });
  }
 
  var laneEventMenu =  // context menu for each lane
  $(go.Adornment, "Vertical",
    $("ContextMenuButton",
      $(go.TextBlock, "Add Lane"),
      // in the click event handler, the obj.part is the Adornment; its adornedObject is the port
        {click: function(e, obj) { addLaneEvent(obj.part.adornedObject); } })
   );
 
    // Add a lane to pool (lane parameter is lane above new lane)
  function addLaneEvent(lane) {
      myDiagram.startTransaction("addLane");
      if (lane != null && lane.data.category === "Lane") {
          // create a new lane data object
          var shape = lane.findObject("SHAPE");
          var size = new go.Size(shape.width, MINBREADTH);
          //size.height = MINBREADTH;
          var newlanedata = {
              category: "Lane",
              text: "New Lane",
              color: "white",
              isGroup: true,
              loc: go.Point.stringify(new go.Point(lane.location.x, lane.location.y + 1)), // place below selection
              size: go.Size.stringify(size),
              group: lane.data.group
          };
          // and add it to the model
          myDiagram.model.addNodeData(newlanedata);
      }
      myDiagram.commitTransaction("addLane");
  }
 
  var swimLanesGroupTemplate =
  $(go.Group, "Spot", groupStyle(),
    {
        name: "Lane",
        contextMenu: laneEventMenu,
        minLocation: new go.Point(NaN, -Infinity),  // only allow vertical movement
        maxLocation: new go.Point(NaN, Infinity),
        selectionObjectName: "SHAPE",  // selecting a lane causes the body of the lane to be highlit, not the label
        resizable: true, resizeObjectName: "SHAPE",  // the custom resizeAdornmentTemplate only permits two kinds of resizing
        layout: $(go.LayeredDigraphLayout,  // automatically lay out the lane's subgraph
                  {
                      isInitial: false,  // don't even do initial layout
                      isOngoing: false,  // don't invalidate layout when nodes or links are added or removed
                      direction: 0,
                      columnSpacing: 10,
                      layeringOption: go.LayeredDigraphLayout.LayerLongestPathSource
                  }),
        computesBoundsAfterDrag: true,  // needed to prevent recomputing Group.placeholder bounds too soon
        computesBoundsIncludingLinks: false,  // to reduce occurrences of links going briefly outside the lane
        computesBoundsIncludingLocation: true,  // to support empty space at top-left corner of lane
        handlesDragDropForMembers: true,  // don't need to define handlers on member Nodes and Links
        mouseDrop: function(e, grp) {  // dropping a copy of some Nodes and Links onto this Group adds them to this Group
            // don't allow drag-and-dropping a mix of regular Nodes and Groups
          if (!e.diagram.selection.any(function(n) { return (n instanceof go.Group && n.category !== "subprocess") || n.category === "privateProcess"; })) {
                var ok = grp.addMembers(grp.diagram.selection, true);
                if (ok) {
                    updateCrossLaneLinks(grp);
                    relayoutDiagram();
                } else {
                    grp.diagram.currentTool.doCancel();
                }
            }
        },
        subGraphExpandedChanged: function(grp) {
            var shp = grp.resizeObject;
            if (grp.diagram.undoManager.isUndoingRedoing) return;
            if (grp.isSubGraphExpanded) {
                shp.height = grp._savedBreadth;
            } else {
                grp._savedBreadth = shp.height;
                shp.height = NaN;
            }
            updateCrossLaneLinks(grp);
        }
    },
    //new go.Binding("isSubGraphExpanded", "expanded").makeTwoWay(),
 
    $(go.Shape, "Rectangle",  // this is the resized object
        {name: "SHAPE", fill: "white", stroke: null },  // need stroke null here or you gray out some of pool border.
      new go.Binding("fill", "color"),
      new go.Binding("desiredSize", "size", go.Size.parse).makeTwoWay(go.Size.stringify)),
 
   // the lane header consisting of a Shape and a TextBlock
      $(go.Panel, "Horizontal",
      {
          name: "HEADER",
          angle: 270,  // maybe rotate the header to read sideways going up
          alignment: go.Spot.LeftCenter, alignmentFocus: go.Spot.LeftCenter
      },
        $(go.TextBlock,  // the lane label
          {editable: true, margin: new go.Margin(2, 0, 0, 8) },
          new go.Binding("visible", "isSubGraphExpanded").ofObject(),
          new go.Binding("text", "text").makeTwoWay()),
        $("SubGraphExpanderButton", { margin: 4, angle: -270 })  // but this remains always visible!
       ),  // end Horizontal Panel
      $(go.Placeholder,
        { padding: 12, alignment: go.Spot.TopLeft, alignmentFocus: go.Spot.TopLeft }),
    $(go.Panel, "Horizontal", { alignment: go.Spot.TopLeft, alignmentFocus: go.Spot.TopLeft },
      $(go.TextBlock,  // this TextBlock is only seen when the swimlane is collapsed
        {
            name: "LABEL",
            editable: true, visible: false,
            angle: 0, margin: new go.Margin(6, 0, 0, 20)
        },
          new go.Binding("visible", "isSubGraphExpanded", function(e) { return !e; }).ofObject(),
        new go.Binding("text", "text").makeTwoWay())
     )
  );  // end swimLanesGroupTemplate
 
    // define a custom resize adornment that has two resize handles if the group is expanded
    //myDiagram.groupTemplate.resizeAdornmentTemplate =
  swimLanesGroupTemplate.resizeAdornmentTemplate =
    $(go.Adornment, "Spot",
      $(go.Placeholder),
      $(go.Shape,  // for changing the length of a lane
        {
            alignment: go.Spot.Right,
            desiredSize: new go.Size(7, 50),
            fill: "lightblue", stroke: "dodgerblue",
            cursor: "col-resize"
        },
        new go.Binding("visible", "", function(ad) {
          if (ad.adornedPart === null) return false;
          return ad.adornedPart.isSubGraphExpanded;
        }).ofObject()),
      $(go.Shape,  // for changing the breadth of a lane
        {
            alignment: go.Spot.Bottom,
            desiredSize: new go.Size(50, 7),
            fill: "lightblue", stroke: "dodgerblue",
            cursor: "row-resize"
        },
        new go.Binding("visible", "", function(ad) {
          if (ad.adornedPart === null) return false;
          return ad.adornedPart.isSubGraphExpanded;
        }).ofObject())
    );
 
 var poolGroupTemplate =
    $(go.Group, "Auto", groupStyle(),
      {
        computesBoundsIncludingLinks: false,
        // use a simple layout that ignores links to stack the "lane" Groups on top of each other
        layout: $(PoolLayout, { spacing: new go.Size(0, 0) })  // no space between lanes
      },
      new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
      $(go.Shape,
        { fill: "white" },
        new go.Binding("fill", "color")),
      $(go.Panel, "Table",
        { defaultColumnSeparatorStroke: "black" },
        $(go.Panel, "Horizontal",
          { column: 0, angle: 270 },
          $(go.TextBlock,
            { editable: true, margin: new go.Margin(5, 0, 5, 0) },  // margin matches private process (black box pool)
            new go.Binding("text").makeTwoWay())
        ),
        $(go.Placeholder,
          { background: "darkgray", column: 1 })
      )
    ); // end poolGroupTemplate
 
  //------------------------------------------  Template Maps  ----------------------------------------------
 
  // create the nodeTemplateMap, holding main view node templates:
  var nodeTemplateMap = new go.Map("string", go.Node);
  // for each of the node categories, specify which template to use
  nodeTemplateMap.add("activity", activityNodeTemplate);
  nodeTemplateMap.add("event", eventNodeTemplate);
  nodeTemplateMap.add("gateway", gatewayNodeTemplate);
  nodeTemplateMap.add("annotation", annotationNodeTemplate);
  nodeTemplateMap.add("dataobject", dataObjectNodeTemplate);
  nodeTemplateMap.add("datastore", dataStoreNodeTemplate);
  nodeTemplateMap.add("privateProcess", privateProcessNodeTemplate);
  // for the default category, "", use the same template that Diagrams use by default
  // this just shows the key value as a simple TextBlock
 
  var groupTemplateMap = new go.Map("string", go.Group);
  groupTemplateMap.add("subprocess", subProcessGroupTemplate);
  groupTemplateMap.add("Lane", swimLanesGroupTemplate);
  groupTemplateMap.add("Pool", poolGroupTemplate);
 
  // create the nodeTemplateMap, holding special palette "mini" node templates:
  var palNodeTemplateMap = new go.Map("string", go.Node);
  palNodeTemplateMap.add("activity", activityNodeTemplateForPalette);
  palNodeTemplateMap.add("event", eventNodeTemplate);
  palNodeTemplateMap.add("gateway", gatewayNodeTemplateForPalette);
  palNodeTemplateMap.add("annotation", annotationNodeTemplate);
  palNodeTemplateMap.add("dataobject", dataObjectNodeTemplate);
  palNodeTemplateMap.add("datastore", dataStoreNodeTemplate);
  palNodeTemplateMap.add("privateProcess", privateProcessNodeTemplateForPalette);
 
  var palGroupTemplateMap = new go.Map("string", go.Group);
  palGroupTemplateMap.add("subprocess", subProcessGroupTemplateForPalette);
  palGroupTemplateMap.add("Pool", poolTemplateForPalette);
  palGroupTemplateMap.add("Lane", swimLanesGroupTemplateForPalette);
 
 
  //------------------------------------------  Link Templates   ----------------------------------------------
 
  var sequenceLinkTemplate =
    $(go.Link,
      { contextMenu:
          $(go.Adornment, "Vertical",
            $("ContextMenuButton",
              $(go.TextBlock, "Default Flow"),
              // in the click event handler, the obj.part is the Adornment; its adornedObject is the port
              { click: function(e, obj) { setSequenceLinkDefaultFlow(obj.part.adornedObject); } }),
            $("ContextMenuButton",
              $(go.TextBlock, "Conditional Flow"),
              // in the click event handler, the obj.part is the Adornment; its adornedObject is the port
              { click: function(e, obj) { setSequenceLinkConditionalFlow(obj.part.adornedObject); } })
           ),
           routing: go.Link.AvoidsNodes, curve: go.Link.JumpGap, corner: 10,
           //fromSpot: go.Spot.RightSide, toSpot: go.Spot.LeftSide,
           reshapable: true, relinkableFrom: true, relinkableTo: true, toEndSegmentLength: 20
      },
      new go.Binding("points").makeTwoWay(),
      $(go.Shape, { stroke: "black", strokeWidth: 1 }),
      $(go.Shape, { toArrow: "Triangle", scale: 1.2, fill: "black", stroke: null }),
      $(go.Shape, { fromArrow: "", scale: 1.5, stroke: "black", fill: "white" },
                  new go.Binding("fromArrow", "isDefault", function(s) {
                    if (s === null) return "";
                    return s ? "BackSlash" : "StretchedDiamond"; }),
                  new go.Binding("segmentOffset", "isDefault", function(s) {
                    return s ? new go.Point(5, 0) : new go.Point(0, 0);
                  })),
      $(go.TextBlock, { // this is a Link label
        name: "Label", editable: true, text: "label", segmentOffset: new go.Point(-10, -10), visible: false
        },
        new go.Binding("text", "text").makeTwoWay(),
        new go.Binding("visible", "visible").makeTwoWay())
   );
 
  // set Default Sequence Flow (backslash From Arrow)
  function setSequenceLinkDefaultFlow(obj) {
    myDiagram.startTransaction("setSequenceLinkDefaultFlow");
    var model = myDiagram.model;
    model.setDataProperty(obj.data, "isDefault", true);
    // Set all other links from the fromNode to be isDefault=null
    obj.fromNode.findLinksOutOf().each(function(link) {
      if (link !== obj && link.data.isDefault) {
        model.setDataProperty(link.data, "isDefault", null);
      }
    });
    myDiagram.commitTransaction("setSequenceLinkDefaultFlow");
  }
 
  // set Conditional Sequence Flow (diamond From Arrow)
  function setSequenceLinkConditionalFlow(obj) {
    myDiagram.startTransaction("setSequenceLinkConditionalFlow");
    var model = myDiagram.model;
    model.setDataProperty(obj.data, "isDefault", false);
    myDiagram.commitTransaction("setSequenceLinkConditionalFlow");
  }
 
  var messageFlowLinkTemplate =
     $(PoolLink, // defined in BPMNClasses.js
       { routing: go.Link.Orthogonal, curve: go.Link.JumpGap, corner: 10,
         fromSpot: go.Spot.TopBottomSides , toSpot: go.Spot.TopBottomSides,
         reshapable: true, relinkableTo: true, toEndSegmentLength: 20 },
       new go.Binding("points").makeTwoWay(),
       $(go.Shape, { stroke: "black", strokeWidth: 1, strokeDashArray: [6, 2] }),
       $(go.Shape, { toArrow: "Triangle", scale: 1, fill: "white", stroke: "black" }),
       $(go.Shape, { fromArrow: "Circle", scale: 1, visible: true, stroke: "black", fill: "white" }),
       $(go.TextBlock, {
         editable: true, text: "label"
       }, // Link label
       new go.Binding("text", "text").makeTwoWay())
    );
 
  var dataAssociationLinkTemplate =
    $(go.Link,
      { routing: go.Link.AvoidsNodes, curve: go.Link.JumpGap, corner: 10,
        fromSpot: go.Spot.AllSides , toSpot: go.Spot.AllSides,
        reshapable: true, relinkableFrom: true, relinkableTo: true },
      new go.Binding("points").makeTwoWay(),
      $(go.Shape, { stroke: "black", strokeWidth: 1, strokeDashArray: [1, 3] }),
      $(go.Shape, { toArrow: "OpenTriangle", scale: 1, fill: null, stroke: "blue" })
   );
 
  var annotationAssociationLinkTemplate =
    $(go.Link,
      { reshapable: true, relinkableFrom: true, relinkableTo: true,
        toSpot: go.Spot.AllSides,
        toEndSegmentLength: 20, fromEndSegmentLength: 40 },
      new go.Binding("points").makeTwoWay(),
      $(go.Shape, { stroke: "black", strokeWidth: 1, strokeDashArray: [1, 3] }),
      $(go.Shape, { toArrow: "OpenTriangle", scale: 1, stroke: "black" })
   );
 
  var linkTemplateMap = new go.Map("string", go.Link);
  linkTemplateMap.add("msg", messageFlowLinkTemplate);
  linkTemplateMap.add("annotation", annotationAssociationLinkTemplate);
  linkTemplateMap.add("data", dataAssociationLinkTemplate);
  linkTemplateMap.add("", sequenceLinkTemplate);  // default
 
 
  //------------------------------------------the main Diagram----------------------------------------------
 
  window.myDiagram =
    $(go.Diagram, "myDiagramDiv",
      {
        nodeTemplateMap: nodeTemplateMap,
        linkTemplateMap: linkTemplateMap,
        groupTemplateMap: groupTemplateMap,
 
        allowDrop: true,  // accept drops from palette
 
        commandHandler: new DrawCommandHandler(),  // defined in DrawCommandHandler.js
        // default to having arrow keys move selected nodes
        "commandHandler.arrowKeyBehavior": "move",
 
        mouseDrop: function(e) {
          // when the selection is dropped in the diagram's background,
          // make sure the selected Parts no longer belong to any Group
          var ok = myDiagram.commandHandler.addTopLevelParts(myDiagram.selection, true);
          if (!ok) myDiagram.currentTool.doCancel();
        },
        linkingTool: new BPMNLinkingTool(), // defined in BPMNClasses.js
        "SelectionMoved": relayoutDiagram,  // defined below
        "SelectionCopied": relayoutDiagram
      });
 
  myDiagram.toolManager.mouseDownTools.insertAt(0, new LaneResizingTool());
 
  myDiagram.addDiagramListener("LinkDrawn", function(e) {
    if (e.subject.fromNode.category === "annotation") {
      e.subject.category = "annotation"; // annotation association
    } else if (e.subject.fromNode.category === "dataobject" || e.subject.toNode.category === "dataobject") {
      e.subject.category = "data"; // data association
    } else if (e.subject.fromNode.category === "datastore" || e.subject.toNode.category === "datastore") {
      e.subject.category = "data"; // data association
    }
  });
 
//  uncomment this if you want a subprocess to expand on drop.  We decided we didn't like this behavior
//  myDiagram.addDiagramListener("ExternalObjectsDropped", function(e) {
//    // e.subject is the collection that was just dropped
//    e.subject.each(function(part) {
//        if (part instanceof go.Node && part.data.item === "end") {
//          part.move(new go.Point(part.location.x  + 350, part.location.y))
//        }
//      });
//    myDiagram.commandHandler.expandSubGraph();
//  });
 
  // change the title to indicate that the diagram has been modified
  myDiagram.addDiagramListener("Modified", function(e) {
    var currentFile = document.getElementById("currentFile");
    var idx = currentFile.textContent.indexOf("*");
    if (myDiagram.isModified) {
      if (idx < 0) currentFile.textContent = currentFile.textContent + "*";
    } else {
      if (idx >= 0) currentFile.textContent = currentFile.textContent.substr(0, idx);
    }
  });
 
 
  //------------------------------------------  Palette   ----------------------------------------------
 
    // Make sure the pipes are ordered by their key in the palette inventory
    function keyCompare(a, b) {
      var at = a.data.key;
      var bt = b.data.key;
      if (at < bt) return -1;
      if (at > bt) return 1;
      return 0;
    }
 
    // initialize the first Palette, BPMN Spec Level 1
    var myPaletteLevel1 =
      $(go.Palette, "myPaletteLevel1",
        { // share the templates with the main Diagram
        nodeTemplateMap: palNodeTemplateMap,
          groupTemplateMap: palGroupTemplateMap,
          layout: $(go.GridLayout,
                    {cellSize: new go.Size(1, 1),
                     spacing: new go.Size(5, 5),
                     comparer: keyCompare
                    })
        });
 
    // initialize the second Palette, BPMN Spec Level 2
    var myPaletteLevel2 =
      $(go.Palette, "myPaletteLevel2",
        { // share the templates with the main Diagram
        nodeTemplateMap: palNodeTemplateMap,
          groupTemplateMap: palGroupTemplateMap,
          layout: $(go.GridLayout,
                    {cellSize: new go.Size(1, 1),
                     spacing: new go.Size(5, 5),
                     comparer: keyCompare
                    })
        });
 
    // initialize the third Palette, random other stuff
    var myPaletteLevel3 =
      $(go.Palette, "myPaletteLevel3",
        { // share the templates with the main Diagram
        nodeTemplateMap: palNodeTemplateMap,
          groupTemplateMap: palGroupTemplateMap,
          layout: $(go.GridLayout,
                    {cellSize: new go.Size(1, 1),
                     spacing: new go.Size(5, 5),
                     comparer: keyCompare
                    })
        });
 
   jQuery("#accordion").accordion({
      activate: function(event, ui) {
        myPaletteLevel1.requestUpdate();
        myPaletteLevel2.requestUpdate();
      }
    });
 
  myPaletteLevel1.model = $(go.GraphLinksModel,
    {
      copiesArrays: true,
      copiesArrayObjects: true,
      nodeDataArray: [
      // -------------------------- Event Nodes
        { key: 101, category: "event", text: "Start",   eventType: 1, eventDimension: 1, item: "start"},
        { key: 102, category: "event", text: "Message", eventType: 2, eventDimension: 2, item: "Message"}, // BpmnTaskMessage
        { key: 103, category: "event", text: "Timer",   eventType: 3, eventDimension: 3, item: "Timer"},
        { key: 104, category: "event", text: "End",     eventType: 1, eventDimension: 8, item: "End"},
        { key: 107, category: "event", text: "Message", eventType: 2, eventDimension: 8, item: "Message"},// BpmnTaskMessage
        { key: 108, category: "event", text: "Terminate", eventType: 13, eventDimension: 8, item: "Terminate"},
      // -------------------------- Task/Activity Nodes
        { key: 131, category: "activity", text: "Task", item: "generic task", taskType: 0},
        { key: 132, category: "activity", text: "User Task", item: "User task", taskType: 2},
        { key: 133, category: "activity", text: "Service\nTask", item: "service task", taskType: 6},
      // subprocess and start and end
        { key: 134, category: "subprocess", loc: "0 0", text: "Subprocess", isGroup: true, isSubProcess: true, taskType: 0 },
          { key: -802, category: "event", loc: "0 0", group: 134,  text: "Start", eventType: 1, eventDimension: 1, item: "start" },
          { key: -803, category: "event", loc: "350 0", group: 134,  text: "End", eventType: 1, eventDimension: 8, item: "end", name: "end" },
      // -------------------------- Gateway Nodes, Data, Pool and Annotation
        { key: 201, category: "gateway", text: "Parallel", gatewayType: 1},
        { key: 204, category: "gateway", text: "Exclusive", gatewayType: 4},
        { key: 301, category: "dataobject", text: "Data\nObject"},
        { key: 302, category: "datastore", text: "Data\nStorage"},
        { key: 401, category: "privateProcess", text: "Black Box"},
        { key: "501", "text": "Pool 1", "isGroup": "true", "category": "Pool" },
          { key: "Lane5", "text": "Lane 1", "isGroup": "true", "group": "501", "color": "lightyellow", "category": "Lane" },
          { key: "Lane6", "text": "Lane 2", "isGroup": "true", "group": "501", "color": "lightgreen", "category": "Lane" },
        { key: 701, category: "annotation", text: "note"}
      ]  // end nodeDataArray
    });  // end model
 
    // an activity with a boundary event:
//        {
//          key: 1,
//          category: "activity",
//          text: "Message",
//          taskType: 1,
//          item: "Message Task",
//          boundaryEventArray: [{ "portId": "be0", alignmentIndex: 0, eventType: 2, color: "white" }]   // portId # and alignmentIndex should match
//        },
 
  myPaletteLevel2.model = $(go.GraphLinksModel,
    {
      copiesArrays: true,
      copiesArrayObjects: true,
      nodeDataArray: [
    { key: 1, category: "activity", taskType: 1, text: "Receive Task", item: "Receive Task" },
    { key: 2, category: "activity", taskType: 5, text: "Send Task", item: "Send Task" },
    { key: 3, category: "activity", taskType: 7, text: "Business\nRule Task", item: "Business Rule Task" },
    { key: 4, category: "activity", taskType: 2, text: "User Task", item: "User Task", isCall: true},
 
    { key: 101, text: "Adhoc\nSubprocess", isGroup: true, isSubProcess: true, category: "subprocess", isAdHoc: true, taskType: 0, loc: "0 0" },
    { key: -812, group: 101, category: "event", text: "Start", eventType: 1, eventDimension: 1, item: "start", loc: "0 0" },
    { key: -813, group: 101, category: "event", text: "End", eventType: 1, eventDimension: 8, item: "end", name: "end" },
 
    { key: 102, text: "Transactional\nSubprocess", isGroup: true, isSubProcess: true, category: "subprocess", isTransaction: true, taskType: 0, loc: "0 0" },
    { key: -822, group: 102, category: "event", text: "Start", eventType: 1, eventDimension: 1, item: "start", loc: "0 0" },
    { key: -823, group: 102, category: "event", text: "End", eventType: 1, eventDimension: 8, item: "end", name: "end", loc: "350 0" },
 
    { key: 103, text: "Looping\nActivity", isGroup: true, isLoop: true,  isSubProcess: true, category: "subprocess", taskType: 0, loc: "0 0" },
    { key: -831, group: 103, category: "event", text: "Start", eventType: 1, eventDimension: 1, item: "start", loc: "0 0" },
    { key: -832, group: 103, category: "event", text: "End", eventType: 1, eventDimension: 8, item: "end", name: "end", loc: "350 0" },
 
    { key: 104, text: "Multi-Instance\nActivity", isGroup: true, isSubProcess: true, isParallel: true, category: "subprocess", taskType: 0, loc: "0 0" },
    { key: -841, group: 104, category: "event", text: "Start", eventType: 1, eventDimension: 1, item: "start", loc: "0 0" },
    { key: -842, group: 104, category: "event", text: "End", eventType: 1, eventDimension: 8, item: "end", name: "end", loc: "350 0" },
 
    { key: 105, text: "Call\nSubprocess", isGroup: true, isSubProcess: true, category: "subprocess", isCall: true, taskType: 0, loc: "0 0" },
    { key: -861, group: 105, category: "event", text: "Start", eventType: 1, eventDimension: 1, item: "start", loc: "0 0" },
    { key: -862, group: 105, category: "event", text: "End", eventType: 1, eventDimension: 8, item: "end", name: "end", loc: "350 0" },
 
     // gateway nodes
    { key: 301, category: "gateway", gatewayType: 2, text: "Inclusive" },
    { key: 302, category: "gateway", gatewayType: 5, text: "Event\nGateway" },
 
    // events
    { key: 401, category: "event", eventType: 5, eventDimension: 1, text: "Conditional\nStart", item: "BpmnEventConditional" },
    { key: 402, category: "event", eventType: 10, eventDimension: 1, text: "Signal\nStart", item: "BpmnEventSignal" },  // start signal
    { key: 403, category: "event", eventType: 10, eventDimension: 8, text: "Signal\nEnd", item: "end signal" },
    { key: 404, category: "event", eventType: 7, eventDimension: 8, text: "Error", item: "BpmnEventError" },
    { key: 405, category: "event", eventType: 4, eventDimension: 8, text: "Escalation", item: "BpmnEventEscalation" },
     // throwing / catching intermedicate events
        { key: 502, category: "event", eventType: 6, eventDimension: 4, text: "Catch\nLink", item: "BpmnEventOffPage" },
        { key: 503, category: "event", eventType: 6, eventDimension: 7, text: "Throw\nLink", item: "BpmnEventOffPage" },
        { key: 504, category: "event", eventType: 2, eventDimension: 4, text: "Catch\nMessage", item: "Message"},
        { key: 505, category: "event", eventType: 2, eventDimension: 7, text: "Throw\nMessage", item: "Message"},
        { key: 506, category: "event", eventType: 5, eventDimension: 4, text: "Catch\nConditional", item: ""},
        { key: 507, category: "event", eventType: 3, eventDimension: 4, text: "Catch\nTimer", item: ""},
        { key: 508, category: "event", eventType: 4, eventDimension: 7, text: "Throw\nEscalation", item: "Escalation"},
        { key: 509, category: "event", eventType: 10, eventDimension: 4, text: "Catch\nSignal", item: "" },
        { key: 510, category: "event", eventType: 10, eventDimension: 7, text: "Throw\nSignal", item: "" }
      ]  // end nodeDataArray
    });  // end model
 
  myPaletteLevel3.model = $(go.GraphLinksModel,
    {
      copiesArrays: true,
      copiesArrayObjects: true,
      nodeDataArray: [
    { key: 108, category: "event", eventType: 8, eventDimension: 5, text: "Cancel", item: "BpmnEventCancel" },
    { key: 109, category: "event", eventType: 9, eventDimension: 5, text: "Compensation", item: "BpmnEventCompensation"},
 
    { key: 111, category: "event", eventType: 11, eventDimension: 1, text: "Multiple", item: "Multiple" },
    { key: 112, category: "event", eventType: 12, eventDimension: 1, text: "Parallel", item: "Parallel" },
    // activity nodes
    { key: 203, category: "activity", taskType: 3, isAdHoc: true, text: "Manual", item: "Manual Task" },
    { key: 204, category: "activity", taskType: 4, isSequential: true, text: "Script", item: "Script Task" },
    { key: 205, category: "activity", taskType: 5, isParallel: true, text: "Send Msg", item: "Send Msg Task" },
    { key: 206, category: "activity", taskType: 6, isLoop: true, isSubProcess: true, isTransaction: true, text: "Service", item: "service task" },
 
    // gateway nodes not in Level 1 or Level 2
        { key: 603, category: "gateway", text: "Complex", gatewayType: 3 },
        { key: 606, category: "gateway", text: "Exclusive Start", gatewayType: 6 },
        { key: 607, category: "gateway", text: "Parallel Start", gatewayType: 7 },
 
     { key: 4, category: "activity", taskType: 2, text: "User Task", item: "User Task",
          isCall: true, isLoop: true, isParallel: true, isSequential: true }
      ]  // end nodeDataArray
    });  // end model
 
  //------------------------------------------  Overview   ----------------------------------------------
 
  var myOverview =
    $(go.Overview, "myOverviewDiv",
      { observed: myDiagram, maxScale: 0.5, contentAlignment: go.Spot.Center });
  // change color of viewport border in Overview
  myOverview.box.elt(0).stroke = "dodgerblue";
 
  // start with a simple preset model:
  loadJSON("BPMNdata/OMG BPMN by Example Figure 5.1.json")
 
} // end init
 
 
//------------------------------------------  pools / lanes   ----------------------------------------------
 
// swimlanes
var MINLENGTH = 400;  // this controls the minimum length of any swimlane
var MINBREADTH = 20;  // this controls the minimum breadth of any non-collapsed swimlane
 
// some shared functions
 
// this is called after nodes have been moved or lanes resized, to layout all of the Pool Groups again
function relayoutDiagram() {
  myDiagram.layout.invalidateLayout();
  myDiagram.findTopLevelGroups().each(function(g) { if (g.category === "Pool") g.layout.invalidateLayout(); });
  myDiagram.layoutDiagram();
}
 
// compute the minimum size of a Pool Group needed to hold all of the Lane Groups
function computeMinPoolSize(pool) {
  // assert(pool instanceof go.Group && pool.category === "Pool");
  var len = MINLENGTH;
  pool.memberParts.each(function(lane) {
    // pools ought to only contain lanes, not plain Nodes
    if (!(lane instanceof go.Group)) return;
    var holder = lane.placeholder;
    if (holder !== null) {
      var sz = holder.actualBounds;
      len = Math.max(len, sz.width);
    }
  });
  return new go.Size(len, NaN);
}
 
// compute the minimum size for a particular Lane Group
function computeLaneSize(lane) {
  // assert(lane instanceof go.Group && lane.category !== "Pool");
  var sz = computeMinLaneSize(lane);
  if (lane.isSubGraphExpanded) {
    var holder = lane.placeholder;
    if (holder !== null) {
      var hsz = holder.actualBounds;
      sz.height = Math.max(sz.height, hsz.height);
    }
  }
  // minimum breadth needs to be big enough to hold the header
  var hdr = lane.findObject("HEADER");
  if (hdr !== null) sz.height = Math.max(sz.height, hdr.actualBounds.height);
  return sz;
}
 
// determine the minimum size of a Lane Group, even if collapsed
function computeMinLaneSize(lane) {
  if (!lane.isSubGraphExpanded) return new go.Size(MINLENGTH, 1);
  return new go.Size(MINLENGTH, MINBREADTH);
}
 
 
// define a custom ResizingTool to limit how far one can shrink a lane Group
function LaneResizingTool() {
  go.ResizingTool.call(this);
}
go.Diagram.inherit(LaneResizingTool, go.ResizingTool);
 
LaneResizingTool.prototype.isLengthening = function() {
  return (this.handle.alignment === go.Spot.Right);
};
 
/** @override */
LaneResizingTool.prototype.computeMinSize = function() {
  var lane = this.adornedObject.part;
  // assert(lane instanceof go.Group && lane.category !== "Pool");
  var msz = computeMinLaneSize(lane);  // get the absolute minimum size
  if (this.isLengthening()) {  // compute the minimum length of all lanes
    var sz = computeMinPoolSize(lane.containingGroup);
    msz.width = Math.max(msz.width, sz.width);
  } else {  // find the minimum size of this single lane
    var sz = computeLaneSize(lane);
    msz.width = Math.max(msz.width, sz.width);
    msz.height = Math.max(msz.height, sz.height);
  }
  return msz;
};
 
/** @override */
LaneResizingTool.prototype.canStart = function() {
  if (!go.ResizingTool.prototype.canStart.call(this)) return false;
 
  // if this is a resize handle for a "Lane", we can start.
  var diagram = this.diagram;
  if (diagram === null) return;
  var handl = this.findToolHandleAt(diagram.firstInput.documentPoint, this.name);
  if (handl === null || handl.part === null || handl.part.adornedObject === null || handl.part.adornedObject.part === null) return false;
  return (handl.part.adornedObject.part.category === "Lane");
}
 
/** @override */
LaneResizingTool.prototype.resize = function(newr) {
  var lane = this.adornedObject.part;
  if (this.isLengthening()) {  // changing the length of all of the lanes
    lane.containingGroup.memberParts.each(function(lane) {
      if (!(lane instanceof go.Group)) return;
      var shape = lane.resizeObject;
      if (shape !== null) {  // set its desiredSize length, but leave each breadth alone
        shape.width = newr.width;
      }
    });
  } else {  // changing the breadth of a single lane
    go.ResizingTool.prototype.resize.call(this, newr);
  }
  relayoutDiagram();  // now that the lane has changed size, layout the pool again
};
// end LaneResizingTool class
 
 
// define a custom grid layout that makes sure the length of each lane is the same
// and that each lane is broad enough to hold its subgraph
function PoolLayout() {
  go.GridLayout.call(this);
  this.cellSize = new go.Size(1, 1);
  this.wrappingColumn = 1;
  this.wrappingWidth = Infinity;
  this.isRealtime = false;  // don't continuously layout while dragging
  this.alignment = go.GridLayout.Position;
  // This sorts based on the location of each Group.
  // This is useful when Groups can be moved up and down in order to change their order.
  this.comparer = function(a, b) {
    var ay = a.location.y;
    var by = b.location.y;
    if (isNaN(ay) || isNaN(by)) return 0;
    if (ay < by) return -1;
    if (ay > by) return 1;
    return 0;
  };
}
go.Diagram.inherit(PoolLayout, go.GridLayout);
 
/** @override */
PoolLayout.prototype.doLayout = function(coll) {
  var diagram = this.diagram;
  if (diagram === null) return;
  diagram.startTransaction("PoolLayout");
  var pool = this.group;
  if (pool !== null && pool.category === "Pool") {
    // make sure all of the Group Shapes are big enough
    var minsize = computeMinPoolSize(pool);
    pool.memberParts.each(function(lane) {
      if (!(lane instanceof go.Group)) return;
      if (lane.category !== "Pool") {
        var shape = lane.resizeObject;
        if (shape !== null) {  // change the desiredSize to be big enough in both directions
          var sz = computeLaneSize(lane);
          shape.width = (isNaN(shape.width) ? minsize.width : Math.max(shape.width, minsize.width));
          shape.height = (!isNaN(shape.height)) ? Math.max(shape.height, sz.height) : sz.height;
          var cell = lane.resizeCellSize;
          if (!isNaN(shape.width) && !isNaN(cell.width) && cell.width > 0) shape.width = Math.ceil(shape.width / cell.width) * cell.width;
          if (!isNaN(shape.height) && !isNaN(cell.height) && cell.height > 0) shape.height = Math.ceil(shape.height / cell.height) * cell.height;
        }
      }
    });
  }
  // now do all of the usual stuff, according to whatever properties have been set on this GridLayout
  go.GridLayout.prototype.doLayout.call(this, coll);
  diagram.commitTransaction("PoolLayout");
};
// end PoolLayout class
 
 
//------------------------------------------  Commands for this application  ----------------------------------------------
 
// Add a port to the specified side of the selected nodes.   name is beN  (be0, be1)
// evDim is 5 for Interrupting, 6 for non-Interrupting
function addActivityNodeBoundaryEvent(evType, evDim) {
  myDiagram.startTransaction("addBoundaryEvent");
  myDiagram.selection.each(function(node) {
    // skip any selected Links
    if (!(node instanceof go.Node)) return;
    if (node.data && (node.data.category === "activity" || node.data.category === "subprocess")) {
      // compute the next available index number for the side
      var i = 0;
      var defaultPort = node.findPort("");
      while (node.findPort("be" + i.toString()) !== defaultPort) i++;           // now this new port name is unique within the whole Node because of the side prefix
      var name = "be" + i.toString();
      if (!node.data.boundaryEventArray) {myDiagram.model.setDataProperty(node.data, "boundaryEventArray", []);}       // initialize the Array of port data if necessary
      // create a new port data object
      var newportdata = {
          portId: name,
          eventType: evType,
          eventDimension: evDim,
          color: "white",
          alignmentIndex: i
          // if you add port data properties here, you should copy them in copyPortData above  ** BUG...  we don't do that.
        };
        // and add it to the Array of port data
      myDiagram.model.insertArrayItem(node.data.boundaryEventArray, -1, newportdata);
    }
  });
  myDiagram.commitTransaction("addBoundaryEvent");
}
 
// changes the item of the object
function rename(obj) {
  myDiagram.startTransaction("rename");
  var newName = prompt("Rename " + obj.part.data.item + " to:");
  myDiagram.model.setDataProperty(obj.part.data, "item", newName);
  myDiagram.commitTransaction("rename");
}
 
// shows/hides gridlines
// to be implemented onclick of a button
function updateGridOption() {
  myDiagram.startTransaction("grid");
  var grid = document.getElementById("grid");
  myDiagram.grid.visible = grid.checked;
  myDiagram.commitTransaction("grid");
}
 
// enables/disables snapping tools, to be implemented by buttons
function updateSnapOption() {
  // no transaction needed, because we are modifying tools for future use
  var snap = document.getElementById("snap");
  if (snap.checked) {
    myDiagram.toolManager.draggingTool.isGridSnapEnabled = true;
    myDiagram.toolManager.resizingTool.isGridSnapEnabled = true;
  } else {
    myDiagram.toolManager.draggingTool.isGridSnapEnabled = false;
    myDiagram.toolManager.resizingTool.isGridSnapEnabled = false;
  }
}
 
// user specifies the amount of space between nodes when making rows and column
function askSpace() {
  var space = prompt("Desired space between nodes (in pixels):", "0");
  return space;
}
 
var UnsavedFileName = "(Unsaved File)";
 
function getCurrentFileName() {
  var currentFile = document.getElementById("currentFile");
  var name = currentFile.textContent;
  if (name[name.length - 1] === "*") return name.substr(0, name.length - 1);
  return name;
}
 
function setCurrentFileName(name) {
  var currentFile = document.getElementById("currentFile");
  if (myDiagram.isModified) {
    name += "*";
  }
  currentFile.textContent = name;
}
 
function newDocument() {
  // checks to see if all changes have been saved
  if (myDiagram.isModified) {
    var save = confirm("Would you like to save changes to " + getCurrentFileName() + "?");
    if (save) {
      saveDocument();
    }
  }
  setCurrentFileName(UnsavedFileName);
  // loads an empty diagram
  myDiagram.model = new go.GraphLinksModel();
  resetModel();
}
 
function resetModel() {
  myDiagram.model.undoManager.isEnabled = true;
  myDiagram.model.linkFromPortIdProperty = "fromPort";
  myDiagram.model.linkToPortIdProperty = "toPort";
 
  myDiagram.model.copiesArrays = true;
  myDiagram.model.copiesArrayObjects = true;
  myDiagram.isModified = false;
}
 
function checkLocalStorage() {
  return (typeof (Storage) !== "undefined") && (window.localStorage !== undefined);
}
 
// saves the current floor plan to local storage
function saveDocument() {
  if (checkLocalStorage()) {
    var saveName = getCurrentFileName();
    if (saveName === UnsavedFileName) {
      saveDocumentAs();
    } else {
      saveDiagramProperties()
      window.localStorage.setItem(saveName, myDiagram.model.toJson());
      myDiagram.isModified = false;
    }
  }
}
 
// saves floor plan to local storage with a new name
function saveDocumentAs() {
  if (checkLocalStorage()) {
    var saveName = prompt("Save file as...", getCurrentFileName());
    if (saveName && saveName !== UnsavedFileName) {
      setCurrentFileName(saveName);
      saveDiagramProperties()
      window.localStorage.setItem(saveName, myDiagram.model.toJson());
      myDiagram.isModified = false;
    }
  }
}
 
// checks to see if all changes have been saved -> shows the open HTML element
function openDocument() {
  if (checkLocalStorage()) {
    if (myDiagram.isModified) {
      var save = confirm("Would you like to save changes to " + getCurrentFileName() + "?");
      if (save) {
        saveDocument();
      }
    }
    openElement("openDocument", "mySavedFiles");
  }
}
 
// shows the remove HTML element
function removeDocument() {
  if (checkLocalStorage()) {
    openElement("removeDocument", "mySavedFiles2");
  }
}
 
// these functions are called when panel buttons are clicked
 
function loadFile() {
  var listbox = document.getElementById("mySavedFiles");
  // get selected filename
  var fileName = undefined;
  for (var i = 0; i < listbox.options.length; i++) {
    if (listbox.options[i].selected) fileName = listbox.options[i].text; // selected file
  }
  if (fileName !== undefined) {
    // changes the text of "currentFile" to be the same as the floor plan now loaded
    setCurrentFileName(fileName);
    // actually load the model from the JSON format string
    var savedFile = window.localStorage.getItem(fileName);
    myDiagram.model = go.Model.fromJson(savedFile);
    loadDiagramProperties();
    myDiagram.model.undoManager.isEnabled = true;
    myDiagram.isModified = false;
    // eventually loadDiagramProperties will be called to finish
    // restoring shared saved model/diagram properties
  }
  closeElement("openDocument");
}
 
function loadJSON(file) {
    jQuery.getJSON(file, function (jsondata) {
      // set these kinds of Diagram properties after initialization, not now
      myDiagram.addDiagramListener("InitialLayoutCompleted", loadDiagramProperties);  // defined below
      // create the model from the data in the JavaScript object parsed from JSON text
      //myDiagram.model = new go.GraphLinksModel(jsondata["nodes"], jsondata["links"]);
      myDiagram.model = go.Model.fromJson(jsondata);
      loadDiagramProperties();
      myDiagram.model.undoManager.isEnabled = true;
      myDiagram.isModified = false;
    });
  }
 
// Store shared model state in the Model.modelData property
// (will be loaded by loadDiagramProperties)
function saveDiagramProperties() {
  myDiagram.model.modelData.position = go.Point.stringify(myDiagram.position);
}
 
// Called by loadFile and loadJSON.
function loadDiagramProperties(e) {
  // set Diagram.initialPosition, not Diagram.position, to handle initialization side-effects
  var pos = myDiagram.model.modelData.position;
  if (pos) myDiagram.initialPosition = go.Point.parse(pos);
}
 
 
// deletes the selected file from local storage
function removeFile() {
  var listbox = document.getElementById("mySavedFiles2");
  // get selected filename
  var fileName = undefined;
  for (var i = 0; i < listbox.options.length; i++) {
    if (listbox.options[i].selected) fileName = listbox.options[i].text; // selected file
  }
  if (fileName !== undefined) {
    // removes file from local storage
    window.localStorage.removeItem(fileName);
    // the current document remains open, even if its storage was deleted
  }
  closeElement("removeDocument");
}
 
function updateFileList(id) {
  // displays cached floor plan files in the listboxes
  var listbox = document.getElementById(id);
  // remove any old listing of files
  var last;
  while (last = listbox.lastChild) listbox.removeChild(last);
  // now add all saved files to the listbox
  for (var key in window.localStorage) {
    var storedFile = window.localStorage.getItem(key);
    if (!storedFile) continue;
    var option = document.createElement("option");
    option.value = key;
    option.text = key;
    listbox.add(option, null);
  }
}
 
function openElement(id, listid) {
  var panel = document.getElementById(id);
  if (panel.style.visibility === "hidden") {
    updateFileList(listid);
    panel.style.visibility = "visible";
  }
}
 
// hides the open/remove elements when the "cancel" button is pressed
function closeElement(id) {
  var panel = document.getElementById(id);
  if (panel.style.visibility === "visible") {
    panel.style.visibility = "hidden";
  }
}
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/BPMNClasses.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/BPMNClasses.js

Statements: 4% (3 / 75)      Branches: 0% (0 / 60)      Functions: 0% (0 / 9)      Lines: 4.76% (3 / 63)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136                  1     2                                                                                                       1                                                                                                                                              
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// Contains PoolLink and BPMNLinkingTool classes for the BPMN sample
 
// PoolLink, a special Link class for message flows from edges of pools
 
function PoolLink() {
  go.Link.call(this);
}
go.Diagram.inherit(PoolLink, go.Link);
 
/** @override */
PoolLink.prototype.getLinkPoint = function(node, port, spot, from, ortho, othernode, otherport) {
  var r = new go.Rect(port.getDocumentPoint(go.Spot.TopLeft),
                      port.getDocumentPoint(go.Spot.BottomRight));
  var op = go.Link.prototype.getLinkPoint.call(this, othernode, otherport, spot, from, ortho, node, port);
 
  var below = op.y > r.centerY;
  var y = below ? r.bottom : r.top;
  if (node.category === "privateProcess") {
    if (op.x < r.left) return new go.Point(r.left, y);
    if (op.x > r.right) return new go.Point(r.right, y);
    return new go.Point(op.x, y);
  } else { // otherwise get the standard link point by calling the base class method
    return go.Link.prototype.getLinkPoint.call(this, node, port, spot, from, ortho, othernode, otherport);
  }
};
 
// If there are two links from & to same node... and pool is offset in X from node... the link toPoints collide on pool
/** @override */
PoolLink.prototype.computeOtherPoint = function(othernode, otherport) {
  var op = go.Link.prototype.computeOtherPoint(this, othernode, otherport);
  var node = this.toNode;
  if (node === othernode) node = this.fromNode;
  if (othernode.category === "privateProcess") {
    op.x = node.getDocumentPoint(go.Spot.MiddleBottom).x;
  } else {
    if ((node === this.fromNode) ^ (node.actualBounds.centerY < othernode.actualBounds.centerY)) {
      op.x -= 1;
    } else {
      op.x += 1;
    }
  }
  return op;
};
 
/** @override */
PoolLink.prototype.getLinkDirection = function(node, port, linkpoint, spot, from, ortho, othernode, otherport) {
  if (node.category === "privateProcess") {
    var p = port.getDocumentPoint(go.Spot.Center);
    var op = otherport.getDocumentPoint(go.Spot.Center);
    var below = op.y > p.y;
    return below ? 90 : 270;
  } else {
    return go.Link.prototype.getLinkDirection.call(this, node, port, linkpoint, spot, from, ortho, othernode, otherport);
  }
};
 
 
// BPMNLinkingTool, a custom linking tool to switch the class of the link created.
 
function BPMNLinkingTool() {
  go.LinkingTool.call(this);
  // don't allow user to create link starting on the To node
  this.direction = go.LinkingTool.ForwardsOnly;
  this.temporaryLink.routing = go.Link.Orthogonal;
  this.linkValidation = function(fromnode, fromport, tonode, toport) {
      return BPMNLinkingTool.validateSequenceLinkConnection(fromnode, fromport, tonode, toport) ||
             BPMNLinkingTool.validateMessageLinkConnection(fromnode, fromport, tonode, toport);
    };    
}
go.Diagram.inherit(BPMNLinkingTool, go.LinkingTool);
 
/** @override */
BPMNLinkingTool.prototype.insertLink = function(fromnode, fromport, tonode, toport) {
  var lsave = null;
  // maybe temporarily change the link data that is copied to create the new link
  if (BPMNLinkingTool.validateMessageLinkConnection(fromnode, fromport, tonode, toport)) {
    lsave = this.archetypeLinkData;
    this.archetypeLinkData = { category: "msg" };
  }
 
  // create the link in the standard manner by calling the base method
  var newlink = go.LinkingTool.prototype.insertLink.call(this, fromnode, fromport, tonode, toport);
 
  // maybe make the label visible
  if (fromnode.category === "gateway") {
    var label = newlink.findObject("Label");
    if (label !== null) label.visible = true;
  }
 
  // maybe restore the original archetype link data
  if (lsave !== null) this.archetypeLinkData = lsave;
  return newlink;
};
 
// static utility validation routines for linking & relinking as well as insert link logic
 
// in BPMN, can't link sequence flows across subprocess or pool boundaries
BPMNLinkingTool.validateSequenceLinkConnection = function(fromnode, fromport, tonode, toport) {
  if (fromnode.category === null || tonode.category === null) return true;
 
  // if either node is in a subprocess, both nodes must be in same subprocess (not even Message Flows) 
  if ((fromnode.containingGroup !== null && fromnode.containingGroup.category === "subprocess") || 
      (tonode.containingGroup !== null && tonode.containingGroup.category === "subprocess")) {
    if (fromnode.containingGroup !== tonode.containingGroup) return false;
  }
 
  if (fromnode.containingGroup === tonode.containingGroup) return true;  // a valid Sequence Flow
  // also check for children in common pool
  var common = fromnode.findCommonContainingGroup(tonode);
  return common != null;
};
 
// in BPMN, Message Links must cross pool boundaries
BPMNLinkingTool.validateMessageLinkConnection = function(fromnode, fromport, tonode, toport) {
  if (fromnode.category === null || tonode.category === null) return true;
    
  if (fromnode.category === "privateProcess" || tonode.category === "privateProcess") return true;    
 
  // if either node is in a subprocess, both nodes must be in same subprocess (not even Message Flows) 
  if ((fromnode.containingGroup !== null && fromnode.containingGroup.category === "subprocess") || 
      (tonode.containingGroup !== null && tonode.containingGroup.category === "subprocess")) {
    if (fromnode.containingGroup !== tonode.containingGroup) return false;
  }
 
  if (fromnode.containingGroup === tonode.containingGroup) return false;  // an invalid Message Flow
  // also check for children in common pool
  var common = fromnode.findCommonContainingGroup(tonode);
  return common === null;
};
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/BalloonLink.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/BalloonLink.js

Statements: 3.92% (2 / 51)      Branches: 0% (0 / 34)      Functions: 0% (0 / 5)      Lines: 5% (2 / 40)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93                              1         2                                                                                                                                                
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom Link that draws a "balloon" shape around the Link.fromNode
 
/**
* @constructor
* @extends Link
* @class
* This custom Link class customizes its Shape to surround the comment node.
* If the Shape is filled, it will obscure the comment itself unless the Link is behind the comment node.
* Thus the default layer for BalloonLinks is "Background".
*/
function BalloonLink() {
  go.Link.call(this);
  this.layerName = "Background";
  this.base = 10;
}
go.Diagram.inherit(BalloonLink, go.Link);
 
/*
* The width of the base of the triangle at the center point of the Link.fromNode.
* The default value is 10.
* @name BalloonLink#base
* @function.
* @return {number}
*/
Object.defineProperty(BalloonLink.prototype, "base", {
  get: function() { return this._base; },
  set: function(value) { this._base = value; }
});
 
/**
* Produce a Geometry from the Link's route that draws a "balloon" shape around the Link.fromNode
* and has a triangular shape with the base at the fromNode and the top at the toNode.
* @override
* @this {BalloonLink}
*/
BalloonLink.prototype.makeGeometry = function() {
  // assume the fromNode is the comment and the toNode is the commented-upon node
  var bb = this.fromNode.actualBounds;
  var nb = this.toNode.actualBounds;
 
  var numpts = this.pointsCount;
  var p0 = bb.center;
  var pn = this.getPoint(numpts - 1);
  if (bb.intersectsRect(nb)) {
    pn = nb.center;
  }
  var pos = this.routeBounds;
 
  // compute the intersection points for the triangular arrow
  var ang = pn.directionPoint(p0);
  var L = new go.Point(this.base, 0).rotate(ang - 90).add(p0);
  var R = new go.Point(this.base, 0).rotate(ang + 90).add(p0);
  this.getLinkPointFromPoint(this.fromNode, this.fromNode, L, pn, true, L);
  this.getLinkPointFromPoint(this.fromNode, this.fromNode, R, pn, true, R);
 
  // form a triangular arrow from the comment to the commented node
  var fig = new go.PathFigure(pn.x - pos.x, pn.y - pos.y, true);  // filled; start at arrow point at commented node
  fig.add(new go.PathSegment(go.PathSegment.Line, R.x - pos.x, R.y - pos.y));  // a triangle base point on comment's edge
  var side = 0;
  if (L.y >= bb.bottom || R.y >= bb.bottom) side = 2;
  else if (L.x <= bb.x && R.x <= bb.x) side = 1;
  else if (L.x >= bb.right && R.x >= bb.right) side = 3;
  this.pathToCorner(side, bb, fig, pos, L, R);
  this.pathToCorner(side + 1, bb, fig, pos, L, R);
  this.pathToCorner(side + 2, bb, fig, pos, L, R);
  this.pathToCorner(side + 3, bb, fig, pos, L, R);
  fig.add(new go.PathSegment(go.PathSegment.Line, L.x - pos.x, L.y - pos.y).close());  // the other triangle base point on comment's edge
 
  // return a Geometry
  return new go.Geometry().add(fig);
};
 
/**
* @ignore
* Draw a line to a corner, but not if the comment arrow encompasses that corner.
* @this {BalloonLink}
*/
BalloonLink.prototype.pathToCorner = function(side, bb, fig, pos, L, R) {
  switch (side % 4) {
    case 0: if (!(L.y <= bb.y && R.x <= bb.x)) fig.add(new go.PathSegment(go.PathSegment.Line, bb.x - pos.x, bb.y - pos.y)); break;
    case 1: if (!(L.x <= bb.x && R.y >= bb.bottom)) fig.add(new go.PathSegment(go.PathSegment.Line, bb.x - pos.x, bb.bottom - pos.y)); break;
    case 2: if (!(L.y >= bb.bottom && R.x >= bb.right)) fig.add(new go.PathSegment(go.PathSegment.Line, bb.right - pos.x, bb.bottom - pos.y)); break;
    case 3: if (!(L.x >= bb.right && R.y <= bb.y)) fig.add(new go.PathSegment(go.PathSegment.Line, bb.right - pos.x, bb.y - pos.y)); break;
  }
};
// end BalloonLink class
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/Buttons.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/Buttons.js

Statements: 0.75% (1 / 133)      Branches: 0% (0 / 68)      Functions: 0% (0 / 18)      Lines: 0.85% (1 / 117)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388                                            2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// These are the definitions for all of the predefined buttons.
// You do not need to load this file in order to use buttons.
 
// A "Button" is a Panel that has a Shape surrounding some content
// and that has mouseEnter/mouseLeave behavior to highlight the button.
// The content of the button, whether a TextBlock or a Picture or a complicated Panel,
// must be supplied by the caller.
// The caller must also provide a click event handler.
 
// Typical usage:
//    $("Button",
//      $(go.TextBlock, "Click me!"),  // the content is just the text label
//      { click: function(e, obj) { alert("I was clicked"); } }
//    )
 
// Note that a button click event handler is not invoked upon a click if isEnabledObject() returns false.
 
go.GraphObject.defineBuilder("Button", function(args) {
  // default brushes for "Button" shape
  var buttonFillNormal = go.GraphObject.make(go.Brush, "Linear", { 0: "white", 1: "lightgray" });
  var buttonStrokeNormal = "gray";
 
  var buttonFillOver = go.GraphObject.make(go.Brush, "Linear", { 0: "white", 1: "dodgerblue" });
  var buttonStrokeOver = "blue";
 
  var buttonFillDisabled = "darkgray";
 
  // offset identical to that needed to match the original RoundedRectangle figure, to keep the same size
  var offset = 2.761423749153968;
 
  var button = /** @type {Panel} */ (
    go.GraphObject.make(go.Panel, "Auto",
        {
          isActionable: true,  // needed so that the ActionTool intercepts mouse events
          enabledChanged: function(button, enabled) {
            var shape = button.findObject("ButtonBorder");
            if (shape !== null) {
              shape.fill = enabled ? button["_buttonFillNormal"] : button["_buttonFillDisabled"];
            }
          },
          // save these values for the mouseEnter and mouseLeave event handlers
          "_buttonFillNormal": buttonFillNormal,
          "_buttonStrokeNormal": buttonStrokeNormal,
          "_buttonFillOver": buttonFillOver,
          "_buttonStrokeOver": buttonStrokeOver,
          "_buttonFillDisabled": buttonFillDisabled
        },
        go.GraphObject.make(go.Shape,  // the border
          {
            name: "ButtonBorder",
            figure: "Rectangle",
            spot1: new go.Spot(0, 0, offset, offset),
            spot2: new go.Spot(1, 1, -offset, -offset),
            fill: buttonFillNormal,
            stroke: buttonStrokeNormal
          })
        )
  );
 
  // There's no GraphObject inside the button shape -- it must be added as part of the button definition.
  // This way the object could be a TextBlock or a Shape or a Picture or arbitrarily complex Panel.
 
  // mouse-over behavior
  button.mouseEnter = function(e, button, prev) {
    var shape = button.findObject("ButtonBorder");  // the border Shape
    if (shape instanceof go.Shape) {
      var brush = button["_buttonFillOver"];
      button["_buttonFillNormal"] = shape.fill;
      shape.fill = brush;
      brush = button["_buttonStrokeOver"];
      button["_buttonStrokeNormal"] = shape.stroke;
      shape.stroke = brush;
    }
  };
 
  button.mouseLeave = function(e, button, prev) {
    var shape = button.findObject("ButtonBorder");  // the border Shape
    if (shape instanceof go.Shape) {
      shape.fill = button["_buttonFillNormal"];
      shape.stroke = button["_buttonStrokeNormal"];
    }
  };
 
  return button;
});
 
 
// This is a complete Button that you can have in a Node template
// to allow the user to collapse/expand the subtree beginning at that Node.
 
// Typical usage within a Node template:
//    $("TreeExpanderButton")
 
go.GraphObject.defineBuilder("TreeExpanderButton", function(args) {
  var button = /** @type {Panel} */ (
    go.GraphObject.make("Button",
        { // set these values for the isTreeExpanded binding conversion
          "_treeExpandedFigure": "MinusLine",
          "_treeCollapsedFigure": "PlusLine"
        },
        go.GraphObject.make(go.Shape,  // the icon
          {
            name: "ButtonIcon",
            figure: "MinusLine",  // default value for isTreeExpanded is true
            desiredSize: new go.Size(6, 6)
          },
          // bind the Shape.figure to the Node.isTreeExpanded value using this converter:
          new go.Binding("figure", "isTreeExpanded",
                         function(exp, shape) {
                           var but = shape.panel;
                           return exp ? but["_treeExpandedFigure"] : but["_treeCollapsedFigure"];
                         })
              .ofObject()),
        // assume initially not visible because there are no links coming out
        { visible: false },
        // bind the button visibility to whether it's not a leaf node
        new go.Binding("visible", "isTreeLeaf",
                       function(leaf) { return !leaf; })
            .ofObject())
  );
 
  // tree expand/collapse behavior
  button.click = function(e, button) {
    var node = button.part;
    if (node instanceof go.Adornment) node = node.adornedPart;
    if (!(node instanceof go.Node)) return;
    var diagram = node.diagram;
    if (diagram === null) return;
    var cmd = diagram.commandHandler;
    if (node.isTreeExpanded) {
      if (!cmd.canCollapseTree(node)) return;
    } else {
      if (!cmd.canExpandTree(node)) return;
    }
    e.handled = true;
    if (node.isTreeExpanded) {
      cmd.collapseTree(node);
    } else {
      cmd.expandTree(node);
    }
  };
 
  return button;
});
 
 
// This is a complete Button that you can have in a Group template
// to allow the user to collapse/expand the subgraph that the Group holds.
 
// Typical usage within a Group template:
//    $("SubGraphExpanderButton")
 
go.GraphObject.defineBuilder("SubGraphExpanderButton", function(args) {
  var button = /** @type {Panel} */ (
    go.GraphObject.make("Button",
        { // set these values for the isSubGraphExpanded binding conversion
          "_subGraphExpandedFigure": "MinusLine",
          "_subGraphCollapsedFigure": "PlusLine"
        },
        go.GraphObject.make(go.Shape,  // the icon
          {
            name: "ButtonIcon",
            figure: "MinusLine",  // default value for isSubGraphExpanded is true
            desiredSize: new go.Size(6, 6)
          },
          // bind the Shape.figure to the Group.isSubGraphExpanded value using this converter:
          new go.Binding("figure", "isSubGraphExpanded",
                         function(exp, shape) {
                           var but = shape.panel;
                           return exp ? but["_subGraphExpandedFigure"] : but["_subGraphCollapsedFigure"];
                         })
              .ofObject()))
  );
 
  // subgraph expand/collapse behavior
  button.click = function(e, button) {
    var group = button.part;
    if (group instanceof go.Adornment) group = group.adornedPart;
    if (!(group instanceof go.Group)) return;
    var diagram = group.diagram;
    if (diagram === null) return;
    var cmd = diagram.commandHandler;
    if (group.isSubGraphExpanded) {
      if (!cmd.canCollapseSubGraph(group)) return;
    } else {
      if (!cmd.canExpandSubGraph(group)) return;
    }
    e.handled = true;
    if (group.isSubGraphExpanded) {
      cmd.collapseSubGraph(group);
    } else {
      cmd.expandSubGraph(group);
    }
  };
 
  return button;
});
 
 
// This just holds the "ButtonBorder" Shape that acts as the border
// around the button contents, which must be supplied by the caller.
// The button contents are usually a TextBlock or Panel consisting of a Shape and a TextBlock.
 
// Typical usage within an Adornment that is either a GraphObject.contextMenu or a Diagram.contextMenu:
// $("ContextMenuButton",
//   $(go.TextBlock, text),
//   { click: function(e, obj) { alert("Command for " + obj.part.adornedPart); } },
//   new go.Binding("visible", "", function(data) { return ...OK to perform Command...; })
// )
 
go.GraphObject.defineBuilder("ContextMenuButton", function(args) {
  var button = /** @type {Panel} */ (go.GraphObject.make("Button"));
  button.stretch = go.GraphObject.Horizontal;
  var border = button.findObject("ButtonBorder");
  if (border instanceof go.Shape) {
    border.figure = "Rectangle";
    border.spot1 = new go.Spot(0, 0, 2, 3);
    border.spot2 = new go.Spot(1, 1, -2, -2);
  }
  return button;
});
 
 
// This button is used to toggle the visibility of a GraphObject named
// by the second argument to GraphObject.make.  If the second argument is not present
// or if it is not a string, this assumes that the element name is "COLLAPSIBLE".
// You can only control the visibility of one element in a Part at a time,
// although that element might be an arbitrarily complex Panel.
 
// Typical usage:
//   $(go.Panel, . . .,
//     $("PanelExpanderButton", "COLLAPSIBLE"),
//     . . .,
//       $(go.Panel, . . .,
//         { name: "COLLAPSIBLE" },
//         . . . stuff to be hidden or shown as the PanelExpanderButton is clicked . . .
//       ),
//     . . .
//   )
 
go.GraphObject.defineBuilder("PanelExpanderButton", function(args) {
  var eltname = /** @type {string} */ (go.GraphObject.takeBuilderArgument(args, "COLLAPSIBLE"));
 
  var button = /** @type {Panel} */ (
    go.GraphObject.make("Button",
      { // set these values for the visible binding conversion
        "_buttonExpandedFigure": "TriangleUp",
        "_buttonCollapsedFigure": "TriangleDown"
      },
      go.GraphObject.make(go.Shape, "TriangleUp",
                          { name: "ButtonIcon", desiredSize: new go.Size(6, 4) },
                          new go.Binding("figure", "visible",
                                         function(vis) { return vis ? button["_buttonExpandedFigure"] : button["_buttonCollapsedFigure"]; })
                              .ofObject(eltname)))
  );
 
  var border = button.findObject("ButtonBorder");
  if (border instanceof go.Shape) {
    border.stroke = null;
    border.fill = "transparent";
  }
 
  button.click = function(e, button) {
    var diagram = button.diagram;
    if (diagram === null) return;
    if (diagram.isReadOnly) return;
    var elt = button.findTemplateBinder();
    if (elt === null) elt = button.part;
    if (elt !== null) {
      var pan = elt.findObject(eltname);
      if (pan !== null) {
        diagram.startTransaction('Collapse/Expand Panel');
        pan.visible = !pan.visible;
        diagram.commitTransaction('Collapse/Expand Panel');
      }
    }
  }
 
  return button;
});
 
 
// Define a common checkbox button; the first argument is the name of the data property
// to which the state of this checkbox is data bound.  If the first argument is not a string,
// it raises an error.  If no data binding of the checked state is desired,
// pass an empty string as the first argument.
 
// Examples:
// $("CheckBoxButton", "dataPropertyName", ...)
// or:
// $("CheckBoxButton", "", { "_doClick": function(e, obj) { alert("clicked!"); } })
 
go.GraphObject.defineBuilder("CheckBoxButton", function(args) {
  // process the one required string argument for this kind of button
  var propname = /** @type {string} */ (go.GraphObject.takeBuilderArgument(args));
 
  var button = /** @type {Panel} */ (
    go.GraphObject.make("Button",
        {
          "ButtonBorder.fill": "white",
          "ButtonBorder.stroke": "gray",
          width: 14,
          height: 14
        },
        go.GraphObject.make(go.Shape,
            {
              name: "ButtonIcon",
              geometryString: "M0 4 L3 9 9 0",  // a "check" mark
              strokeWidth: 2,
              stretch: go.GraphObject.Fill,  // this Shape expands to fill the Button
              geometryStretch: go.GraphObject.Uniform,  // the check mark fills the Shape without distortion
              visible: false  // visible set to false: not checked, unless data.PROPNAME is true
            },
            // create a data Binding only if PROPNAME is supplied and not the empty string
            (propname !== "" ? new go.Binding("visible", propname).makeTwoWay() : []))
    )
  );
 
  button.click = function(e, button) {
    var diagram = e.diagram;
    if (diagram === null || diagram.isReadOnly) return;
    if (propname !== "" && diagram.model.isReadOnly) return;
    e.handled = true;
    var shape = button.findObject("ButtonIcon");
    diagram.startTransaction("checkbox");
    shape.visible = !shape.visible;  // this toggles data.checked due to TwoWay Binding
    // support extra side-effects without clobbering the click event handler:
    if (typeof button["_doClick"] === "function") button["_doClick"](e, button);
    diagram.commitTransaction("checkbox");
  };
 
  return button;
});
 
 
// This defines a whole check-box -- including both a "CheckBoxButton" and whatever you want as the check box label.
// Note that mouseEnter/mouseLeave/click events apply to everything in the panel, not just in the "CheckBoxButton".
 
// Examples:
// $("CheckBox", "aBooleanDataProperty", $(go.TextBlock, "the checkbox label"))
// or
// $("CheckBox", "someProperty", $(go.TextBlock, "A choice"),
//   { "_doClick": function(e, obj) { ... perform extra side-effects ... } })
 
go.GraphObject.defineBuilder("CheckBox", function(args) {
  // process the one required string argument for this kind of button
  var propname = /** @type {string} */ (go.GraphObject.takeBuilderArgument(args));
 
  var button = /** @type {Panel} */ (
    go.GraphObject.make("CheckBoxButton", propname,  // bound to this data property
        {
          name: "Button",
          margin: new go.Margin(0, 1, 0, 0)
        })
  );
  var box = /** @type {Panel} */ (
    go.GraphObject.make(go.Panel, "Horizontal",
        button,
        {
          isActionable: true,
          margin: 1,
          // transfer CheckBoxButton properties over to this new CheckBox panel
          "_buttonFillNormal": button["_buttonFillNormal"],
          "_buttonStrokeNormal": button["_buttonStrokeNormal"],
          "_buttonFillOver": button["_buttonFillOver"],
          "_buttonStrokeOver": button["_buttonStrokeOver"],
          "_buttonFillDisabled": button["_buttonFillDisabled"],
          mouseEnter: button.mouseEnter,
          mouseLeave: button.mouseLeave,
          click: button.click,
          // also save original Button behavior, for potential use in a Panel.click event handler
          "_buttonClick": button.click
        }
      )
  );
  // avoid potentially conflicting event handlers on the "CheckBoxButton"
  button.mouseEnter = null;
  button.mouseLeave = null;
  button.click = null;
  return box;
});
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/ColumnResizingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/ColumnResizingTool.js

Statements: 1.31% (2 / 153)      Branches: 0% (0 / 70)      Functions: 0% (0 / 19)      Lines: 1.46% (2 / 137)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295                        1                                             2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom Tool for resizing each column of a named Table Panel in a selected Part.
 
/**
* @constructor
* @extends Tool
* @class
*/
function ColumnResizingTool() {
	go.Tool.call(this);
	this.name = "ColumnResizing";
 
	var h = new go.Shape();
  h.geometryString = "M0 0 V14 M2 0 V14";
  h.desiredSize = new go.Size(2, 14);
  h.cursor = "col-resize";
  h.geometryStretch = go.GraphObject.None;
  h.background = "rgba(255,255,255,0.5)";
  h.stroke = "rgba(30,144,255,0.5)";
	/** @type {GraphObject} */
	this._handleArchetype = h;
 
  /** @type {string} */
	this._tableName = "TABLE";
 
  // internal state
  /** @type {GraphObject} */
	this._handle = null;
  /** @type {Panel} */
	this._adornedTable = null;
}
go.Diagram.inherit(ColumnResizingTool, go.Tool);
 
 
/*
* A small GraphObject used as a resize handle for each column.
* This tool expects that this object's {@link GraphObject#desiredSize} (a.k.a width and height) has been set to real numbers.
* @name ColumnResizingTool#handleArchetype 
* @function.
* @return {GraphObject}
*/
Object.defineProperty(ColumnResizingTool.prototype, "handleArchetype", {
  get: function() { return this._handleArchetype; },
  set: function(value) { this._handleArchetype = value; }
});
 
/*
* The name of the Table Panel to be resized, by default the name "TABLE".
* @name ColumnResizingTool#tableName
* @function.
* @return {string}
*/
Object.defineProperty(ColumnResizingTool.prototype, "tableName", {
  get: function() { return this._tableName; },
  set: function(value) { this._tableName = value; }
});
 
/*
* This read-only property returns the {@link GraphObject} that is the tool handle being dragged by the user.
* This will be contained by an {@link Adornment} whose category is "ColumnResizing".
* Its {@link Adornment#adornedObject} is the same as the {@link #adornedTable}.
* @name ColumnResizingTool#handle
* @function.
* @return {GraphObject}
*/
Object.defineProperty(ColumnResizingTool.prototype, "handle", {
  get: function() { return this._handle; }
});
 
/*
* Gets the {@link Panel} of type {@link Panel#Table} whose columns may be resized.
* This must be contained within the selected Part.
* @name ColumnResizingTool#adornedTable
* @function.
* @return {Panel}
*/
Object.defineProperty(ColumnResizingTool.prototype, "adornedTable", {
  get: function() { return this._adornedTable; }
});
 
 
/**
* Show an {@link Adornment} with a resize handle at each column.
* Don't show anything if {@link #tableName} doesn't identify a {@link Panel}
* that has a {@link Panel#type} of type {@link Panel#Table}.
* @this {ColumnResizingTool}
* @param {Part} part the part.
*/
ColumnResizingTool.prototype.updateAdornments = function(part) {
  if (part === null || part instanceof go.Link) return;  // this tool never applies to Links
  if (part.isSelected && !this.diagram.isReadOnly) {
    var selelt = part.findObject(this.tableName);
    if (selelt instanceof go.Panel && selelt.actualBounds.isReal() && selelt.isVisibleObject() &&
        part.actualBounds.isReal() && part.isVisible() &&
        selelt.type === go.Panel.Table) {
      var table = selelt;
      var adornment = part.findAdornment(this.name);
      if (adornment === null) {
        adornment = this.makeAdornment(table);
        part.addAdornment(this.name, adornment);
      }
      if (adornment !== null) {
        var pad = table.padding;
        var numcols = table.columnCount;
        // update the position/alignment of each handle
        adornment.elements.each(function(h) {
          if (!h.pickable) return;
          var coldef = table.getColumnDefinition(h.column);
          var wid = coldef.actual;
          if (wid > 0) wid = coldef.total;
          var sep = 0;
          // find next non-zero-width column's separatorStrokeWidth
          var idx = h.column + 1;
          while (idx < numcols && table.getColumnDefinition(idx).actual === 0) idx++;
          if (idx < numcols) {
            sep = table.getColumnDefinition(idx).separatorStrokeWidth;
            if (isNaN(sep)) sep = table.defaultColumnSeparatorStrokeWidth;
          }
          h.alignment = new go.Spot(0, 0, pad.left + coldef.position + wid + sep/2, pad.top + h.height/2);
        });
        adornment.locationObject.desiredSize = table.actualBounds.size;
        adornment.location = table.getDocumentPoint(adornment.locationSpot);
        adornment.angle = table.getDocumentAngle();
        return;
      }
    }
  }
  part.removeAdornment(this.name);
};
 
/*
* @this {ColumnResizingTool}
* @param {Panel} table the Table Panel whose columns may be resized
* @return {Adornment}
*/
ColumnResizingTool.prototype.makeAdornment = function(table) {
  // the Adornment is a Spot Panel holding resize handles
  var adornment = new go.Adornment();
  adornment.category = this.name;
  adornment.adornedObject = table;
  adornment.type = go.Panel.Spot;
  adornment.locationObjectName = "BLOCK";
  // create the "main" element of the Spot Panel
  var block = new go.TextBlock();  // doesn't matter much what this is
  block.name = "BLOCK";
  block.pickable = false;  // it's transparent and not pickable
  adornment.add(block);
  // now add resize handles for each column
  for (var i = 0; i < table.columnCount; i++) {
    var coldef = table.getColumnDefinition(i);
    adornment.add(this.makeHandle(table, coldef));
  }
  return adornment;
};
 
/*
* @this {ColumnResizingTool}
* @param {Panel} table the Table Panel whose columns may be resized
* @param {RowColumnDefinition} coldef the column definition to be resized
* @return a copy of the {@link #handleArchetype}
*/
ColumnResizingTool.prototype.makeHandle = function(table, coldef) {
  var h = this.handleArchetype;
  if (h === null) return null;
  var c = h.copy();
  c.column = coldef.index;
  return c;
};
 
 
/*
* This predicate is true when there is a resize handle at the mouse down point.
* @this {ColumnResizingTool}
* @return {boolean}
*/
ColumnResizingTool.prototype.canStart = function() {
  if (!this.isEnabled) return false;
 
  var diagram = this.diagram;
  if (diagram === null || diagram.isReadOnly) return false;
  if (!diagram.lastInput.left) return false;
  var h = this.findToolHandleAt(diagram.firstInput.documentPoint, this.name);
  return (h !== null);
};
 
/**
* @this {ColumnResizingTool}
*/
ColumnResizingTool.prototype.doActivate = function() {
  var diagram = this.diagram;
  if (diagram === null) return;
  this._handle = this.findToolHandleAt(diagram.firstInput.documentPoint, this.name);
  if (this.handle === null) return;
  var panel = this.handle.part.adornedObject;
  if (!panel || panel.type !== go.Panel.Table) return;
  this._adornedTable = panel;
  diagram.isMouseCaptured = true;
  this.startTransaction(this.name);
  this.isActive = true;
};
 
/**
* @this {ColumnResizingTool}
*/
ColumnResizingTool.prototype.doDeactivate = function() {
  this.stopTransaction();
  this._handle = null;
  this._adornedTable = null;
  var diagram = this.diagram;
  if (diagram !== null) diagram.isMouseCaptured = false;
  this.isActive = false;
};
 
/**
* @this {ColumnResizingTool}
*/
ColumnResizingTool.prototype.doMouseMove = function() {
  var diagram = this.diagram;
  if (this.isActive && diagram !== null) {
    var newpt = this.computeResize(diagram.lastInput.documentPoint);
    this.resize(newpt);
  }
};
 
/**
* @this {ColumnResizingTool}
*/
ColumnResizingTool.prototype.doMouseUp = function() {
  var diagram = this.diagram;
  if (this.isActive && diagram !== null) {
    var newpt = this.computeResize(diagram.lastInput.documentPoint);
    this.resize(newpt);
    this.transactionResult = this.name;  // success
  }
  this.stopTool();
};
 
/**
* This should change the {@link RowColumnDefinition#width} of the column being resized
* to a value corresponding to the given mouse point.
* @expose
* @this {ColumnResizingTool}
* @param {Point} newPoint the value of the call to {@link #computeResize}.
*/
ColumnResizingTool.prototype.resize = function(newPoint) {
  var table = this.adornedTable;
  var pad = table.padding;
  var numcols = table.columnCount;
  var locpt = table.getLocalPoint(newPoint);
  var h = this.handle;
  var coldef = table.getColumnDefinition(h.column);
  var sep = 0;
  var idx = h.column + 1;
  while (idx < numcols && table.getColumnDefinition(idx).actual === 0) idx++;
  if (idx < numcols) {
    sep = table.getColumnDefinition(idx).separatorStrokeWidth;
    if (isNaN(sep)) sep = table.defaultColumnSeparatorStrokeWidth;
  }
  coldef.width = Math.max(0, locpt.x - pad.left - coldef.position - (coldef.total - coldef.actual) - sep/2);
};
 
 
/**
* This can be overridden in order to customize the resizing process.
* @expose
* @this {ColumnResizingTool}
* @param {Point} p the point where the handle is being dragged.
* @return {Point}
*/
ColumnResizingTool.prototype.computeResize = function(p) {
  return p;
};
 
/**
* Pressing the Delete key removes any column width setting and stops this tool.
* @this {ColumnResizingTool}
*/
ColumnResizingTool.prototype.doKeyDown = function() {
  if (!this.isActive) return;
  var e = this.diagram.lastInput;
  if (e.key === 'Del' || e.key === '\t') {  // remove width setting
    var coldef = this.adornedTable.getColumnDefinition(this.handle.column);
    coldef.width = NaN;
    this.transactionResult = this.name;  // success
    this.stopTool();
  } else {
    go.Tool.prototype.doKeyDown.call(this);
  }
};
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/CurvedLinkReshapingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/CurvedLinkReshapingTool.js

Statements: 4.65% (2 / 43)      Branches: 0% (0 / 19)      Functions: 0% (0 / 5)      Lines: 4.88% (2 / 41)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94                              1         2                                                                                                                                                  
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom LinkReshapingTool that shows only a single reshape handle on a Bezier curved Link.
// Dragging that handle changes the value of {@link Link#curviness}.
 
/**
* @constructor
* @extends LinkReshapingTool
* @class
* This CurvedLinkReshapingTool class allows for a Link's path to be modified by the user
* via the dragging of a single tool handle at the middle of the link. 
*/
function CurvedLinkReshapingTool() {
  go.LinkReshapingTool.call(this);
  /** @type {number} */
  this._originalCurviness = NaN;
}
go.Diagram.inherit(CurvedLinkReshapingTool, go.LinkReshapingTool);
 
/**
* @override
* @this {CurvedLinkReshapingTool}
* @param {Shape} pathshape
* @return {Adornment}
*/
CurvedLinkReshapingTool.prototype.makeAdornment = function(pathshape) {
  var link = pathshape.part;
  if (link !== null && link.curve === go.Link.Bezier && link.pointsCount === 4) {
    var adornment = new go.Adornment();
    adornment.type = go.Panel.Link;
    var h = this.makeHandle();
    this.setReshapingBehavior(h, go.LinkReshapingTool.All);
    h.cursor = 'move';
    adornment.add(h);
    adornment.category = this.name;
    adornment.adornedObject = pathshape;
    return adornment;
  } else {
    return go.LinkReshapingTool.prototype.makeAdornment.call(this, pathshape);
  }
};
 
/**
* @override
* @this {CurvedLinkReshapingTool}
*/
CurvedLinkReshapingTool.prototype.doActivate = function() {
  go.LinkReshapingTool.prototype.doActivate.call(this);
  this._originalCurviness = this.adornedLink.curviness;
};
 
/**
* @override
* @this {CurvedLinkReshapingTool}
*/
CurvedLinkReshapingTool.prototype.doCancel = function() {
  this.adornedLink.curviness = this._originalCurviness;
  go.LinkReshapingTool.prototype.doCancel.call(this);
};
 
/**
* @override
* @this {CurvedLinkReshapingTool}
* @param {Point} newpt
* @return {Point}
*/
CurvedLinkReshapingTool.prototype.reshape = function(newpt) {
  var link = this.adornedLink;
  if (link !== null && link.curve === go.Link.Bezier && link.pointsCount === 4) {
    var start = link.getPoint(0);
    var end = link.getPoint(3);
    var ang = start.directionPoint(end);
    var mid = new go.Point((start.x + end.x) / 2, (start.y + end.y) / 2);
    var a = new go.Point(9999, 0).rotate(ang + 90).add(mid);
    var b = new go.Point(9999, 0).rotate(ang - 90).add(mid);
    var q = newpt.copy().projectOntoLineSegmentPoint(a, b);
    var curviness = Math.sqrt(mid.distanceSquaredPoint(q));
    if (link.fromPort === link.toPort) {
      if (newpt.y < link.fromPort.getDocumentPoint(go.Spot.Center).y) curviness = -curviness;
    } else {
      var diff = mid.directionPoint(q) - ang;
      if ((diff > 0 && diff < 180) || (diff < -180)) curviness = -curviness;
    }
    link.curviness = curviness;
    return q;
  } else {
    go.LinkReshapingTool.prototype.reshape.call(this, newpt);
  }
}
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/DataInspector.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/DataInspector.js

Statements: 7.34% (13 / 177)      Branches: 0% (0 / 105)      Functions: 0% (0 / 15)      Lines: 8.84% (13 / 147)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338                                                                                                    1                                                                   1 1 1     1                   1                                                                                                                             1                                 1                                               1                           1                                                             1                   1                                                                 1                                                                                            
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
/**
  This class implements an inspector for GoJS model data objects.
  The constructor takes three arguments:
    {string} divid a string referencing the HTML ID of the to-be inspector's div.
    {Diagram} diagram a reference to a GoJS Diagram.
    {Object} options An optional JS Object describing options for the inspector.
 
  Options:
    inspectSelection {boolean} Default true, whether to automatically show and populate the Inspector
                               with the currently selected Diagram Part. If set to false, the inspector won't show anything
                               until you call Inspector.inspectObject(object) with a Part or JavaScript object as the argument.
    includesOwnProperties {boolean} Default true, whether to list all properties currently on the inspected data object.
    properties {Object} An object of string:Object pairs representing propertyName:propertyOptions.
                        Can be used to include or exclude additional properties.
    propertyModified function(propertyName, newValue) a callback
 
  Options for properties:
    show: {boolean|function} a boolean value to show or hide the property from the inspector, or a predicate function to show conditionally.
    readOnly: {boolean|function} whether or not the property is read-only
    type: {string} a string describing the data type. Supported values: "string|number|color|boolean" Not yet implemented: "point|rect|size"
    defaultValue: {*} a default value for the property. Defaults to the empty string.
 
  Example usage of Inspector:
 
  var inspector = new Inspector("myInspector", myDiagram,
    {
      includesOwnProperties: false,
      properties: {
        "key": { readOnly: true, show: Inspector.showIfPresent },
        "comments": { show: Inspector.showIfNode  },
        "LinkComments": { show: Inspector.showIfLink },
      }
    });
 
  This is the basic HTML Structure that the Inspector creates within the given DIV element:
 
  <div id="divid" class="inspector">
    <tr>
      <td>propertyName</td>
      <td><input value=propertyValue /></td>
    </tr>
    ...
  </div>
 
*/
function Inspector(divid, diagram, options) {
  var mainDiv = document.getElementById(divid);
  mainDiv.className = "inspector";
  mainDiv.innerHTML = "";
  this._div = mainDiv;
  this._diagram = diagram;
  this._inspectedProperties = {};
 
  // Either a GoJS Part or a simple data object, such as Model.modelData
  this.inspectedObject = null;
 
  // Inspector options defaults:
  this.includesOwnProperties = true;
  this.declaredProperties = {};
  this.inspectsSelection = true;
  this.propertyModified = null;
 
  if (options !== undefined) {
    if (options["includesOwnProperties"] !== undefined) this.includesOwnProperties = options["includesOwnProperties"];
    if (options["properties"] !== undefined) this.declaredProperties = options["properties"];
    if (options["inspectSelection"] !== undefined) this.inspectsSelection = options["inspectSelection"];
    if (options["propertyModified"] !== undefined) this.propertyModified = options["propertyModified"];
  }
 
  var self = this;
  diagram.addModelChangedListener(function(e) {
    if (e.isTransactionFinished) self.inspectObject();
  });
  if (this.inspectsSelection) {
    diagram.addDiagramListener("ChangedSelection", function(e) { self.inspectObject(); });
  }
}
 
// Some static predicates to use with the "show" property.
Inspector.showIfNode = function(part) { return part instanceof go.Node };
Inspector.showIfLink = function(part) { return part instanceof go.Link };
Inspector.showIfGroup = function(part) { return part instanceof go.Group };
 
// Only show the property if its present. Useful for "key" which will be shown on Nodes and Groups, but normally not on Links
Inspector.showIfPresent = function(data, propname) {
  if (data instanceof go.Part) data = data.data;
  return typeof data === "object" && data[propname] !== undefined;
};
 
/**
* Update the HTML state of this Inspector given the properties of the {@link #inspectedObject}.
* @param {Object} object is an optional argument, used when {@link #inspectSelection} is false to
*                        set {@link #inspectedObject} and show and edit that object's properties.
*/
Inspector.prototype.inspectObject = function(object) {
  var inspectedObject = object;
  if (inspectedObject === undefined) {
    if (this.inspectsSelection)
      inspectedObject = this._diagram.selection.first();
    else
      inspectedObject = this.inspectedObject;
  }
 
  if (inspectedObject === null || this.inspectedObject === inspectedObject) {
    this.inspectedObject = inspectedObject;
    this.updateAllHTML();
    return;
  }
 
  this.inspectedObject = inspectedObject;
  var mainDiv = this._div;
  mainDiv.innerHTML = "";
  if (inspectedObject === null) return;
 
  // use either the Part.data or the object itself (for model.modelData)
  var data = (inspectedObject instanceof go.Part) ? inspectedObject.data : inspectedObject;
  if (!data) return;
  // Build table:
  var table = document.createElement("table");
  var tbody = document.createElement("tbody");
  this._inspectedProperties = {};
  this.tabIndex = 0;
  var declaredProperties = this.declaredProperties;
 
  // Go through all the properties passed in to the inspector and show them, if appropriate:
  for (var k in declaredProperties) {
    var val = declaredProperties[k];
    if (!this.canShowProperty(k, val, inspectedObject)) continue;
    var defaultValue = "";
    if (val.defaultValue !== undefined) defaultValue = val.defaultValue;
    if (data[k] !== undefined) defaultValue = data[k];
    tbody.appendChild(this.buildPropertyRow(k, defaultValue || ""));
  }
  // Go through all the properties on the model data and show them, if appropriate:
  if (this.includesOwnProperties) {
    for (var k in data) {
      if (k === "__gohashid") continue; // skip internal GoJS hash property
      if (this._inspectedProperties[k]) continue; // already exists
      if (declaredProperties[k] && !this.canShowProperty(k, declaredProperties[k], inspectedObject)) continue;
      tbody.appendChild(this.buildPropertyRow(k, data[k]));
    }
  }
 
  table.appendChild(tbody);
  mainDiv.appendChild(table);
};
 
/**
* @ignore
* This predicate should be false if the given property should not be shown.
* Normally it only checks the value of "show" on the property descriptor.
* The default value is true.
* @param {string} propertyName the property name
* @param {Object} propertyDesc the property descriptor
* @param {Object} inspectedObject the data object
* @return {boolean} whether a particular property should be shown in this Inspector
*/
Inspector.prototype.canShowProperty = function(propertyName, propertyDesc, inspectedObject) {
  if (propertyDesc.show === false) return false;
  // if "show" is a predicate, make sure it passes or do not show this property
  if (typeof propertyDesc.show === "function") return propertyDesc.show(inspectedObject, propertyName);
  return true;
}
 
/**
* @ignore
* This predicate should be false if the given property should not be editable by the user.
* Normally it only checks the value of "readOnly" on the property descriptor.
* The default value is true.
* @param {string} propertyName the property name
* @param {Object} propertyDesc the property descriptor
* @param {Object} inspectedObject the data object
* @return {boolean} whether a particular property should be shown in this Inspector
*/
Inspector.prototype.canEditProperty = function(propertyName, propertyDesc, inspectedObject) {
  // assume property values that are functions of Objects cannot be edited
  var data = (inspectedObject instanceof go.Part) ? inspectedObject.data : inspectedObject;
  var valtype = typeof data[propertyName];
  if (valtype === "function" || valtype === "object") return false;  //?? handle Objects such as Points
  if (propertyDesc) {
    if (propertyDesc.readOnly === true) return false;
    // if "readOnly" is a predicate, make sure it passes or do not show this property
    if (typeof propertyDesc.readOnly === "function") return !propertyDesc.readOnly(inspectedObject, propertyName);
  }
  return true;
}
 
/**
* @ignore
* This sets this._inspectedProperties[propertyName] and creates the HTML table row:
*    <tr>
*      <td>propertyName</td>
*      <td><input value=propertyValue /></td>
*    </tr>
* @param {string} propertyName the property name
* @param {*} propertyValue the property value
* @return the table row
*/
Inspector.prototype.buildPropertyRow = function(propertyName, propertyValue) {
  var mainDiv = this._div;
  var tr = document.createElement("tr");
 
  var td1 = document.createElement("td");
  td1.textContent = propertyName;
  tr.appendChild(td1);
 
  var td2 = document.createElement("td");
  var input = document.createElement("input");
  var decProp = this.declaredProperties[propertyName];
  input.tabIndex = this.tabIndex++;
 
  var self = this;
  function setprops() { self.updateAllProperties(); }
 
  input.value = propertyValue;
  input.disabled = !this.canEditProperty(propertyName, decProp, this.inspectedObject);
  if (decProp !== undefined && decProp.type === "color") {
    input.setAttribute("type", "color");
    if (input.type === "color") {
      input.addEventListener("input", setprops);
      input.addEventListener("change", setprops);
      input.value = this.setColor(propertyValue);
    }
  }
  if (this._diagram.model.isReadOnly) input.disabled = true;
 
  if (input.type !== "color") input.addEventListener("blur", setprops);
 
  td2.appendChild(input);
  tr.appendChild(td2);
 
  this._inspectedProperties[propertyName] = input;
  return tr;
};
 
/**
* @ignore
* HTML5 color input will only take hex,
* so let HTML5 canvas convert the color into hex format.
* This converts "rgb(255, 0, 0)" into "#FF0000", etc.
* @param {string} propertyValue
* @return {string}
*/
Inspector.prototype.setColor = function(propertyValue) {
  var ctx = document.createElement("canvas").getContext("2d");
  ctx.fillStyle = propertyValue;
  return ctx.fillStyle;
}
 
/**
* @ignore
* Update all of the HTML in this Inspector.
*/
Inspector.prototype.updateAllHTML = function() {
  var inspectedProps = this._inspectedProperties;
  var diagram = this._diagram;
  var isPart = this.inspectedObject instanceof go.Part;
  var data = isPart ? this.inspectedObject.data : this.inspectedObject;
  if (!data) {  // clear out all of the fields
    for (var name in inspectedProps) {
      var input = inspectedProps[name];
      if (input.type === "color") {
        input.value = "#000000";
      } else {
        input.value = "";
      }
 
    }
  } else {
    for (var name in inspectedProps) {
      var input = inspectedProps[name];
      var propertyValue = data[name];
      if (input.type === "color") {
        input.value = this.setColor(propertyValue);
      } else {
        input.value = propertyValue;
      }
    }
  }
}
 
/**
* @ignore
* Update all of the data properties of {@link #inspectedObject} according to the
* current values held in the HTML input elements.
*/
Inspector.prototype.updateAllProperties = function() {
  var inspectedProps = this._inspectedProperties;
  var diagram = this._diagram;
  var isPart = this.inspectedObject instanceof go.Part;
  var data = isPart ? this.inspectedObject.data : this.inspectedObject;
  if (!data) return;  // must not try to update data when there's no data!
 
  diagram.startTransaction("set all properties");
  for (var name in inspectedProps) {
    var value = inspectedProps[name].value;
 
    // don't update "readOnly" data properties
    var decProp = this.declaredProperties[name];
    if (!this.canEditProperty(name, decProp, this.inspectedObject)) continue;
 
    // If it's a boolean, or if its previous value was boolean,
    // parse the value to be a boolean and then update the input.value to match
    var type = "";
    if (decProp !== undefined && decProp.type !== undefined) {
      type = decProp.type;
    }
    if (type === "" && typeof data[name] === "boolean") type = "boolean"; // infer boolean
 
    // convert to specific type, if needed
    switch (type) {
      case "boolean":
        value = !(value == false || value === "false" || value === "0");
        break;
      case "number":
        value = parseFloat(value);
        break;
    }
 
    // in case parsed to be different, such as in the case of boolean values,
    // the value shown should match the actual value
    inspectedProps[name].value = value;
 
    // modify the data object in an undo-able fashion
    diagram.model.setDataProperty(data, name, value);
 
    // notify any listener
    if (this.propertyModified !== null) this.propertyModified(name, value);
  }
  diagram.commitTransaction("set all properties");
};
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/DebugInspector.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/DebugInspector.js

Statements: 5.6% (32 / 571)      Branches: 0% (0 / 242)      Functions: 0% (0 / 43)      Lines: 5.94% (32 / 539)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164                                                        1                                                                                 1                                                                                                                                               2                                             2       2           2                 2       2                                                                                                                                                                 2                       2                                             2                         2               2                 2                                                                                                                                                               2                         1                         2               2       2                   2         2                                                       2                                                                             2                                                                                                                                                                               2                                                                                                                                                                                                               2             2                                                                                                                           2                 2           2                     2                           2                     2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
/*
  DebugInspector code
  Two classes: DebugInspector and View
  An DebugInspector is a collection of Views
 
  Each property corresponds to its own View.
  Each View correspondingly has its own DOM elements.
  Views are also responsible for populating those DOM elements
  and committing information from them, when requested.
  Right now Views have three essential settable functions:
    initialize = Creates DOM. Called once.
    populate = Fills DOM, ie input.value = some value. Called each time the DebugInspector asks.
    use = Returns a value or values from the View's DOM inputs. DebugInspector solicits this when it wants to commit some values.
 
  The inspector adds the DOM elements of all Views to its master div (this.div), plus an accept button (or not).
 
  Finally the inspector has a collection of objects to inspect.
  For now this is only ever a single object.
 
  When the collection changes, the inspector passes on information
  to all of its Views so that they may re-populate their inputs.
*/
 
function DebugInspector(divid, diagram, options) {
  this.inspectedProps = {};
  // assume coll is a single object for now TODO fix this,
  // which means looking at every use of this.collection
  this.collection = null;
  this.tracked = {}; // map of all tracked properties, set in showObjectProperties and used in rebuildViews
  this.diagram = diagram;
 
  this.acceptButton = !!options['acceptButton'];
  this.resetButton = !!options['resetButton'];
  this.acceptFocus = !!options['acceptFocus'];
  this.whenSelected = (options['whenSelected'] === undefined) ? true : !!options['whenSelected'];
  this.inspectPredicate = options['inspectPredicate'] || null;
  this.propertyPredicate = options['propertyPredicate'] || null;
  this.propertyNames = options['propertyNames'] || null;
 
  /*
    <div id="divid" class="inspector-container">
      <select></select>
      <div class="inspector"></div>
      <div class="inspector-button-container"></div>
    </div>
  */
  var div = document.getElementById(divid);
  div.className = "inspector-container";
  var chooser = document.createElement("select");
  div.appendChild(chooser);
  var mainDiv = document.createElement("div");
  mainDiv.className = "inspector";
  div.appendChild(mainDiv);
  var acceptResetDiv = document.createElement("div");
  acceptResetDiv.className = "inspector-button-container";
  div.appendChild(acceptResetDiv);
 
  this.div = mainDiv;
  this.acceptResetDiv = acceptResetDiv;
  this.chooser = chooser;
  this.lastIndex = 0;
 
  var self = this;
 
  function updateViews(e) {
    if (e.isTransactionFinished) self.rebuildViews();
  }
 
  if (diagram.addModelChangedListener) {
    // automatically reregisters listener when the Diagram.model is replaced
    diagram.addModelChangedListener(updateViews);
  } else {
    diagram.model.addChangedListener(updateViews);
  }
 
  if (this.whenSelected) {
    var pred = this.inspectPredicate;
    diagram.addDiagramListener('ChangedSelection', function(e) {
      var inspectedObjects = [];
      var selection = myDiagram.selection.first();
      if (selection === null) {
        self.toggleVisibility(false);
        return;
      }
 
      if (self.propertyNames !== null) {
        self.populatePropertyNames(inspectedObjects, pred, selection); // NYI
      } else {
        self.populateDefault(inspectedObjects, pred, selection);
      }
 
      chooser.innerHTML = '';
      for (var i = 0; i < inspectedObjects.length; i++) {
        var option = document.createElement('option');
        option.value = i;
        option.text = inspectedObjects[i] instanceof go.GraphObject ? inspectedObjects[i].toString() : 'data';
        chooser.appendChild(option);
      }
 
      chooser.onchange = function() {
        var index = this.selectedIndex;
        if (self.propertyNames !== null) {
          self.change(selection);
        } else {
          self.change(inspectedObjects[index]);
        }
        self.lastIndex = index;
      }
      self.toggleVisibility(true);
 
      var useLastIndex = self.lastIndex <= (inspectedObjects.length -1);
      if (self.propertyNames !== null) {
        self.change(selection);
      } else {
        self.change(inspectedObjects[useLastIndex ? self.lastIndex : 0]);
      }
      if (useLastIndex) chooser.value = self.lastIndex;
      // if the index was from the lastIndex than we need to update the chooser
    });
  }
 
  // accept focus option = commit when clicking away from the div:
  if (this.acceptFocus) {
    div.tabIndex = 3; // div must be allowed focus
    // must use focusout instead of blur - blur does not bubble,
    // so clicking on an <input> inside the div and then clicking away
    // will not fire an event with blur, and it will focusout
    div.addEventListener('focusout', function(e) {
      self.setAllProperties();
    });
  }
 
  this.toggleVisibility(false);
} // end DebugInspector constructor
 
// Populate the selection box with all GraphObjects inside a node, plus its part.data
DebugInspector.prototype.populateDefault = function(graphObjects, pred, selection) {
  if (pred === null || pred(selection)) {
    graphObjects.push(selection);
  }
  var recurseDownPanels = function(element) {
    if (element instanceof go.Panel) {
      var elements = element.elements;
      while(elements.next()) {
        var val = elements.value;
        if (pred === null || pred(val)) {
           graphObjects.push(val);
        }
        recurseDownPanels(val);
      }
    }
  }
  recurseDownPanels(selection);
  if (pred === null || pred(selection.data)) {
    graphObjects.push(selection.data);
  }
}
 
// populate based on this.propertyNames
DebugInspector.prototype.populatePropertyNames = function(graphObjects, pred, selection) {
  graphObjects.push(this.propertyNames);
}
 
DebugInspector.prototype.change = function(graphObject) {
  this.inspectedProps = {};
  this.setCollection(graphObject);
  this.showObjectProperties(graphObject);
}
 
DebugInspector.prototype.toggleVisibility = function(visible) {
  this.div.style.display = visible ? "block" : "none";
  this.acceptResetDiv.style.display = visible ? "block" : "none";
  // Hide the chooser if there's only one observed object being inspected
  this.chooser.style.display = (visible && this.chooser.options.length > 1) ? "block" : "none";
}
 
// coll = collection of objects (JavaScript Objects, GraphObjects, Parts, etc)
// assumes coll is a single object for now
DebugInspector.prototype.setCollection = function(coll) {
  this.collection = coll;
}
 
DebugInspector.prototype.rebuildViews = function() {
  // clear any old spectrum controls that were bound to old inputs
  var spectrums = document.getElementsByClassName("sp-container");
  while (spectrums.length !== 0) document.body.removeChild(spectrums[0]);
  var div = this.div;
  while (div.children.length !== 0) div.removeChild(div.children[0]);
  this.acceptResetDiv.innerHTML = '';
  var trackedList = Object.keys(this.tracked);
  for (var i = 0; i < trackedList.length; i++ ) {
    var section = DebugInspector.createSection(trackedList[i]);
    var inspectedProps = this.tracked[trackedList[i]];
    for (var j = 0; j < inspectedProps.length; j++) {
      var propname = inspectedProps[j];
      var view = this.inspectedProps[propname];
      if (!view || view.visible !== true) continue;
 
      section.appendChild(view.getDOM());
      var coll = this.collection;
      var group = view.dom;
      var label = group.label || group.children[0];
      // optionally, sanitize property name into something human readable
      var camelCaseConverter = function(str) {
        var words = str.match(/[A-Za-z0-9][a-z]*/g);
        words = words.filter(function(str) { // the checkbox is clear enough the property is a bool
          return str !== "is";
        });
        return words.map(function(str) {
          if (str.length === 0) return str;
          else if (str.length === 1) return str.toUpperCase();
          else return str.substring(0,1).toUpperCase() + str.substring(1);
        }).join(" ");
      }
      label.textContent = propname; //camelCaseConverter(propname);
 
      var input = group.children[1];
      if (view.options.readOnly) {
        for (var k = 0; k < group.children.length; k++) {
          group.children[k].disabled = true;
        }
      }
 
      var type = view.getType();
      if (type === "Point" || type === "Size" || type === "Margin" || type === "Rect" || type == "Spot") {
        view.originalValue = view.getter(propname).copy();
      } else {
        var input;
        if (type === "Brush" || type === "boolean") input = group;
        else input = group.children[1];
        view.originalValue = input.value;
      }
 
      var val = "";
      if (coll !== null) val = view.getter(propname);
      view.inferredType = (typeof val); // number, boolean, function, object
      if (val === undefined) val = "";
      else if (val === "(null)") {
        view.nullCheckBox.checked = true;
      } else {
        if (view.nullCheckBox) view.nullCheckBox.checked = false;
      }
      view.populate(val);
 
    }
    div.appendChild(section);
  }
 
  var self = this;
  if (this.acceptButton) {
    this.buildButton("Accept", function() {
      self.setAllProperties();
      self.rebuildViews();
    });
  }
 
  if (this.resetButton) {
    this.buildButton("Reset", function(){
      self.rebuildViews();
    });
  }
}
 
DebugInspector.prototype.buildButton = function(text, clickFunction) {
  var viewName = text + "View";
  if (this[viewName] === undefined) {
    var button = document.createElement("input");
    button.type = "button";
    button.value = text;
    button.addEventListener("click", clickFunction);
    this.viewName = button;
  }
  this.acceptResetDiv.appendChild(this.viewName);
}
 
DebugInspector.prototype.setAllProperties = function() {
  var coll = this.collection;
  if (coll === null) return;
  var diagram = this.diagram;
  if (diagram === null) return;
  var inspectedProps = this.inspectedProps;
  var transactionName = 'set all properties';
  diagram.startTransaction(transactionName);
  for (var k in inspectedProps) {
    var view = inspectedProps[k];
    if (!view || view.setter === null || view.options.readOnly) continue;
    // don't set values that have not changed
    var val = view.isNull() ? null : view.use(this);
    if (view.originalValue === val) continue;
    if (val instanceof go.Point || val instanceof go.Size || val instanceof go.Spot ||
        val instanceof go.Rect || val instanceof go.Margin) {
      if (view.originalValue.equals(val)) continue;
    }
    view.setter(diagram, view, k, val);
  }
  diagram.commitTransaction(transactionName);
}
 
DebugInspector.prototype.createProperty = function(propname, options, object) {
  var pred = this.propertyPredicate;
  if (pred === null || pred(object, propname)) {
    // assume propname to be unique, create it if it does not exist
    // right now this clobbers the old View if it existed before
    var inspectedProps = this.inspectedProps;
    var view = new View(object, options);
    inspectedProps[propname] = view;
    view.name = propname;
  }
}
 
// create it if it doesn't exist, then append
DebugInspector.prototype.appendProperty = function(propname, options, object) {
  var inspectedProps = this.inspectedProps;
  this.createProperty(propname, options, object);
  if (inspectedProps[propname]) {
    inspectedProps[propname].visible = true;
  }
}
 
DebugInspector.prototype.hideAllProperties = function() {
  var inspectedProps = this.inspectedProps;
  for (var propname in inspectedProps) {
    inspectedProps[propname].visible = false;
  }
}
 
// Show all the relevant properties for a given object
// If the object is a GoJS object it will look at the Type._inspectedProperties and show those
DebugInspector.prototype.showObjectProperties = function(obj) {
  this.hideAllProperties();
  if (obj === null) return; // no object to show
  this.tracked = {};
  // TODO: Allow arbitrary objects later, or objects where _inspectedProperties is not defined
  // this will go through them, ie Node Part Panel GraphObject (in that order)
  var proto = Object.getPrototypeOf(obj);
 
 
  if(this.propertyNames !== null) { // given list of property names
    var propertyNames = this.propertyNames;
    var node = this.collection;
    for (var k in propertyNames) {
      if (go[k] !== undefined && go[k]['_inspectedProperties'] !== undefined) {
        // it's Node/Panel/GraphObject/etc, populate the names in the list
        var name = k;
        var section = DebugInspector.createSection(name);
        this.tracked[name] = [];
        var props = propertyNames[k];
        for (var i = 0; i < props.length; i++) {
          var prop = props[i];
 
          // Find property options
          var options = null;
          while (options === null && proto && proto.constructor !== Object) {
            if (proto.constructor._inspectedProperties[prop]) options = proto.constructor._inspectedProperties[prop];
            proto = Object.getPrototypeOf(proto);
          }
          this.tracked[name].push(prop);
          this.appendProperty(prop, options, obj);
        }
      } else {
        // Is it a findObject "#name"? Test each and populate
        var name = k.substr(1); // remove the #
        var obj = node.findObject(name);
        if (obj === null) continue;
        var section = DebugInspector.createSection(name);
        this.tracked[name] = [];
        var props = propertyNames[k];
        for (var i = 0; i < props.length; i++) {
          var prop = props[i];
          this.tracked[name].push(prop);
          this.appendProperty(prop, { /* empty options */ }, obj);
        }
      }
    }
 
  } else if (proto.constructor === Object) { // arbitrary JS Object (for the Part.data)
    var name = 'data';
    var section = DebugInspector.createSection(name);
    this.tracked[name] = [];
    for (var prop in obj) {
      var options = { setter: View.defaultDataSetter };
      if (prop === '__gohashid') {
        options['type'] = "String";
        options['readOnly'] = true;
      }
      this.tracked[name].push(prop);
      this.appendProperty(prop, options, this.collection);
    }
  } else { // GoJS object
    while (proto && proto.constructor !== Object) {
      var props = proto.constructor._inspectedProperties;
      // toString often produces strings such as: Class("someInfo")#ID
      // We want the name to be just the Class.
      var name = (new proto.constructor().toString()).split('#')[0].split('(')[0];
      var section = DebugInspector.createSection(name);
      this.tracked[name] = [];
      for (var x in props) {
        this.tracked[name].push(x);
        this.appendProperty(x, props[x], this.collection);
      }
      proto = Object.getPrototypeOf(proto);
    }
  }
  this.rebuildViews();
}
 
 
// node, part, panel, graphobject properties
DebugInspector.createSection = function(name) {
  var div = document.createElement("div");
  div.className = "inspector-section";
  var h3 = document.createElement("h3");
  h3.innerHTML = name + " Properties";
  div.appendChild(h3);
  return div;
}
 
/**
* View
* object: usually the this.collection/Node
*/
function View(object, options) {
  options = options || {};
 
  this.options = options;
  this.getter = options.getter || View.defaultGetter;
  this.setter = options.setter || View.defaultSetter;
  this.inialized = false;
  this.visible = true;
  this.dom = null;
  this.originalValue = null;
  this.object = object;
}
 
View.prototype.getDOM = function() {
  if (!this.inialized) {
    this.dom = this.initialize();
    this.inialized = true;
  }
  return this.dom;
}
 
View.prototype.getType = function() {
  return this.options.type || this.inferredType;
}
 
View.prototype.isNullable = function() {
  // check to see if the object was specifically set to nullable in the metadata
  if (this.options.nullable) return true;
  var type = this.getType();
  if (go[type] !== undefined) {
    return !!go[type].nullable;
  }
  return false; // not nullable by default
}
 
View.prototype.isNull = function() {
  return this.isNullable() && (this.nullCheckBox && this.nullCheckBox.checked);
}
 
// Returns a div with a label or null checkbox
View.prototype.makeInspectorGroup = function() {
  var div = document.createElement("div");
  div.className = "inspector-group";
  var label = document.createElement("label");
  label.textContent = "LABEL";
  label.className = "property-name";
 
  var appendElement = label;
  if (this.isNullable()) {
    div.className += " inspector-nullable";
    var span = document.createElement("span");
    span.appendChild(label);
    var nullLabel = document.createElement("label");
    var nullText = document.createElement("span");
    nullText.textContent = "Null?";
    var nullCheckBox = document.createElement("input");
    nullCheckBox.type = "checkbox";
    nullLabel.appendChild(nullCheckBox);
    nullLabel.appendChild(nullText);
    span.appendChild(nullLabel);
    appendElement = span;
    this.nullCheckBox = nullCheckBox;
  }
  div.appendChild(appendElement);
  div.label = label;
  return div;
}
 
View.prototype.nFieldHTMLInit = function(fields) {
  var div = this.makeInspectorGroup();
  var colsPerRow = 2;
  var inputs = [];
  var row = [];
 
  var populateRow = function() {
    var rowDiv = document.createElement("div");
    for (var i = 0; i < row.length; i++) {
      rowDiv.appendChild(row[i]);
    }
    rowDiv.className = "row";
    div.appendChild(rowDiv);
    row = [];
  }
 
  for (var i = 0; i < fields.length; i++) {
    var label = document.createElement("label");
    label.textContent = fields[i];
    label.className = "inspector-n-field-label";
 
    var input = document.createElement("input");
    input.className = "input-short";
    inputs.push(input);
 
    var cell = document.createElement("div");
    cell.className = "cell";
    cell.appendChild(label);
    cell.appendChild(input);
    row.push(cell);
    if (row.length % colsPerRow === 0) populateRow();
  }
 
  if (row.length !== 0) populateRow();
 
  this.inputs = inputs;
  return div;
}
 
View.prototype.initialize = function() {
  var dom = this.dom;
  var type = this.getType();
  var div = null;
  switch (type) {
    case "Enum":
      div = this.makeInspectorGroup();
      var select = document.createElement("select");
      div.appendChild(select);
      break;
    case "Margin":
      div = this.nFieldHTMLInit(["Top", "Right", "Bottom", "Left"]);
      break;
    case "Point":
      div = this.nFieldHTMLInit(["X", "Y"]);
      break;
    case "Rect":
      div = this.nFieldHTMLInit(["X", "Y", "Width", "Height"]);
      break;
    case "Size":
      div = this.nFieldHTMLInit(["Width", "Height"]);
      break;
    case "Spot":
      div = this.nFieldHTMLInit(["X", "Y", "Offset X", "Offset Y"]);
      var inputs = this.inputs;
      var select = document.createElement("select");
 
      var spots = [];
      var i = 0;
      var custom = document.createElement("option");
      custom.value = -1;
      custom.text = "Custom Spot";
      select.appendChild(custom);
      for (var k in go.Spot) {
        if (go.Spot[k] instanceof go.Spot) {
          var option = document.createElement("option");
          option.value = i;
          option.text = k;
          i++;
          select.appendChild(option);
        }
      }
      select.value = -1;
      select.div = div;
      div.dropdown = select;
      var view = this;
      select.onchange = function() {
        var selected = select[select.selectedIndex].text;
        if (selected === "Custom Spot") return;
        var spot = go.Spot.parse(selected);
        view.inputs[0].value = spot.x;
        view.inputs[1].value = spot.y;
        view.inputs[2].value = spot.offsetX;
        view.inputs[3].value = spot.offsetY;
      }
      div.selectIndex = div.children.length;
      div.appendChild(select);
      break;
    case "Brush":
      div = this.makeInspectorGroup();
      var brushTextField = document.createElement("input");
      brushTextField.type = "text";
      div.appendChild(brushTextField);
      break;
    case "boolean":
      div = this.makeInspectorGroup();
      var input = document.createElement("input");
      input.type = "checkbox";
      input.className = "inspector-boolean-control";
      var label = div.children[0];
      label.className = "make-inline";
      div.insertBefore(input, label);
      div.input = input;
      break;
    case "number":
    default:
      div = this.makeInspectorGroup();
      var input = document.createElement("input");
      input.type = "text";
      if (this.getType() === "number") input.className += " right-align";
      input.className += " input-long";
      div.appendChild(input);
      div.input = input;
      break;
  }
  return div;
} // end view init
 
View.prototype.populate = function(val) {
  var dom = this.dom;
  var type = this.getType();
  switch (type) {
    case "Enum":
      var vals = this.options.enumValues;
      var select = this.dom.children[1];
      while (select.children.length !== 0) select.removeChild(select.children[0]);
      if (select.length === 0) {
        for (var i = 0; i < vals.length; i++) {
          var option = document.createElement("option");
          option.value = i;
          // just show the second half ("Position" instead of "Panel.Position")
          option.innerHTML = vals[i].toString().split('.')[1];
          select.appendChild(option);
        }
      }
      var index = -1;
      for (var i = 0; i < select.length; i++) {
        if (select[i].text ===  val.toString().split('.')[1]) {
          index = i;
          break;
        }
      }
      select.value = index;
      break;
    case "Margin":
      this.nFieldHTMLPopulate([val.top, val.left, val.bottom, val.right]);
      break;
    case "Point":
      this.nFieldHTMLPopulate([val.x, val.y]);
      break;
    case "Rect":
      this.nFieldHTMLPopulate([val.x, val.y, val.width, val.height]);
      break;
    case "Size":
      this.nFieldHTMLPopulate([val.width, val.height]);
      break;
    case "Spot":
      if (val instanceof go.Spot) {
        // check to see if spot we have is equal to a predefined Spot
        var predefined = null;
        for (var k in go.Spot) {
          if (go.Spot[k] instanceof go.Spot && go.Spot[k].equals(val)) {
            predefined = k;
            break;
          }
        }
        var select = dom.dropdown;
        if (predefined !== null) {
          var index = -1;
          for (var i = 0; i < select.children.length; i++) {
            var child = select.children[i];
            if (child.text === predefined) {
              index = parseInt(child.value);
              break;
            }
          }
          select.value = index;
        }
      }
      if (typeof val === "String") val = go.Spot.parse(val);
      this.nFieldHTMLPopulate([val.x, val.y, val.offsetX, val.offsetY]);
      break;
    case "Brush":
      var checkbox = this.nullCheckBox;
      var brushTextField = dom.children[1];
      if (val === "(null)") val = "black"; //
      // val is either a String or a Brush. If it's a Brush, make it a String
      var selected = $(brushTextField);
      if (typeof val === "string" || val.type === go.Brush.Solid) {
        var colorString = val;
        if (val instanceof go.Brush) colorString = val.color;
        var options = {
          replacerClassName: 'spectrum-control',
          color: colorString,
          showAlpha: true,
          showInput: true,
          clickoutFiresChange: true,
          showButtons: false,
          preferredFormat: "hex"
        };
        selected.spectrum(options);
      } else {
        selected.spectrum("destroy");
      }
      if (val instanceof go.Brush) {
        val = ExtendedBrush.stringify(val);
      }
      brushTextField.value = val; // val is now a String
      break;
    case "boolean":
      var input = dom.children[0];
      input.checked = val;
      break;
    case "number":
      dom.children[1].value = val;
      break;
    default:
      dom.children[1].value = val;
      break;
  }
} // end view populate
 
View.prototype.nFieldHTMLPopulate = function(arr) {
  var children = this.inputs;
  for (var i = 0; i < arr.length; i++) {
    children[i].value = arr[i];
  }
}
 
View.prototype.use = function(inspector) {
  var group = this.dom;
  var type = this.getType();
  var val = null;
  switch (type) {
    case "Enum":
      val = this.options.enumValues[group.children[1].selectedIndex];
      break;
    case "Margin":
      var obj = this.nFieldHTMLUse(4);
      val = new go.Margin(obj[0], obj[1], obj[2], obj[3]);
      break;
    case "Point":
      var obj = this.nFieldHTMLUse(2);
      val = new go.Point(obj[0], obj[1]);
      break;
    case "Rect":
      var obj = this.nFieldHTMLUse(4);
      val = new go.Rect(obj[0], obj[1], obj[2], obj[3]);
      break;
    case "Size":
      var obj = this.nFieldHTMLUse(2);
      val = new go.Size(obj[0], obj[1]);
      break;
    case "Spot":
      var obj = this.nFieldHTMLUse(4);
      var select = this.dom.children[this.dom.selectIndex];
      if (select.selectedIndex !== 0) {
        var spot = go.Spot.parse(select[select.selectedIndex].text);
        var equals = function(a,b) { return a === b || (isNaN(a) && isNaN(b)); }
        // prefedined spots have NaN in their fields. You can't pass NaN into the normal spot constructor.
        // instead of constructing a Spot, try to see if it equals the selected item and returned the prefedined spot
        if (equals(obj[0], spot.x) && equals(obj[1], spot.y) && equals(obj[2], spot.offsetX) && equals(obj[3], spot.offsetY))
          val = spot;
        // otherwise, build a new Spot and just return that
      }
      if (val === null) val = new go.Spot(obj[0], obj[1], obj[2], obj[3]);
      break;
    case "Brush":
      if (this.nullCheckBox.checked) {
        val = null;
      } else {
        var brushTextField = group.children[1].value;
        var part = inspector.collection;
        part = part.part;
        var brush = ExtendedBrush.parse(brushTextField, part.measuredBounds.width, part.measuredBounds.height);
        val = brush;
      }
      break;
    case "boolean":
      val = group.children[0].checked;
      break;
    case "number":
      val = parseFloat(group.input.value);
      break;
    default:
      val = group.input.value;
      break;
  }
  return val;
} // end view use
 
View.prototype.nFieldHTMLUse = function(count) {
  var obj = [];
  var children = this.inputs;
  for (var i = 0; i < children.length; i++) {
    obj[i] = parseFloat(children[i].value);
  }
  return obj;
}
 
View.defaultGetter = function(propname) {
  var val = this.object[propname];
  if (val === null) return "(null)";
  return val;
}
 
View.defaultDataGetter = function(propname) {
  return this.object[propname];
}
 
/**
* @param {Diagram} diagram
* @param {View} view
* @param {GraphObject} obj
* @param {string} propname
* @param {string} value
*/
View.defaultSetter = function(diagram, view, propname, value) {
  var mytype = view.getType();
  if (mytype === "number") value = parseFloat(value);
 
  this.object[propname] = value;
}
 
/**
* @param {Diagram} diagram
* @param {View} view
* @param {Object} data
* @param {string} propname
* @param {string} value
*/
View.defaultDataSetter = function(diagram, view, propname, value) {
  diagram.model.setDataProperty(this.object, propname, value);
}
 
 
// properties are either null or an object
// potential object properties:
//   type: string ("Brush", "Enum", "number")
//   enumValues: array of strings (["go.GraphObject.Fill, go.GraphObject.Uniform"])
//   readOnly: boolean (false by default, if omitted)
//   nullable: a property with nullable set to true means that it can be null. If omitted, objects are assumed to not be nullable unless a specific type (ie, Brush/Margin/etc) permits it
go.GraphObject._inspectedProperties = {
  "stretch": {
    type: "Enum",
    enumValues: [go.GraphObject.None, go.GraphObject.Fill, go.GraphObject.Horizontal, go.GraphObject.Vertical, go.GraphObject.Default],
    defaultValue: go.GraphObject.Default
  },
  "name": {
    type: "String",
    readOnly: true
  },
  "opacity": {
    type: "number",
    defaultValue: 1
  },
  "visible": {
    type: "boolean",
    defaultValue: true
  },
  "areaBackground": {
    type: "Brush",
    defaultValue: null
  },
  "background": {
    type: "Brush",
    defaultValue: null
  },
  "position": { type: "Point" },
  "scale": {
    type: "number",
    defaultValue: 1
  },
  "angle": {
    type: "number",
    defaultValue: 0
  },
  "desiredSize": { type: "Size" },
  "measuredBounds": {
    type: "Rect",
    readOnly: true
  },
  "naturalBounds": {
    type: "Rect",
    readOnly: true
  },
  "portId" : {
    type: "string",
    nullable: true,
    defaultValue: null
  },
  "minSize" : {
    type: "Size",
    defaultValue: new go.Size(0, 0)
  },
  "maxSize" : {
    type: "Size",
    defaultValue: new go.Size(Infinity, Infinity)
  }
}
 
go.Shape._inspectedProperties = {
  "fill": {
    type: "Brush",
    defaultValue: "black"
  },
  "stroke": {
    type: "Brush",
    defaultValue: "black"
  },
  "strokeWidth": {
    type: "number",
    defaultValue: 1.0
  },
  "strokeCap": {
    type: "String",
    defaultValue: "butt"
  },
  "strokeJoin": {
    type: "String",
    defaultValue: "miter"
  },
  "strokeMiterLimit": {
    type: "number",
    defaultValue: 10
  },
 
  /*
  TODO
  "strokeDashArray": {
    type: "Array",
    defaultValue: null
  },
  "strokeDashOffset": {
    type: "number",
    defaultValue: 0
  },
  */
  "figure": {
    type: "String",
    defaultValue: "None"
  },
  "toArrow":  {
    type: "String",
    defaultValue: "None"
  },
  "fromArrow":  {
    type: "String",
    defaultValue: "None"
  },
  "geometryStretch": {
    type: "Enum",
    enumValues: [go.GraphObject.None, go.GraphObject.Fill, go.GraphObject.Uniform, go.GraphObject.Default],
    defaultValue: go.GraphObject.Default
  }
}
 
go.TextBlock._inspectedProperties = {
  "font": {
    type: "String",
    defaultValue: "10px sans-serif"
  },
  "text": {type: "String"},
  "textAlign": {
    type: "String",
    defaultValue: "start"
  },
  "isMultiline": {
    type: "boolean",
    defaultValue: true
  },
  "isUnderline": {
    type: "boolean",
    defaultValue: false
  },
  "isStrikethrough": {
    type: "boolean",
    defaultValue: false
  },
  "wrap": {
    type: "Enum",
    enumValues: [go.TextBlock.WrapDesiredSize, go.TextBlock.WrapFit, go.TextBlock.None],
    defaultValue: go.TextBlock.WrapDesiredSize
  },
  "overflow": {
    type: "Enum",
    enumValues: [go.TextBlock.OverflowClip, go.TextBlock.OverflowEllipsis],
    defaultValue: go.TextBlock.OverflowClip
  },
  "stroke": {
    type: "Brush",
    defaultValue: "black"
  },
  "lineCount": {
    type: "number",
    readOnly: true
  },
  "editable": {type: "boolean"}
}
 
go.Panel._inspectedProperties = {
  "type": {
    type: "Enum",
    enumValues: [go.Panel.Position, go.Panel.Vertical, go.Panel.Horizontal, go.Panel.Auto, go.Panel.Spot, go.Panel.Table, go.Panel.Viewbox,
                  go.Panel.Link, go.Panel.TableRow, go.Panel.TableColumn, go.Panel.Grid],
    defaultValue: go.Panel.Position
  },
  "padding": {
    type: "Margin",
    defaultValue: new go.Margin()
  },
  "defaultAlignment": {
    type: "Spot",
    defaultValue: go.Spot.Default
  },
  "defaultStretch": {
    type: "Enum",
    enumValues: [go.GraphObject.None, go.GraphObject.Fill, go.GraphObject.Horizontal, go.GraphObject.Vertical, go.GraphObject.Default],
    defaultValue : go.GraphObject.Default
  },
  "gridCellSize": {
    type: "Size",
    defaultValue: new go.Size(10, 10)
  },
  "gridOrigin": {
    type: "Point",
    defaultValue: new go.Point()
  }
}
 
go.Part._inspectedProperties = {
  "location": {
    type: "Point"
  },
  "locationSpot": {type: "Spot"},
  "resizable": {
    type: "boolean",
    defaultValue: false
  },
  "rotatable": {
    type: "boolean",
    defaultValue: false
  },
  "isShadowed": {
    type: "boolean",
    defaultValue: false
  }
  /*  ,
  "locationObjectName": null,
  "selectionObjectName": null,
  "layerName": null,
  "category": null,
  "resizeObjectName": null,
  "rotateObjectName": null,
  "text": null,
  "shadowOffset": null,
  "shadowColor": null,
  "shadowBlur": null*/
}
 
go.Node._inspectedProperties = {
  "isTreeExpanded": {
    type: "boolean",
    defaultValue: true
  }
  /*,
  "avoidable": null,
  "avoidableMargin": null*/
}
 
go.Link._inspectedProperties = {
  "fromSpot": {type: "Spot"},
  "toSpot": {type: "Spot"},
  "relinkableFrom": {
    type: "boolean",
    defaultValue: false
  },
  "relinkableTo": {
    type: "boolean",
    defaultValue: false
  },
  "resegmentable": {
    type: "boolean",
    defaultValue: false
  },
  // technically a property of Part, only used on Links
  "reshapable": {
    type: "boolean",
    defaultValue: false
  },
  "midPoint": {
    type: "Point",
    readOnly: true
  },
  "midAngle": {
    type: "number",
    readOnly: true
  },
  "isOrthogonal": {
    type: "boolean",
    readOnly: true
  },
  "isAvoiding": {
    type: "boolean",
    readOnly: true
  },
  "corner": {
    type: "number",
    defaultValue: 0
  },
  "curve": {
    type: "Enum",
    enumValues: [go.Link.None, go.Link.Bezier, go.Link.JumpGap, go.Link.JumpOver],
    defaultValue: go.Link.None
  },
  "curviness": {
    type: "number",
    defaultValue: NaN
  },
  "routing": {
    type: "Enum",
    enumValues: [go.Link.Normal, go.Link.Orthogonal, go.Link.AvoidsNodes],
    defaultValue: go.Link.Normal
  },
  "smoothness": {
    type: "number",
    defaultValue: 0.5
  }
}
 
go.Group._inspectedProperties = {
  "ungroupable": {
    type: "boolean",
    defaultValue: false
  },
  "isSubGraphExpanded": {
    type: "boolean",
    defaultValue: true
  }
}
 
go.Picture._inspectedProperties = {
  "source" : {type: "string"},
  "imageStretch" : {
    type: "Enum",
    enumValues: [go.GraphObject.None, go.GraphObject.Fill, go.GraphObject.Uniform, go.GraphObject.UniformToFill],
    defaultValue: go.GraphObject.None
  },
  "naturalBounds" : {
    type: "Rect",
    readOnly: true
  },
  "sourceRect" : {
    type : "Rect",
    defaultValue: new go.Rect(NaN, NaN, NaN, NaN)
  }
}
 
go.Brush.nullable = true;
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/DimensioningLink.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/DimensioningLink.js

Statements: 2% (2 / 100)      Branches: 0% (0 / 33)      Functions: 0% (0 / 10)      Lines: 2.08% (2 / 96)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194                                          1                           2                                                                                                                                                                                                                                                                                                                            
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom routed Link for showing the distances between a point on one node and a point on another node.
 
// Note that because this is a Link, the points being measured must be on Nodes, not simple Parts.
// The exact point on each Node is determined by the Link.fromSpot and Link.toSpot.
 
// Several properties of the DimensioningLink customize the appearance of the dimensioning:
// direction, for orientation of the dimension line and which side it is on,
// extension, for how far the dimension line is from the measured points,
// inset, for leaving room for a text label, and
// gap, for distance that the extension line starts from the measured points
 
/**
* @constructor
* @extends Link
* @class
*/
function DimensioningLink() {
  go.Link.call(this);
  this.isLayoutPositioned = false;
  this.isTreeLink = false;
  this.routing = go.Link.Orthogonal;
  /** @type {number} */
  this._direction = 0;
  /** @type {number} */
  this._extension = 30;
  /** @type {number} */
  this._inset = 10;
  /** @type {number} */
  this._gap = 10;
}
go.Diagram.inherit(DimensioningLink, go.Link);
 
/*
* The general angle at which the measurement should be made.
* The default value is 0, meaning to go measure only along the X axis,
* with the dimension line and label above the two nodes (at lower Y coordinates).
* New values must be one of: 0, 90, 180, 270, or NaN.
* The value NaN indicates that the measurement is point-to-point and not orthogonal.
* @name DimensioningLink#direction
* @function.
* @return {number}
*/
Object.defineProperty(DimensioningLink.prototype, "direction", {
  get: function() { return this._direction; },
  set: function(value) {
    if (isNaN(value) || value === 0 || value === 90 || value === 180 || value === 270) {
      this._direction = value;
    } else {
      throw new Error("DimensioningLink: invalid new direction: " + value);
    }
  }
});
 
/*
* The distance at which the dimension line should be from the points being measured.
* The default value is 30.
* Larger values mean further away from the nodes.
* The new value must be greater than or equal to zero.
* @name DimensioningLink#extension
* @function.
* @return {number}
*/
Object.defineProperty(DimensioningLink.prototype, "extension", {
  get: function() { return this._extension; },
  set: function(value) { this._extension = value; }
});
 
/*
* The distance that the dimension line should be "indented" from the ends of the
* extension lines that are orthogonal to the dimension line.
* The default value is 10.
* @name DimensioningLink#inset
* @function.
* @return {number}
*/
Object.defineProperty(DimensioningLink.prototype, "inset", {
  get: function() { return this._inset; },
  set: function(value) {
    if (value >= 0) {
      this._inset = value;
    } else {
      throw new Error("DimensioningLink: invalid new inset: " + value);
    }
  }
});
 
/*
* The distance that the extension lines should come short of the measured points.
* The default value is 10.
* @name DimensioningLink#gap
* @function.
* @return {number}
*/
Object.defineProperty(DimensioningLink.prototype, "gap", {
  get: function() { return this._gap; },
  set: function(value) {
    if (value >= 0) {
      this._gap = value;
    } else {
      throw new Error("DimensioningLink: invalid new gap: " + value);
    }
  }
});
 
/**
* @override
* @return {boolean} true if it computed a route of points
*/
DimensioningLink.prototype.computePoints = function() {
  var fromnode = this.fromNode;
  if (!fromnode) return false;
  var fromport = this.fromPort;
  var fromspot = this.computeSpot(true);
  var tonode = this.toNode;
  if (!tonode) return false;
  var toport = this.toPort;
  var tospot = this.computeSpot(false);
  var frompoint = this.getLinkPoint(fromnode, fromport, fromspot, true, true, tonode, toport);
  if (!frompoint.isReal()) return false;
  var topoint = this.getLinkPoint(tonode, toport, tospot, false, true, fromnode, fromport);
  if (!topoint.isReal()) return false;
 
  this.clearPoints();
 
  var ang = this.direction;
  if (isNaN(ang)) {
    ang = frompoint.directionPoint(topoint);
    var p = new go.Point(this.extension, 0);
    p.rotate(ang + 90);
    var q = new go.Point(this.extension - this.inset, 0);
    q.rotate(ang + 90);
    var g = new go.Point(this.gap, 0);
    g.rotate(ang + 90);
    this.addPointAt(frompoint.x + g.x, frompoint.y + g.y);
    this.addPointAt(frompoint.x + p.x, frompoint.y + p.y);
    this.addPointAt(frompoint.x + q.x, frompoint.y + q.y);
    this.addPointAt(topoint.x + q.x, topoint.y + q.y);
    this.addPointAt(topoint.x + p.x, topoint.y + p.y);
    this.addPointAt(topoint.x + g.x, topoint.y + g.y);
  } else {
    var dist = this.extension;
    var r = 0.0;
    var s = 0.0;
    var t0 = 0.0;
    var t1 = 0.0;
    if (ang === 0 || ang === 180) {
      if (ang === 0) {
        r = Math.min(frompoint.y, topoint.y) - this.extension;
        s = r + this.inset;
        t0 = frompoint.y - this.gap;
        t1 = topoint.y - this.gap;
      } else {
        r = Math.max(frompoint.y, topoint.y) + this.extension;
        s = r - this.inset;
        t0 = frompoint.y + this.gap;
        t1 = topoint.y + this.gap;
      }
      this.addPointAt(frompoint.x, t0);
      this.addPointAt(frompoint.x + 0.01, r);
      this.addPointAt(frompoint.x, s);
      this.addPointAt(topoint.x, s);
      this.addPointAt(topoint.x - 0.01, r);
      this.addPointAt(topoint.x, t1);
    } else if (ang === 90 || ang === 270) {
      if (ang === 90) {
        r = Math.max(frompoint.x, topoint.x) + this.extension;
        s = r - this.inset;
        t0 = frompoint.x + this.gap;
        t1 = topoint.x + this.gap;
      } else {
        r = Math.min(frompoint.x, topoint.x) - this.extension;
        s = r + this.inset;
        t0 = frompoint.x - this.gap;
        t1 = topoint.x - this.gap;
      }
      this.addPointAt(t0, frompoint.y);
      this.addPointAt(r, frompoint.y + 0.01);
      this.addPointAt(s, frompoint.y);
      this.addPointAt(s, topoint.y);
      this.addPointAt(r, topoint.y - 0.01);
      this.addPointAt(t1, topoint.y);
    }
  }
 
  this.updateTargetBindings();
  return true;
};
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/DragCreatingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/DragCreatingTool.js

Statements: 1.8% (2 / 111)      Branches: 0% (0 / 48)      Functions: 0% (0 / 14)      Lines: 2.08% (2 / 96)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264                                                                          1                                               2                                                                                                                                                                                                                                                                                                                                                                                                                    
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom Tool for creating a new Node with custom size by dragging its outline in the background.
 
/**
* @constructor
* @extends Tool
* @class
* The DragCreatingTool lets the user create a new node by dragging in the background
* to indicate its size and position.
* <p/>
* The default drag selection box is a magenta rectangle.
* You can modify the {@link #box} to customize its appearance.
* <p/>
* This tool will not be able to start running unless you have set the
* {@link #archetypeNodeData} property to an object that can be copied and added to the diagram's model.
* <p/>
* You can use this tool in a modal manner by executing:
* <pre><code>
*   diagram.currentTool = new DragCreatingTool();
* </code></pre>
* <p/>
* Use this tool in a mode-less manner by executing:
* <pre><code>
*   myDiagram.toolManager.mouseMoveTools.insertAt(2, new DragCreatingTool());
* </code></pre>
* However when used mode-lessly as a mouse-move tool, in {@link ToolManager#mouseMoveTools},
* this cannot start running unless there has been a motionless delay
* after the mouse-down event of at least {@link #delay} milliseconds.
* <p/>
* This tool does not utilize any {@link Adornment}s or tool handles,
* but it does temporarily add the {@link #box} Part to the diagram.
* This tool does conduct a transaction when inserting the new node.
*/
function DragCreatingTool() {
  go.Tool.call(this);
  this.name = "DragCreating";
 
  /** @type {Object} */
  this._archetypeNodeData = null;
 
  var b = new go.Part();
  b.layerName = "Tool";
  b.selectable = false;
  var r = new go.Shape();
  r.name = "SHAPE";
  r.figure = "Rectangle";
  r.fill = null;
  r.stroke = "magenta";
  r.position = new go.Point(0, 0);
  b.add(r);
  /** @type {Part} */
  this._box = b;
 
  /** @type {number} */
  this._delay = 175;
}
 
go.Diagram.inherit(DragCreatingTool, go.Tool);
 
/**
* This tool can run when there has been a mouse-drag, far enough away not to be a click,
* and there has been delay of at least {@link #delay} milliseconds
* after the mouse-down before a mouse-move.
* <p/>
* This method may be overridden.
* @this {DragCreatingTool}
* @return {boolean}
*/
DragCreatingTool.prototype.canStart = function() {
  if (!this.isEnabled) return false;
 
  // gotta have some node data that can be copied
  if (this.archetypeNodeData === null) return false;
  
  var diagram = this.diagram;
  if (diagram === null) return false;
  // heed IsReadOnly & AllowInsert
  if (diagram.isReadOnly || diagram.isModelReadOnly) return false;
  if (!diagram.allowInsert) return false;
 
  var e = diagram.lastInput;
  // require left button & that it has moved far enough away from the mouse down point, so it isn't a click
  if (!e.left) return false;
  // don't include the following checks when this tool is running modally
  if (diagram.currentTool !== this) {
    if (!this.isBeyondDragSize()) return false;
    // must wait for "delay" milliseconds before that tool can run
    if (e.timestamp - diagram.firstInput.timestamp < this.delay) return false;
  }
  return true;
};
 
/**
* Capture the mouse and show the {@link #box}.
* @this {DragCreatingTool}
*/
DragCreatingTool.prototype.doActivate = function() {
  var diagram = this.diagram;
  if (diagram === null) return;
  this.isActive = true;
  diagram.isMouseCaptured = true;
  diagram.add(this.box);
  this.doMouseMove();
};
 
/**
* Release the mouse and remove any {@link #box}.
* @this {DragCreatingTool}
*/
DragCreatingTool.prototype.doDeactivate = function() {
  var diagram = this.diagram;
  if (diagram === null) return;
  diagram.remove(this.box);
  diagram.isMouseCaptured = false;
  this.isActive = false;
};
 
/**
* Update the {@link #box}'s position and size according to the value
* of {@link #computeBoxBounds}.
* @this {DragCreatingTool}
*/
DragCreatingTool.prototype.doMouseMove = function() {
  var diagram = this.diagram;
  if (diagram === null) return;
  if (this.isActive && this.box !== null) {
    var r = this.computeBoxBounds();
    var shape = this.box.findObject("SHAPE");
    if (shape === null) shape = this.box.findMainElement();
    shape.desiredSize = r.size;
    this.box.position = r.position;
  }
};
 
/**
* Call {@link #insertPart} with the value of a call to {@link #computeBoxBounds}.
* @this {DragCreatingTool}
*/
DragCreatingTool.prototype.doMouseUp = function() {
  if (this.isActive) {
    var diagram = this.diagram;
    diagram.remove(this.box);
    try {
      diagram.currentCursor = "wait";
      this.insertPart(this.computeBoxBounds());
    } finally {
      diagram.currentCursor = "";
    }
  }
  this.stopTool();
};
 
/**
* This just returns a {@link Rect} stretching from the mouse-down point to the current mouse point.
* <p/>
* This method may be overridden.
* @this {DragCreatingTool}
* @return {Rect} a {@link Rect} in document coordinates.
*/
DragCreatingTool.prototype.computeBoxBounds = function() {
  var diagram = this.diagram;
  if (diagram === null) return new go.Rect(0, 0, 0, 0);
  var start = diagram.firstInput.documentPoint;
  var latest = diagram.lastInput.documentPoint;
  return new go.Rect(start, latest);
};
 
/**
* Create a node by adding a copy of the {@link #archetypeNodeData} object
* to the diagram's model, assign its {@link GraphObject#position} and {@link GraphObject#desiredSize}
* according to the given bounds, and select the new part.
* <p>
* The actual part that is added to the diagram may be a {@link Part}, a {@link Node},
* or even a {@link Group}, depending on the properties of the {@link #archetypeNodeData}
* and the type of the template that is copied to create the part.
* @this {DragCreatingTool}
* @param {Rect} bounds a Point in document coordinates.
* @return {Part} the newly created Part, or null if it failed.
*/
DragCreatingTool.prototype.insertPart = function(bounds) {
  var diagram = this.diagram;
  if (diagram === null) return null;
  var arch = this.archetypeNodeData;
  if (arch === null) return null;
 
  this.startTransaction(this.name);
  var part = null;
  if (arch !== null) {
    var data = diagram.model.copyNodeData(arch);
    if (data) {
      diagram.model.addNodeData(data);
      part = diagram.findPartForData(data);
    }
  }
  if (part !== null) {
    part.position = bounds.position;
    part.resizeObject.desiredSize = bounds.size;
    if (diagram.allowSelect) {
      diagram.select(part);  // raises ChangingSelection/Finished
    }
  }
 
  // set the TransactionResult before raising event, in case it changes the result or cancels the tool
  this.transactionResult = this.name;
  this.stopTransaction();
  return part;
};
 
 
// Public properties
 
/**
* Gets or sets the {@link Part} used as the "rubber-band box"
* that is stretched to follow the mouse, as feedback for what area will
* be passed to {@link #insertPart} upon a mouse-up.
* <p/>
* Initially this is a {@link Part} containing only a simple magenta rectangular {@link Shape}.
* The object to be resized should be named "SHAPE".
* Setting this property does not raise any events.
* <p/>
* Modifying this property while this tool {@link Tool#isActive} might have no effect.
* @name DragCreatingTool#box
* @function.
* @return {Part}
*/
Object.defineProperty(DragCreatingTool.prototype, "box", {
  get: function() { return this._box; },
  set: function(val) { this._box = val; }
});
 
/**
* Gets or sets the time in milliseconds for which the mouse must be stationary
* before this tool can be started.
* The default value is 175 milliseconds.
* A value of zero will allow this tool to run without any wait after the mouse down.
* Setting this property does not raise any events.
* @name DragCreatingTool#delay
* @function.
* @return {number}
*/
Object.defineProperty(DragCreatingTool.prototype, "delay", {
  get: function() { return this._delay; },
  set: function(val) { this._delay = val; }
});
 
/**
* Gets or sets a data object that will be copied and added to the diagram's model each time this tool executes.
* The default value is null.
* The value must be non-null for this tool to be able to run.
* Setting this property does not raise any events.
* @name DragCreatingTool#archetypeNodeData
* @function.
* @return {Object}
*/
Object.defineProperty(DragCreatingTool.prototype, "archetypeNodeData", {
  get: function() { return this._archetypeNodeData; },
  set: function(val) { this._archetypeNodeData = val; }
});
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/DragZoomingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/DragZoomingTool.js

Statements: 1.72% (2 / 116)      Branches: 0% (0 / 50)      Functions: 0% (0 / 14)      Lines: 1.96% (2 / 102)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267                                                                              1                                               2                                                                                                                                                                                                                                                                                                                                                                                                                      
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom Tool for zooming into a selected area
 
/**
* @constructor
* @extends Tool
* @class
* The DragZoomingTool lets the user zoom into a diagram by stretching a box
* to indicate the new contents of the diagram's viewport (the area of the
* model shown by the Diagram).
* Hold down the Shift key in order to zoom out.
* <p/>
* The default drag selection box is a magenta rectangle.
* You can modify the {@link #box} to customize its appearance.
* <p/>
* The diagram that is zoomed by this tool is specified by the {@link #zoomedDiagram} property.
* If the value is null, the tool zooms its own {@link Tool#diagram}.
* <p/>
* You can use this tool in a modal manner by executing:
* <pre><code>
*   diagram.currentTool = new DragZoomingTool();
* </code></pre>
* <p/>
* Use this tool in a mode-less manner by executing:
* <pre><code>
*   myDiagram.toolManager.mouseMoveTools.insertAt(2, new DragZoomingTool());
* </code></pre>
* However when used mode-lessly as a mouse-move tool, in {@link ToolManager#mouseMoveTools},
* this cannot start running unless there has been a motionless delay
* after the mouse-down event of at least {@link #delay} milliseconds.
* <p/>
* This tool does not utilize any {@link Adornment}s or tool handles,
* but it does temporarily add the {@link #box} part to the diagram.
* This tool does not modify the model or conduct any transaction.
*/
function DragZoomingTool() {
  go.Tool.call(this);
  this.name = "DragZooming";
 
  var b = new go.Part();
  b.layerName = "Tool";
  b.selectable = false;
  var r = new go.Shape();
  r.name = "SHAPE";
  r.figure = "Rectangle";
  r.fill = null;
  r.stroke = "magenta";
  r.position = new go.Point(0, 0);
  b.add(r);
  /** @type {Part} */
  this._box = b;
 
  /** @type {number} */
  this._delay = 175;
 
  /** @type {Diagram} */
  this._zoomedDiagram = null;
}
 
go.Diagram.inherit(DragZoomingTool, go.Tool);
 
/**
* This tool can run when there has been a mouse-drag, far enough away not to be a click,
* and there has been delay of at least {@link #delay} milliseconds
* after the mouse-down before a mouse-move.
* <p/>
* This method may be overridden.
* @this {DragZoomingTool}
* @return {boolean}
*/
DragZoomingTool.prototype.canStart = function() {
  if (!this.isEnabled) return false;
  var diagram = this.diagram;
  if (diagram === null) return false;
  var e = diagram.lastInput;
  // require left button & that it has moved far enough away from the mouse down point, so it isn't a click
  if (!e.left) return false;
  // don't include the following checks when this tool is running modally
  if (diagram.currentTool !== this) {
    if (!this.isBeyondDragSize()) return false;
    // must wait for "delay" milliseconds before that tool can run
    if (e.timestamp - diagram.firstInput.timestamp < this.delay) return false;
  }
  return true;
};
 
/**
* Capture the mouse and show the {@link #box}.
* @this {DragZoomingTool}
*/
DragZoomingTool.prototype.doActivate = function() {
  var diagram = this.diagram;
  if (diagram === null) return;
  this.isActive = true;
  diagram.isMouseCaptured = true;
  diagram.skipsUndoManager = true;
  diagram.add(this.box);
  this.doMouseMove();
};
 
/**
* Release the mouse and remove any {@link #box}.
* @this {DragZoomingTool}
*/
DragZoomingTool.prototype.doDeactivate = function() {
  var diagram = this.diagram;
  if (diagram === null) return;
  diagram.remove(this.box);
  diagram.skipsUndoManager = false;
  diagram.isMouseCaptured = false;
  this.isActive = false;
};
 
/**
* Update the {@link #box}'s position and size according to the value
* of {@link #computeBoxBounds}.
* @this {DragZoomingTool}
*/
DragZoomingTool.prototype.doMouseMove = function() {
  var diagram = this.diagram;
  if (diagram === null) return;
  if (this.isActive && this.box !== null) {
    var r = this.computeBoxBounds();
    var shape = this.box.findObject("SHAPE");
    if (shape === null) shape = this.box.findMainElement();
    shape.desiredSize = r.size;
    this.box.position = r.position;
  }
};
 
/**
* Call {@link #zoomToRect} with the value of a call to {@link #computeBoxBounds}.
* @this {DragZoomingTool}
*/
DragZoomingTool.prototype.doMouseUp = function() {
  if (this.isActive) {
    var diagram = this.diagram;
    diagram.remove(this.box);
    try {
      diagram.currentCursor = "wait";
      this.zoomToRect(this.computeBoxBounds());
    } finally {
      diagram.currentCursor = "";
    }
  }
  this.stopTool();
};
 
/**
* This just returns a {@link Rect} stretching from the mouse-down point to the current mouse point
* while maintaining the aspect ratio of the {@link #zoomedDiagram}.
* <p/>
* This method may be overridden.
* @this {DragZoomingTool}
* @return {Rect} a {@link Rect} in document coordinates.
*/
DragZoomingTool.prototype.computeBoxBounds = function() {
  var diagram = this.diagram;
  if (diagram === null) return new go.Rect(0, 0, 0, 0);
  var start = diagram.firstInput.documentPoint;
  var latest = diagram.lastInput.documentPoint;
  var adx = latest.x - start.x;
  var ady = latest.y - start.y;
 
  var observed = this.zoomedDiagram;
  if (observed === null) observed = this.diagram;
  if (observed === null) {
    return new go.Rect(start, latest);
  }
  var vrect = observed.viewportBounds;
  if (vrect.height === 0 || ady === 0) {
    return new go.Rect(start, latest);
  }
 
  var vratio = vrect.width / vrect.height;
  var lx;
  var ly;
  if (Math.abs(adx / ady) < vratio) {
    lx = start.x + adx;
    ly = start.y + Math.ceil(Math.abs(adx) / vratio) * (ady < 0 ? -1 : 1);
  } else {
    lx = start.x + Math.ceil(Math.abs(ady) * vratio) * (adx < 0 ? -1 : 1);
    ly = start.y + ady;
  }
  return new go.Rect(start, new go.Point(lx, ly));
};
 
/**
* This method is called to change the {@link #zoomedDiagram}'s viewport to match the given rectangle.
* <p/>
* This method may be overridden.
* @this {DragZoomingTool}
* @param {Rect} r a rectangular bounds in document coordinates.
*/
DragZoomingTool.prototype.zoomToRect = function(r) {
  if (r.width < 0.1) return;
  var observed = this.zoomedDiagram;
  if (observed === null) observed = this.diagram;
  if (observed === null) return;
 
  // zoom out when using the Shift modifier
  if (this.diagram.lastInput.shift) {
    observed.scale = Math.max(observed.scale * r.width / observed.viewportBounds.width, observed.minScale);
    observed.centerRect(r);
  } else {
    // do scale first, so the Diagram's position normalization isn't constrained unduly when increasing scale
    observed.scale = Math.min(observed.viewportBounds.width * observed.scale / r.width, observed.maxScale);
    observed.position = new go.Point(r.x, r.y);
  }
};
 
 
// Public properties
 
/**
* Gets or sets the {@link Part} used as the "rubber-band zoom box"
* that is stretched to follow the mouse, as feedback for what area will
* be passed to {@link #zoomToRect} upon a mouse-up.
* <p/>
* Initially this is a {@link Part} containing only a simple magenta rectangular {@link Shape}.
* The object to be resized should be named "SHAPE".
* Setting this property does not raise any events.
* <p/>
* Modifying this property while this tool {@link Tool#isActive} might have no effect.
* @name DragZoomingTool#box
* @function.
* @return {Part}
*/
Object.defineProperty(DragZoomingTool.prototype, "box", {
  get: function() { return this._box; },
  set: function(val) { this._box = val; }
});
 
/**
* Gets or sets the time in milliseconds for which the mouse must be stationary
* before this tool can be started.
* The default value is 175 milliseconds.
* Setting this property does not raise any events.
* @name DragZoomingTool#delay
* @function.
* @return {number}
*/
Object.defineProperty(DragZoomingTool.prototype, "delay", {
  get: function() { return this._delay; },
  set: function(val) { this._delay = val; }
});
 
/**
* Gets or sets the {@link Diagram} whose {@link Diagram#position} and {@link Diagram#scale}
* should be set to display the drawn {@link #box} rectangular bounds.
* <p/>
* The default value is null, which causes {@link #zoomToRect} to modify this tool's {@link Tool#diagram}.
* Setting this property does not raise any events.
* @name DragZoomingTool#zoomedDiagram
* @function.
* @return {Diagram}
*/
Object.defineProperty(DragZoomingTool.prototype, "zoomedDiagram", {
  get: function() { return this._zoomedDiagram; },
  set: function(val) { this._zoomedDiagram = val; }
});
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/DrawCommandHandler.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/DrawCommandHandler.js

Statements: 0.8% (2 / 249)      Branches: 0% (0 / 112)      Functions: 0% (0 / 40)      Lines: 0.9% (2 / 221)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461                                                    1           2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
/**
* @constructor
* @extends CommandHandler
* @class 
* This CommandHandler class allows the user to position selected Parts in a diagram
* relative to the first part selected, in addition to overriding the doKeyDown method
* of the CommandHandler for handling the arrow keys in additional manners.
* <p>
* Typical usage:
* <pre>
*   $(go.Diagram, "myDiagramDiv",
*     {
*       commandHandler: $(DrawCommandHandler),
*       . . .
*     }
*   )
* </pre>
* or:
* <pre>
*    myDiagram.commandHandler = new DrawCommandHandler();
* </pre>*/
function DrawCommandHandler() {
  go.CommandHandler.call(this);
  this._arrowKeyBehavior = "move";
  this._pasteOffset = new go.Point(10, 10);
  this._lastPasteOffset = new go.Point(0, 0);
}
go.Diagram.inherit(DrawCommandHandler, go.CommandHandler);
 
/**
* This controls whether or not the user can invoke the {@link #alignLeft}, {@link #alignRight}, 
* {@link #alignTop}, {@link #alignBottom}, {@link #alignCenterX}, {@link #alignCenterY} commands.
* @this {DrawCommandHandler}
* @return {boolean}
* This returns true:
* if the diagram is not {@link Diagram#isReadOnly},
* if the model is not {@link Model#isReadOnly}, and
* if there are at least two selected {@link Part}s.
*/
DrawCommandHandler.prototype.canAlignSelection = function() {
  var diagram = this.diagram;
  if (diagram === null || diagram.isReadOnly || diagram.isModelReadOnly) return false;
  if (diagram.selection.count < 2) return false;
  return true;
};
 
/**
* Aligns selected parts along the left-most edge of the left-most part.
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype.alignLeft = function() {
  var diagram = this.diagram;
  diagram.startTransaction("aligning left");
  var minPosition = Infinity;
  diagram.selection.each(function(current) {
    if (current instanceof go.Link) return; // skips over go.Link
    minPosition = Math.min(current.position.x, minPosition);
  });
  diagram.selection.each(function(current) {
    if (current instanceof go.Link) return; // skips over go.Link
    current.move(new go.Point(minPosition, current.position.y));
  });
  diagram.commitTransaction("aligning left");
};
 
/**
* Aligns selected parts at the right-most edge of the right-most part.
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype.alignRight = function() {
  var diagram = this.diagram;
  diagram.startTransaction("aligning right");
  var maxPosition = -Infinity;
  diagram.selection.each(function(current) {
    if (current instanceof go.Link) return; // skips over go.Link
    var rightSideLoc = current.actualBounds.x + current.actualBounds.width;
    maxPosition = Math.max(rightSideLoc, maxPosition);
  });
  diagram.selection.each(function(current) {
    if (current instanceof go.Link) return; // skips over go.Link
    current.move(new go.Point(maxPosition - current.actualBounds.width, current.position.y));
  });
  diagram.commitTransaction("aligning right");
};
 
/**
* Aligns selected parts at the top-most edge of the top-most part.
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype.alignTop = function() {
  var diagram = this.diagram;
  diagram.startTransaction("alignTop");
  var minPosition = Infinity;
  diagram.selection.each(function(current) {
    if (current instanceof go.Link) return; // skips over go.Link
    minPosition = Math.min(current.position.y, minPosition);
  });
  diagram.selection.each(function(current) {
    if (current instanceof go.Link) return; // skips over go.Link
    current.move(new go.Point(current.position.x, minPosition));
  });
  diagram.commitTransaction("alignTop");
};
 
/**
* Aligns selected parts at the bottom-most edge of the bottom-most part.
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype.alignBottom = function() {
  var diagram = this.diagram;
  diagram.startTransaction("aligning bottom");
  var maxPosition = -Infinity;
  diagram.selection.each(function(current) {
    if (current instanceof go.Link) return; // skips over go.Link
    var bottomSideLoc = current.actualBounds.y + current.actualBounds.height;
    maxPosition = Math.max(bottomSideLoc, maxPosition);
  });
  diagram.selection.each(function(current) {
    if (current instanceof go.Link) return; // skips over go.Link
    current.move(new go.Point(current.actualBounds.x, maxPosition - current.actualBounds.height));
  });
  diagram.commitTransaction("aligning bottom");
};
 
/**
* Aligns selected parts at the x-value of the center point of the first selected part. 
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype.alignCenterX = function() {
  var diagram = this.diagram;
  var firstSelection = diagram.selection.first();
  if (!firstSelection) return;
  diagram.startTransaction("aligning Center X");
  var centerX = firstSelection.actualBounds.x + firstSelection.actualBounds.width / 2;
  diagram.selection.each(function(current) {
    if (current instanceof go.Link) return; // skips over go.Link
    current.move(new go.Point(centerX - current.actualBounds.width / 2, current.actualBounds.y));
  });
  diagram.commitTransaction("aligning Center X");
};
 
 
/**
* Aligns selected parts at the y-value of the center point of the first selected part. 
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype.alignCenterY = function() {
  var diagram = this.diagram;
  var firstSelection = diagram.selection.first();
  if (!firstSelection) return;
  diagram.startTransaction("aligning Center Y");
  var centerY = firstSelection.actualBounds.y + firstSelection.actualBounds.height / 2;
  diagram.selection.each(function(current) {
    if (current instanceof go.Link) return; // skips over go.Link
    current.move(new go.Point(current.actualBounds.x, centerY - current.actualBounds.height / 2));
  });
  diagram.commitTransaction("aligning Center Y");
};
 
 
/**
* Aligns selected parts top-to-bottom in order of the order selected.
* Distance between parts can be specified. Default distance is 0.
* @this {DrawCommandHandler}
* @param {number} distance 
*/
DrawCommandHandler.prototype.alignColumn = function(distance) {
  var diagram = this.diagram;
  diagram.startTransaction("align Column");
  if (distance === undefined) distance = 0; // for aligning edge to edge
  distance = parseFloat(distance);
  var selectedParts = new Array();
  diagram.selection.each(function(current) {
    if (current instanceof go.Link) return; // skips over go.Link
    selectedParts.push(current);
  });
  for (var i = 0; i < selectedParts.length - 1; i++) {
    var current = selectedParts[i];
    // adds distance specified between parts
    var curBottomSideLoc = current.actualBounds.y + current.actualBounds.height + distance;
    var next = selectedParts[i + 1];
    next.move(new go.Point(current.actualBounds.x, curBottomSideLoc));
  }
  diagram.commitTransaction("align Column");
};
 
/**
* Aligns selected parts left-to-right in order of the order selected.
* Distance between parts can be specified. Default distance is 0.
* @this {DrawCommandHandler}
* @param {number} distance 
*/
DrawCommandHandler.prototype.alignRow = function(distance) {
  if (distance === undefined) distance = 0; // for aligning edge to edge
  distance = parseFloat(distance);
  var diagram = this.diagram;
  diagram.startTransaction("align Row");
  var selectedParts = new Array();
  diagram.selection.each(function(current) {
    if (current instanceof go.Link) return; // skips over go.Link
    selectedParts.push(current);
  });
  for (var i = 0; i < selectedParts.length - 1; i++) {
    var current = selectedParts[i];
    // adds distance specified between parts
    var curRightSideLoc = current.actualBounds.x + current.actualBounds.width + distance;
    var next = selectedParts[i + 1];
    next.move(new go.Point(curRightSideLoc, current.actualBounds.y));
  }
  diagram.commitTransaction("align Row");
};
 
 
/**
* This controls whether or not the user can invoke the {@link #rotate} command.
* @this {DrawCommandHandler}
* @param {number=} angle the positive (clockwise) or negative (counter-clockwise) change in the rotation angle of each Part, in degrees.
* @return {boolean}
* This returns true:
* if the diagram is not {@link Diagram#isReadOnly},
* if the model is not {@link Model#isReadOnly}, and
* if there is at least one selected {@link Part}.
*/
DrawCommandHandler.prototype.canRotate = function(number) {
  var diagram = this.diagram;
  if (diagram === null || diagram.isReadOnly || diagram.isModelReadOnly) return false;
  if (diagram.selection.count < 1) return false;
  return true;
};
 
/**
* Change the angle of the parts connected with the given part. This is in the command handler
* so it can be easily accessed for the purpose of creating commands that change the rotation of a part. 
* @this {DrawCommandHandler}
* @param {number=} angle the positive (clockwise) or negative (counter-clockwise) change in the rotation angle of each Part, in degrees.
*/
DrawCommandHandler.prototype.rotate = function(angle) {
  if (angle === undefined) angle = 90;
  var diagram = this.diagram;
  diagram.startTransaction("rotate " + angle.toString());
  var diagram = this.diagram;
  diagram.selection.each(function(current) {
    if (current instanceof go.Link || current instanceof go.Group) return; // skips over Links and Groups
    current.angle += angle;
  });
  diagram.commitTransaction("rotate " + angle.toString());
};
 
 
/**
* This implements custom behaviors for arrow key keyboard events.
* Set {@link #arrowKeyBehavior} to "select", "move" (the default), "scroll" (the standard behavior), or "none"
* to affect the behavior when the user types an arrow key.
* @this {DrawCommandHandler}*/
DrawCommandHandler.prototype.doKeyDown = function() {
  var diagram = this.diagram;
  if (diagram === null) return;
  var e = diagram.lastInput;
 
  // determines the function of the arrow keys
  if (e.key === "Up" || e.key === "Down" || e.key === "Left" || e.key === "Right") {
    var behavior = this.arrowKeyBehavior;
    if (behavior === "none") {
      // no-op
      return;
    } else if (behavior === "select") {
      this._arrowKeySelect();
      return;
    } else if (behavior === "move") {
      this._arrowKeyMove();
      return;
    }
    // otherwise drop through to get the default scrolling behavior
  }
 
  // otherwise still does all standard commands
  go.CommandHandler.prototype.doKeyDown.call(this);
};
 
/**
* Collects in an Array all of the non-Link Parts currently in the Diagram.
* @this {DrawCommandHandler}
* @return {Array}
*/
DrawCommandHandler.prototype._getAllParts = function() {
  var allParts = new Array();
  this.diagram.nodes.each(function(node) { allParts.push(node); });
  this.diagram.parts.each(function(part) { allParts.push(part); });
  // note that this ignores Links
  return allParts;
};
 
/**
* To be called when arrow keys should move the Diagram.selection.
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype._arrowKeyMove = function() {
  var diagram = this.diagram;
  var e = diagram.lastInput;
  // moves all selected parts in the specified direction
  var vdistance = 0;
  var hdistance = 0;
  // if control is being held down, move pixel by pixel. Else, moves by grid cell size    
  if (e.control || e.meta) {
    vdistance = 1;
    hdistance = 1;
  } else if (diagram.grid !== null) {
    var cellsize = diagram.grid.gridCellSize;
    hdistance = cellsize.width;
    vdistance = cellsize.height;
  }
  diagram.startTransaction("arrowKeyMove");
  diagram.selection.each(function(part) {
    if (e.key === "Up") {
      part.move(new go.Point(part.actualBounds.x, part.actualBounds.y - vdistance));
    } else if (e.key === "Down") {
      part.move(new go.Point(part.actualBounds.x, part.actualBounds.y + vdistance));
    } else if (e.key === "Left") {
      part.move(new go.Point(part.actualBounds.x - hdistance, part.actualBounds.y));
    } else if (e.key === "Right") {
      part.move(new go.Point(part.actualBounds.x + hdistance, part.actualBounds.y));
    }
  });
  diagram.commitTransaction("arrowKeyMove");
};
 
/**
* To be called when arrow keys should change selection.
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype._arrowKeySelect = function() {
  var diagram = this.diagram;
  var e = diagram.lastInput;
  // with a part selected, arrow keys change the selection
  // arrow keys + shift selects the additional part in the specified direction
  // arrow keys + control toggles the selection of the additional part
  var nextPart = null;
  if (e.key === "Up") {
    nextPart = this._findNearestPartTowards(270);
  } else if (e.key === "Down") {
    nextPart = this._findNearestPartTowards(90);
  } else if (e.key === "Left") {
    nextPart = this._findNearestPartTowards(180);
  } else if (e.key === "Right") {
    nextPart = this._findNearestPartTowards(0);
  }
  if (nextPart !== null) {
    if (e.shift) {
      nextPart.isSelected = true;
    } else if (e.control || e.meta) {
      nextPart.isSelected = !nextPart.isSelected;
    } else {
      diagram.select(nextPart);
    }
  }
};
 
/**
* Finds the nearest Part in the specified direction, based on their center points.
* if it doesn't find anything, it just returns the current Part.
* @this {DrawCommandHandler}
* @param {number} dir the direction, in degrees
* @return {Part} the closest Part found in the given direction
*/
DrawCommandHandler.prototype._findNearestPartTowards = function(dir) {
  var originalPart = this.diagram.selection.first();
  if (originalPart === null) return null;
  var originalPoint = originalPart.actualBounds.center;
  var allParts = this._getAllParts();
  var closestDistance = Infinity;
  var closest = originalPart;  // if no parts meet the criteria, the same part remains selected
 
  for (var i = 0; i < allParts.length; i++) {
    var nextPart = allParts[i];
    if (nextPart === originalPart) continue;  // skips over currently selected part
    var nextPoint = nextPart.actualBounds.center;
    var angle = originalPoint.directionPoint(nextPoint);
    var anglediff = this._angleCloseness(angle, dir);
    if (anglediff <= 45) {  // if this part's center is within the desired direction's sector,
      var distance = originalPoint.distanceSquaredPoint(nextPoint);
      distance *= 1+Math.sin(anglediff*Math.PI/180);  // the more different from the intended angle, the further it is
      if (distance < closestDistance) {  // and if it's closer than any other part,
        closestDistance = distance;      // remember it as a better choice
        closest = nextPart;
      }
    }
  }
  return closest;
};
 
/**
* @this {DrawCommandHandler}
* @param {number} a
* @param {number} dir
* @return {number}
*/
DrawCommandHandler.prototype._angleCloseness = function(a, dir) {
  return Math.min(Math.abs(dir - a), Math.min(Math.abs(dir + 360 - a), Math.abs(dir - 360 - a)));
};
 
/**
* Reset the last offset for pasting.
* @override
* @this {DrawCommandHandler}
* @param {Iterable.<Part>} coll a collection of {@link Part}s.
*/
DrawCommandHandler.prototype.copyToClipboard = function(coll) {
  go.CommandHandler.prototype.copyToClipboard.call(this, coll);
  this._lastPasteOffset.set(this.pasteOffset);
};
 
/**
* Paste from the clipboard with an offset incremented on each paste, and reset when copied.
* @override
* @this {DrawCommandHandler}
* @return {Set.<Part>} a collection of newly pasted {@link Part}s
*/
DrawCommandHandler.prototype.pasteFromClipboard = function() {
  var coll = go.CommandHandler.prototype.pasteFromClipboard.call(this);
  this.diagram.moveParts(coll, this._lastPasteOffset);
  this._lastPasteOffset.add(this.pasteOffset);
  return coll;
};
 
/**
* Gets or sets the arrow key behavior. Possible values are "move", "select", and "scroll".  
* The default value is "move".
* @name DrawCommandHandler#arrowKeyBehavior
* @function.
* @return {string}
*/
Object.defineProperty(DrawCommandHandler.prototype, "arrowKeyBehavior", {
  get: function() { return this._arrowKeyBehavior; },
  set: function(val) {
    if (val !== "move" && val !== "select" && val !== "scroll" && val !== "none") {
      throw new Error("DrawCommandHandler.arrowKeyBehavior must be either \"move\", \"select\", \"scroll\", or \"none\", not: " + val);
    }
    this._arrowKeyBehavior = val;
  }
});
 
/**
* Gets or sets the offset at which each repeated pasteSelection() puts the new copied parts from the clipboard.
* @name DrawCommandHandler#pasteOffset
* @function.
* @return {Point}
*/
Object.defineProperty(DrawCommandHandler.prototype, "pasteOffset", {
  get: function() { return this._pasteOffset; },
  set: function(val) {
    if (!(val instanceof go.Point)) throw new Error("DrawCommandHandler.pasteOffset must be a Point, not: " + val);
    this._pasteOffset.set(val);
  }
});
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/ExtendedBrush.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/ExtendedBrush.js

Statements: 0.39% (2 / 507)      Branches: 0% (0 / 234)      Functions: 0% (0 / 37)      Lines: 0.42% (2 / 473)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797          1           2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
function ExtendedBrush(type) {
  if (arguments.length === 0)
    go.Brush.call(this);
  else
    go.Brush.call(this, type);
}
go.Diagram.inherit(ExtendedBrush, go.Brush);
 
ExtendedBrush['parse'] =
/**
* This static method can be used to read in a {@link Brush} from a string that was produced by {@link ExtendedBrush.stringify}.
* @param {string} str
* @return {Brush}
*/
ExtendedBrush.parse = function(str, w, h) {
  if (str.indexOf("linear") !== -1) {
    return ExtendedBrush._parseLinearGradientCSS(str, w, h);
  } else if (str.indexOf("radial") !== -1) {
    return ExtendedBrush._parseRadialGradientCSS(str, w, h);
  }  else if (go.Brush.isValidColor(str)) {
    var b = new go.Brush(go.Brush.Solid);
    b.color = str;
    return b;
  } else { //only works with image urls right now
    //TODO deal with Canvas elements
    var b = new go.Brush(go.Brush.Pattern);
    var image = document.createElement("img");
    image.src = str;
    b.pattern = image;
    return b;
  }
};
 
ExtendedBrush['stringify'] =
/**
* This static method can be used to write out a {@link Brush} as a string that can be read by {@link Brush.parse}.
* @param {Brush} val
* @return {string}
*/
ExtendedBrush.stringify = function(val) {
  if (!(val instanceof go.Brush)) throw new Error("ExtendedBrush.stringify requires a Brush argument, not: " + val);
  var str = "";
  if (val.type === go.Brush.Solid) {
    return val.color;
  } else if (val.type === go.Brush.Linear) {
    str = "linear-gradient(";
    var ang = ExtendedBrush._angleBetweenSpots(val);
    if (isNaN(ang)) ang = 180;
    str += ang + "deg";
    str += ExtendedBrush._convertStopsToCSS(val);
    str += ")";
  } else if (val.type === go.Brush.Radial) {
    str = "radial-gradient(";
    if (val.endRadius) str += Math.round(val.endRadius) + "px ";
    if (val.ellipseHeight) str += Math.round(val.ellipseHeight) + "px "; //temp until we figure out canvas scaling
    str += "at ";
    str += val.start.x * 100 + "% ";
    str += val.start.y * 100 + "% ";
    str += ExtendedBrush._convertStopsToCSS(val);
    str += ")";
  } else if (val.type === go.Brush.Pattern) {
    if (val.pattern) str = val.pattern.getAttribute("src");
  }
  return str;
}
 
 
ExtendedBrush._convertStopsToCSS = function(brush) {
  var it = brush.colorStops.iterator;
  var str = "";
  while (it.next()) {
    str += ", " + it.value + " " + it.key * 100 + "%";
  }
  return str;
};
 
ExtendedBrush._UNITS = ["px", "pt", "pc", "in", "cm", "mm"];
ExtendedBrush._lengthToPX = function(length, unit) {
  var pxPerInch = 96;
  var cmPerInch = 2.54;
  switch (unit) {
    case "px": return length;
    case "pt": return length * 3 / 4;
    case "pc": return length * 9;
    case "in": return length * pxPerInch;
    case "cm": return length * pxPerInch / cmPerInch;
    case "mm": return length * pxPerInch / (cmPerInch * 10);
    default: return NaN;
  }
};
 
ExtendedBrush._pxToPercent = function(px, l, w, angle) {
  angle = parseFloat(angle);
  if (angle % 180 === 0) return px / l;
  angle *= Math.PI / 180;
  return px / (Math.abs(w * Math.sin(angle)) + Math.abs(l * Math.cos(angle)));
}
 
ExtendedBrush._parseLinearGradientCSS = function(cssstring, w, h) {
  var css = cssstring.match(/\((.*)\)/g);
  if (css === null) throw new Error("Invalid CSS Linear Gradient: " + cssstring);
  css = css[0];
 
  //removes outer parentheses
  css = css.substring(1, css.length - 1);
 
  //splits string into components at commas not within parentheses
  //css = css.split(/,+(?![^\(]*\))/g);
  css = css.split(/,(?![^\(]*\))/g);
  css[0] = css[0].trim();
 
  var isValidColor = go.Brush.isValidColor(css[0].split(/\s(?![^\(]*\))/g)[0]);
 
  if (isValidColor) {
    // if the first param isn't a color, it's a CSS <angle>
    // or a malformed attempt at a color, such as "blavk"
    // if input's good it works for now, TODO improve later.
    css.splice(0, 0, "180deg");
  }
 
  //standardizes any angle measurement or direction to degrees
  css[0] = ExtendedBrush._linearGradientAngleToDegrees(css[0], w, h);
  var angle = parseFloat(css[0]) + 180; //adjusts for css having 180 as the default start point
  //converts color/percent strings to array objects
  var colors = ExtendedBrush._createColorStopArray(css);
 
  /* by now we have the list of color stops, and the computed angle. The color stops need to be bound in a map that the Brush class will like,
  and the angle needs to be computed with the dimensions of the thing that the brush is coloring, in order to supply the brush with it's start
  and end spots. once that stuff is computed, stick them on the Brush 'b', below, and return it.
  */
  var b = new go.Brush(go.Brush.Linear);
  var spots = ExtendedBrush._calculateLinearGradientSpots(angle, w, h);
  b.start = spots[0];
  b.end = spots[1];
 
  for (var i = 0; i < colors.length; i++) {
    b.addColorStop(colors[i].position, colors[i].color);
  }
  return b;
}
 
//parses array of gradient parameters to color stop array. used by both gradient parsers
ExtendedBrush._createColorStopArray = function(css) {
  var colors = [];
 
  for (var i = 1; i < css.length; i++) {
    css[i] = css[i].trim();
    var arr = css[i].split(/\s+(?![^\(]*\))/g);//whitespace not within parentheses
    var value;
    var obj = {};
    if (!go.Brush.isValidColor(arr[0])) {
      throw new Error("Invalid CSS Color in Linear Gradient: " + arr[0] + " in " + css);
    }
    if (arr[1] !== undefined) {
      // we have a measurement
      var unit = arr[1].match(/[^\d.]+/g)[0];
      if (ExtendedBrush._UNITS.indexOf(unit) !== -1) {
        arr[1] = parseFloat(arr[1]); // bites off anything not a number: "90px" -> 90.0 ... "px" is still stored in unit
        var len = ExtendedBrush._lengthToPX(arr[1], unit);
        obj["position"] = ExtendedBrush._pxToPercent(len, w, h, angle);
      } else if (unit === "%") {
        obj["position"] = parseFloat(arr[1]) / 100;
      } else {
        throw new Error("Invalid Linear Gradient Unit: " + unit + " in " + css);
      }
    } else {
      obj["position"] = NaN;
    }
    obj["color"] = arr[0];
    colors[i - 1] = obj;
  }
 
  if (isNaN(colors[0].position)) colors[0].position = 0;
  if (isNaN(colors[colors.length - 1].position)) colors[colors.length - 1].position = 1;
 
  //recursively fills in missing percents in the array
  ExtendedBrush._fixLinearGradientPositions(colors);
 
  return colors;
}
 
ExtendedBrush._fixLinearGradientPositions = function(arr, start, end) {
  if (start === undefined) start = 0;
  if (end === undefined) end = arr.length;
  while (start < end - 1 && !isNaN(arr[start + 1].position)) start++;
  if (start === end - 1) return;
  var tempEnd = start + 1;
  while (tempEnd < end && isNaN(arr[tempEnd].position)) tempEnd++;
  var step = (arr[tempEnd].position - arr[start].position) / (tempEnd - start);
  for (var i = 1; i < tempEnd - start; i++) {
    arr[i + start].position = Math.round((arr[start].position + i * step) * 1000) / 1000;
  }
 
  if (tempEnd < end - 1) {
    ExtendedBrush._fixLinearGradientPositions(arr, tempEnd, end);
  }
};
 
ExtendedBrush._calculateLinearGradientSpots = function(angle, w, h) {
  angle = parseFloat(angle);
  angle = (angle % 360 + 360) % 360;
 
  if (angle === 90) return [new go.Spot(0, 0, w, h / 2), new go.Spot(0, 0, 0, h / 2)];
  if (angle === 270) return [new go.Spot(0, 0, 0, h / 2), new go.Spot(0, 0, w, h / 2)];
 
  var tempAngle = -Math.abs((angle % 180) - 90) + 90; 90
 
  var tan = Math.tan(tempAngle * Math.PI / 180);
  var x = (h * tan - w) * 0.5 / (tan * tan + 1);
  var y = x * tan;
 
  if (angle >= 90 && angle <= 270) y = h - y;
 
  if (angle < 180)
    x = w + x;
  else
    x = -x;
 
  return ([new go.Spot(0, 0, x, y), new go.Spot(0, 0, w - x, h - y)]);
};
 
ExtendedBrush._applyLinearGradientSpots = function(angle, w, h, brush) {
  var spots = ExtendedBrush._calculateLinearGradientSpots(angle, w, h);
  brush.start = spots[0];
  brush.end = spots[1];
  return brush;
}
 
ExtendedBrush._linearGradientAngleToDegrees = function(string, w, h) {
  //true if there is a "to " at the start of the first parameter,
  //indicating that a direction was specified rather than angle
  var isNumericalInput = string.indexOf("to ") < 0;
 
  //0s without units still accepted
  var digit_arr = string.match(/\d/g);
  var zero_arr = string.match(/0/g);
  if (zero_arr !== null && (digit_arr.length === zero_arr.length)) return 0;
 
  if (isNumericalInput) {
    string = string.match(/[^a-z]+|\D+/g);
    switch (string[1]) {
      case ("deg"): return string[0];
      case ("rad"): return string[0] * 180 / Math.PI;
      case ("turn"): return string[0] * 360;
      case ("grad"): return string[0] * 9 / 10;
      default: throw new Error("Invalid CSS Linear Gradient direction: " + string[1]);
    }
  } else {
    var direction = 0;
    if (string.indexOf("right") >= 0) direction = 90;
    else if (string.indexOf("left") >= 0) direction = -90;
    var sign = direction === 0 ? 0 : direction > 0 ? 1 : -1; //needed because Chrome/IE/Safari/Opera/Mosaic/Netscape don't support Math.sign()
    if (string.indexOf("top") >= 0) {
      direction -= sign * Math.atan(w / h) * 180 / Math.PI;
    } else if (string.indexOf("bottom") >= 0) {
      if (direction === 0) direction = 180;
      else direction += sign * Math.atan(w / h) * 180 / Math.PI
    }
    if (direction === 0 && string.indexOf("top") < 0) {
      throw new Error("Invalid CSS Linear Gradient direction: " + string);
    }
    return Math.round(direction);
  }
};
 
ExtendedBrush._angleBetweenSpots = function(brush) {
  var start = brush.start;
  var end = brush.end;
  if (isNaN(start.x + start.y + end.x + end.y))
    throw new Error("The brush does not have valid spots");
  var x = end.offsetX - start.offsetX;
  var y = start.offsetY - end.offsetY;
  var angle = Math.atan((start.offsetX - end.offsetX) / (end.offsetY - start.offsetY)) * 180 / Math.PI;
  if (start.offsetY > end.offsetY) angle += 180;
  return (angle + 360) % 360;
}
 
 
 
ExtendedBrush._parseRadialGradientCSS = function(css, w, h) {
  //removes browser specific tags
 
  css = css.match(/\((.*)\)/g);
 
  if (css === null) {
    throw new Error("Invalid CSS Linear Gradient");
  }
  css = css[0];
 
  css = css.substring(1, css.length - 1);
 
  //splits string into components at commas not within parenthesesd and removes whitespace
  css = css.split(/,(?![^\(]*\))/g);
  css[0] = css[0].trim();
 
 
  var isValidColor = go.Brush.isValidColor(css[0].split(" ")[0]);
 
 
  //default shape paramenters
  var radii = [w / 2, h / 2]; //stores two radii
  var center = new go.Spot(0.5, 0.5, 0, 0); //stores the center of the gradient
 
  //goes through all cases to set radii and center
  if (!isValidColor) { //parses only if there were intial parameters specified
 
    //could be only a partial shape/position specification
    var shape = css[0]; //first specified parameter of gradient
    shape = shape.split("at")
 
    if (shape.length === 1) {
      center = new go.Spot(0.5, 0.5, 0, 0); //no center was specified, so it must be "at center";
    }
    else if (shape.length === 2) { //assigns something to center. one must have been specified if length===2
      center = ExtendedBrush._parseCenter(shape[1], w, h);
    }
    else {
      throw new Error("invalid css radial gradient string");
    }
 
    //uses center to calculate radii
    radii = ExtendedBrush._parseShapeDescription(shape[0], w, h, center);
  }
 
  var colors = ExtendedBrush._createColorStopArray(css);
 
  //  console.log("RADIAL: ", "\nCENTER: ", center, "\nRADII: ", radii, "\nCOLORS: ", colors);
 
  //  assigns stops, center, and radii to a brush
  var b = new go.Brush(go.Brush.Radial);
  b.start = center; //concentric in CSS, so start and end are the same
  b.end = center;
  b.startRadius = 0; //css starts at 0 automatically
  b.endRadius = radii[0]; //end radius is the width of the ending shape
  //TEMP until we implement scaling the gradient in canvas
  b.ellipseHeight = radii[1];
  for (var i = 0; i < colors.length; i++) {
    b.addColorStop(colors[i].position, colors[i].color);
  }
  return b;
}
 
 
//parses a position string to determine where the radial gradient is centered
ExtendedBrush._parseCenter = function(str, w, h) { //h and w values are only needed if pixels are being used
  var arr = []; //stores the x and y coodinates
 
  str = str.trim();
  var parts = str.split(/\s+/g);
 
  if (parts.length === 1) {
    arr = ExtendedBrush._englishPositionToCoordinate(parts[0]);
  } else if (parts.length === 2) {
    var digits = str.match(/\d+/g);
 
    //if specified only with english, no percents/pixels, compute center
    if (digits === null) {
      arr = ExtendedBrush._englishPositionToCoordinate(str);
    } else if (digits.length === 1) { //know one of the params are numbers
      //if the first param is a string, second is a number
      var num;
      var pos;
      if (parts[0].match(/\d+/g) === null) {
        pos = parts[0];
        num = parts[1];
      } else { //if second param is string and first is number
        pos = parts[1];
        num = parts[0];
      }
 
      num = ExtendedBrush._parseLengthToPercent(num);
 
      //correctly assigns the width coordinate
      arr = ExtendedBrush._englishPositionToCoordinate(pos);
      //overwrites height to the user specified value
      arr[1] = num;
    } else if (digits.length === 2) { //both the params are numbers
      arr[0] = ExtendedBrush._parseLengthToPercent(parts[0], w);
      arr[1] = ExtendedBrush._parseLengthToPercent(parts[1], h);
    }
  } else if (parts.length === 3) {
    //TODO must be two positions and a number
    //correct behavior here is not known, only works in IE. need to check css spec
  } else if (parts.length === 4) {
    switch (parts[0]) {
      case ("right"):
        arr[0] = 1 - ExtendedBrush._parseLengthToPercent(arr[1], w);
      case ("left"):
        arr[0] = ExtendedBrush._parseLengthToPercent(arr[1], w);
      default:
        throw new Error("invalid location keyword: " + parts[0]);
    }
    switch (parts[2]) {
      case ("top"):
        arr[0] = ExtendedBrush._parseLengthToPercent(arr[3], h);
      case ("bottom"):
        arr[0] = 1 - ExtendedBrush._parseLengthToPercent(arr[3], h);
      default:
        throw new Error("invalid location keyword: " + parts[2]);
    }
  } else {
    throw new Error("invalid CSS position description");
  }
 
  return new go.Spot(arr[0], arr[1], 0, 0);
}
 
ExtendedBrush._parseLengthToPercent = function(str, dimension) {
  if (str.indexOf("%") < 0) {//if specified by a length unit
    return ExtendedBrush._parseLengthToPX(str) / (dimension);
  } else { //if specified by percentage
    return parseFloat(str) / 100;
  }
}
 
ExtendedBrush._parseLengthToPX = function(str, dimension) {
  var len = parseFloat(str.match(/\d+/g)[0]);
  var unit = str.match(/\D+/g)[0];
  return ExtendedBrush._lengthToPX(len, unit)
}
 
ExtendedBrush._englishPositionToCoordinate = function(str) {
  var x = .5;
  var y = .5;
 
  if (str.indexOf("bottom") > -1)
    y = 1;
  else if (str.indexOf("top") > -1)
    y = 0;
  if (str.indexOf("left") > -1)
    x = 0;
  else if (str.indexOf("right") > -1)
    x = 1;
 
  return [x, y];
}
 
//needs to return something at some point
ExtendedBrush._parseShapeDescription = function(str, w, h, center) {
  var x = center.x;
  var y = center.y;
  str = str.trim();
  var split = str.split(" ");
  if (split === null) return [w / 2, h / 2];
  if (split.length === 1) {
    //distance from center to farthest side horizontally and vertically
    var a = Math.abs(w / 2 - x * w) + w / 2;
    var b = Math.abs(h / 2 - y * h) + h / 2;
 
    if (str.indexOf("ellipse") > -1) {
      return [a * Math.sqrt(2), b * Math.sqrt(2)];
    }
    else if (str.indexOf("circle") > -1) {
      var r = Math.sqrt(a * a + b * b);
      return [r, r];
    }
    else {
      //must not contain explicit shape paramenters, only an extent, so parse that
      return ExtendedBrush._parseExtentKeyword(str, w, h, center);
    }
  } else if (split.length === 2) {
    var digits = str.match(/\d+/g);
    if (digits === null) {
      //must be shape and extent
      return ExtendedBrush._parseExtentKeyword(str, w, h, center);
    } else if (digits.length === 1) {
      //only valid description would be "circle" and a radius specified as a length, NOT a percentage
      if (split[0].indexOf("circle") > -1 && split[1].indexOf("%") < 0) {
        var r = ExtendedBrush._parseLengthToPX(split[1]);
        return [r, r];
      } else
        throw new Error("Invalid CSS shape description");
    } else if (digits.length === 2) { //must both be ellipse radii
      return [ExtendedBrush._parseLengthToPX(split[0]),
              ExtendedBrush._parseLengthToPX(split[1])];
    } else {
      throw new Error("Invalid CSS shape description");
    }
  } else if (split.length === 3) {
    if (split[0] !== "ellipse")
      throw new Error("invalid CSS shape description");
 
    return [ExtendedBrush._parseLengthToPercent(split[1], w) * w,
            ExtendedBrush._parseLengthToPercent(split[2], h) * h]
  } else {
    throw new Error("invalid CSS shape description");
  }
}
 
ExtendedBrush._parseExtentKeyword = function(str, w, h, center) {
  if (!str) return [w / 2, h / 2];
 
  var x = center.x;
  var y = center.y;
 
  //distance from center to farthest side horizontally and vertically
  var a = Math.abs(w / 2 - x * w) + w / 2;
  var b = Math.abs(h / 2 - y * h) + h / 2;
 
 
  var split = str.split(" ");
  var extent; //stores the extent keyword
  var arr; //stores the radii to be returned
 
  if (split === null)
    throw new Error("invalid extent keyword");
  else
    extent = split[split.length - 1];
 
  //either a circle or an ellipse, nothing specified defaults to ellipse
  if (str.indexOf("circle") > -1) {
    switch (extent) {
      case ("closest-corner"):
        var r = Math.sqrt((w - a) * (w - a) + (h - b) * (h - b));
        break;
      case ("farthest-corner"):
        var r = Math.sqrt(a * a + b * b);
        break;
      case ("closest-side"):
        var r = Math.min(w - a, h - b);
        break;
      case ("farthest-side"):
        var r = Math.max(a, b);
        break;
      default:
        throw new Error("invalid extent keyword: " + extent);
    }
    return [r, r]
  } else { //must be an ellipse
    switch (extent) {
      case ("closest-corner"):
        return [(w - a) * Math.sqrt(2), (h - b) * Math.sqrt(2)];
      case ("farthest-corner"):
        return [a * Math.sqrt(2), b * Math.sqrt(2)];
      case ("closest-side"):
        return [w - a, h - b];
      case ("farthest-side"):
        return [a, b];
      default:
        throw new Error("invalid extent keyword: " + extent);
    }
  }
}
 
 
ExtendedBrush._makePaletteFromOneColor = function(color, number) {
  var colorArr = ExtendedBrush._RGB_to_Lab(ExtendedBrush.CSSStringToRGB(color));
  var arr = [];
  var inc = 100 / (number + 2);
  var numBelow = Math.floor(colorArr[0] / inc) - 1;
 
  for (var i = 1; i <= number; i++) {
    arr[i - 1] = go.Brush.lightenBy(color, inc * (i - numBelow) / 100);
  }
  return arr;
};
 
ExtendedBrush._makePaletteFromTwoColors = function(color1, color2, number) {
  color1 = ExtendedBrush._RGB_to_Lab(ExtendedBrush.CSSStringToRGB(color1));
  color2 = ExtendedBrush._RGB_to_Lab(ExtendedBrush.CSSStringToRGB(color2));
  var arr = [];
  var deltaA = ExtendedBrush._MAX_Lab_A - ExtendedBrush._MIN_Lab_A;
  var deltaB = ExtendedBrush._MAX_Lab_B - ExtendedBrush._MIN_Lab_B;
  var btm = number - 1;
  var diffA = (color1[1] - color2[1]) / btm;
  var diffB = (color1[2] - color2[2]) / btm;
  var diffL = (color1[0] - color2[0]) / btm;
  for (var i = 0; i < number; i++) {
    var rgb = ExtendedBrush._Lab_to_RGB([color2[0] + i * diffL, color2[1] + i * diffA, color2[2] + i * diffB]);
    var css = ExtendedBrush._RGBArrayToCSS(rgb);
    arr[i] = css;
  }
  return arr;
}
 
ExtendedBrush['makeColorPalette'] =
/**
 * Creates an array of valid equidistant colors.
 * @name ExtendedBrush#makeColorPalette
 * @param {string} color1 a valid color to be used as the basis for the color palette
 * @param {string=} color2 an additional color that will be used in conjunction with color1
 * @param {number=} number the amount of colors to be generated, the default is 3
 * @return {Array}
 */
/** @type {Array} */
ExtendedBrush.makeColorPalette = function(color1, color2, number) {
  // make sure we have 1-3 parameters
  if (arguments.length < 1) {
    throw new Error('Please provide at least one color, and at most two color and a number');
  } else if (arguments.length > 3) {
    throw new Error('Please provide no more than two colors, and an optional number argument');
  }
  // we have 1-3 parameters, proceed
 
  // if no palette length is provided we give them a palette of length 3
  var defaultPaletteLength = 3;
 
  // make sure that the first parameter is a string
  if (typeof color1 !== "string") throw new Error(color1 + " is not a string");
 
  /* check to see if the last parameter is undefined.
     This is used later to see if the second parameter should be handled as a color string
     or as a number for the length of the palette
  */
  var numundefined = number === undefined;
 
  /*
  This helper function will throw an error if the number passed into it is not real, and if it's not at least 1
  */
  var checkForNumberError = function(number) {
    if (typeof number !== "number" || isNaN(number) || number === Infinity || number < 1) throw new Error('Please provide a number greater than or equal to one, not: ' + number);
  }
 
  if (arguments.length === 1) {
    // we only have a legal color string, so return a palette with the defaultPaletteLength
    return ExtendedBrush._makePaletteFromOneColor(color1, defaultPaletteLength);
  }
 
  // by now we have a color, and any something else, be it another color, a number, or both
  if (typeof color2 === "string") {
    if (numundefined) {
      // we only have 2 colors, so make a palette of them with the defaultPaletteLenght
      return ExtendedBrush._makePaletteFromTwoColors(color1, color2, defaultPaletteLength);
    } else {
      checkForNumberError(number);
      // we have two strings and a valid number, make a palette with those
      return ExtendedBrush._makePaletteFromTwoColors(color1, color2, number);
    }
  } else {
    if (typeof color2 === "number") {
      if (numundefined) {
        number = color2;
        checkForNumberError(number);
        // make a palette with one color and the specified length
        if (number === 1) {
          color1 = ExtendedBrush.CSSStringToRGB(color1);
          color1.splice(3, 1);
          var x = [ExtendedBrush._RGBArrayToCSS(color1)];
          return x;
        }
        return ExtendedBrush._makePaletteFromOneColor(color1, number);
      } else {
        throw new Error("Please provide only only one number");
      }
    } else {
      throw new Error('Please provide either a color string or a number');
    }
  }
}
 
ExtendedBrush._sharedTempCtx = null;
 
ExtendedBrush.CSSStringToRGB = function(CSSColorString) {
  if (!go.Brush.isValidColor(CSSColorString))
    throw new Error("Invalid CSS Color String: " + CSSColorString);
  var canvas = ExtendedBrush._sharedTempCtx;
  if (canvas === null) canvas = ExtendedBrush._sharedTempCtx = document.createElement('canvas').getContext('2d');
  canvas.clearRect(0, 0, 1, 1);
  canvas.fillStyle = CSSColorString;
  canvas.fillRect(0, 0, 1, 1);
  var data = canvas.getImageData(0, 0, 1, 1).data;
  var arr = [];
  for (var i = 0; i < data.length; i++) arr.push(data[i]);
  return arr;
};
 
ExtendedBrush._RGBArrayToCSS = function(RGB_Array) {
  if (RGB_Array.length === 3) var str = "rgb(";
  else if (RGB_Array.length === 4) var str = "rgba(";
  else throw new Error("invalid RGB or RGBa array: " + RGB_Array);
 
  for (var i = 0; i < RGB_Array.length; i++) {
    str += RGB_Array[i] + (i !== RGB_Array.length - 1 ? ", " : "");
  }
  return str + ")";
};
 
 
ExtendedBrush._MIN_Lab_A = -93;
ExtendedBrush._MAX_Lab_A = 92;
ExtendedBrush._MIN_Lab_B = -114;
ExtendedBrush._MAX_Lab_B = 92;
 
ExtendedBrush._RGB_to_Lab = function(rgb) {
  return ExtendedBrush._XYZtoLab((ExtendedBrush._RGBtoXYZ(rgb)));
};
 
ExtendedBrush._Lab_to_RGB = function(Lab) {
  return ExtendedBrush._XYZtoRGB(ExtendedBrush._LabtoXYZ(Lab));
};
 
 
ExtendedBrush._sRGBtoXYZMatrix = [
    [0.4124564, 0.3575761, 0.1804375],
    [0.2126729, 0.7151522, 0.0721750],
    [0.0193339, 0.1191920, 0.9503041]
];
 
ExtendedBrush._XYZtosRGBMatrix = [
    [3.2404542, -1.5371385, -0.4985314],
    [-0.9692660, 1.8760108, 0.0415560],
    [0.0556434, -0.2040259, 1.0572252]
];
 
ExtendedBrush._rowMultiplication = function(row, colorArray) {
  var sum = 0;
  for (var i = 0; i < colorArray.length; i++) {
    sum += row[i] * colorArray[i];
  }
  return sum;
};
 
ExtendedBrush._RGB_XYZ_Inverse_Companding = function(RGB_value) {
  RGB_value /= 255;
  if (RGB_value <= .04045) {
    return RGB_value / 12.92;
  }
  return Math.pow(((RGB_value + .055) / 1.055), 2.4);
};
 
ExtendedBrush._XYZ_RGB_Companding = function(XYZ_value) {
  if (XYZ_value * 12.92 <= .04045)
    return XYZ_value * 12.92;
  return 1.055 * Math.pow(XYZ_value, .416667) - .055;
};
 
ExtendedBrush._RGBtoXYZ = function(rgb) {
  rgb.splice(3, 1); // remove alpha value the Canvas gives us
  var applied = [];
  var i;
  for (i = 0; i < rgb.length; i++)
    rgb[i] = ExtendedBrush._RGB_XYZ_Inverse_Companding(rgb[i]);
  for (i = 0; i < rgb.length; i++)
    applied[i] = ExtendedBrush._rowMultiplication(ExtendedBrush._sRGBtoXYZMatrix[i], rgb);
  return applied;
};
 
ExtendedBrush._XYZtoRGB = function(xyz) {
  var applied = [];
  var i;
  for (i = 0; i < xyz.length; i++)
    applied[i] = ExtendedBrush._rowMultiplication(ExtendedBrush._XYZtosRGBMatrix[i], xyz);
  for (i = 0; i < xyz.length; i++) {
    applied[i] = ExtendedBrush._XYZ_RGB_Companding(applied[i]) * 255;
    if (applied[i] < 0) applied[i] = 0;
    applied[i] *= 100;
    applied[i] = Math.round(applied[i]);
    applied[i] /= 100;
    applied[i] = Math.floor(applied[i]);
    if (applied[i] > 255) applied[i] = 255;
    if (applied[i] < 0) applied[i] = 0;
  }
  return applied;
};
 
ExtendedBrush._Lab_EPSILON = 216 / 24389;
ExtendedBrush._Lab_KAPPA = 24389 / 27;
ExtendedBrush._XYZ_Lab_HelperFunction = function(inputXYZ) {
  if (inputXYZ > ExtendedBrush._Lab_EPSILON) {
    return Math.pow(inputXYZ, 1 / 3);
  }
  return (ExtendedBrush._Lab_KAPPA * inputXYZ + 16) / 116;
};
 
ExtendedBrush._XYZtoLab = function(xyz) {
  var Lab = [];
  var y = ExtendedBrush._XYZ_Lab_HelperFunction(xyz[1]);
  Lab[0] = 116 * y - 16;
  Lab[1] = 500 * (ExtendedBrush._XYZ_Lab_HelperFunction(xyz[0]) - y);
  Lab[2] = 200 * (y - ExtendedBrush._XYZ_Lab_HelperFunction(xyz[2]));
  return Lab;
};
 
ExtendedBrush._Lab_XYZ_HelperFunction = function(inputLab) {
  var inputCbd = inputLab * inputLab * inputLab;
  if (inputCbd > ExtendedBrush._Lab_EPSILON)
    return inputCbd;
  return (116 * inputLab - 16) / ExtendedBrush._Lab_KAPPA;
};
 
ExtendedBrush._LabtoXYZ = function(Lab) {
  var working_arr = [];
  working_arr[1] = (Lab[0] + 16) / 116;
  working_arr[0] = (Lab[1] / 500) + working_arr[1];
  working_arr[2] = (-Lab[2] / 200) + working_arr[1];
  var XYZ = [];
  XYZ[1] = ExtendedBrush._Lab_XYZ_HelperFunction(working_arr[1]);
  XYZ[0] = ExtendedBrush._Lab_XYZ_HelperFunction(working_arr[0]);
  XYZ[2] = ExtendedBrush._Lab_XYZ_HelperFunction(working_arr[2]);
  return XYZ;
};
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/Figures.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/Figures.js

Statements: 0.42% (17 / 4002)      Branches: 0% (0 / 342)      Functions: 0% (0 / 262)      Lines: 0.43% (17 / 3927)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982                                    1                                         2                           2                           2                           2                 2                                                                                 1                       1                   1                                 1                                                                                                       1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       1                   1                       1                                                   1                                         1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
'use strict';
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// This file holds definitions of all standard shape figures -- string values for Shape.figure.
 
// The following functions and variables are used throughout this file:
 
/**
* @constructor
* @param {string} name
* @param {number} def
* @param {number=} min defaults to zero
* @param {number=} max defaults to Infinity
* @class
* This FigureParamter class describes various properties each parameter uses in figures.
*/
function FigureParameter(name, def, min, max) {
  if (min === undefined/*notpresent*/) min = 0.0;
  if (max === undefined/*notpresent*/) max = Infinity;
  /** @type {string} */
  this._name = name;
  /** @type {number} */
  this._defaultValue = def;
  /** @type {number} */
  this._minimum = min;
  /** @type {number} */
  this._maximum = max;
};
 
// Public properties
 
/**
* Gets or sets the name of the figure.
* @name FigureParamater#name
* @function.
* @return {string}
*/
Object.defineProperty(FigureParameter.prototype, "name", {
  get: function() { return this._name; },
  set: function(val) {
    if (typeof val !== "string" || val === "") throw new Error("Shape name must be a valid string.");
    this._name = val;
  }
});
 
/**
* Gets or sets the default value for the parameter. 
* @name FigureParameter#defaultValue
* @function
* @return {number}
*/
Object.defineProperty(FigureParameter.prototype, "defaultValue", {
  get: function() { return this._defaultValue; },
  set: function(val) {
    if (typeof val !== "number" || isNaN(val)) throw new Error("The default value must be a real number, not: " + val);
    this._defaultValue = val;
  }
});
 
/**
* Gets or sets the minimum value allowed for the figure parameter.
* @name FigureParameter#minimum
* @function.
* @return {number}
*/
Object.defineProperty(FigureParameter.prototype, "minimum", {
  get: function() { return this._minimum; },
  set: function(val) {
    if (typeof val !== "number" || isNaN(val)) throw new Error("Minimum must be a real number, not: " + val);
    this._minimum = val;
  }
});
 
/**
* Gets or sets the maximum value allowed for the figure parameter. 
* @name FigureParameter#maximum
* @function.
* @return {number}
*/
Object.defineProperty(FigureParameter.prototype, "maximum", {
  get: function() { return this._maximum; },
  set: function(val) {
    if (typeof val !== "number" || isNaN(val)) throw new Error("Maximum must be a real number, not: " + val);
    this._maximum = val;
  }
});
 
 
go.Shape._FigureParameters = {};
 
/*
* This static function gets a FigureParameter for a particular figure name.
* @param {String} figurename
* @param {number} index, currently must be either 0 or 1
* @return {FigureParameter}
*/
go.Shape.getFigureParameter = function(figurename, index) {
  var arr = go.Shape._FigureParameters[figurename];
  if (!arr) return null;
  return /** @type {FigureParmeter} */ (arr[index]);
};
 
/*
* This static function sets a FigureParameter for a particular figure name.
* @param {String} figurename
* @param {number} index, currently must be either 0 or 1
* @param {FigureParameter} figparam
*/
go.Shape.setFigureParameter = function(figurename, index, figparam) {
  if (!(figparam instanceof FigureParameter)) throw new Error("Third argument to Shape.setFigureParameter is not FigureParameter: " + figparam);
  if (figparam.defaultValue < figparam.minimum || figparam.defaultValue > figparam.maximum) throw new Error("defaultValue must be between minimum and maximum, not: " + figparam.defaultValue);
  var arr = go.Shape._FigureParameters[figurename];
  if (!arr) {
    arr = [];
    go.Shape._FigureParameters[figurename] = arr;
  }
  arr[index] = figparam;
};
 
 
/** @ignore */
var _CachedPoints = [];
 
/**
* @ignore
* @param {number} x
* @param {number} y
* @return {Point}
*/
function tempPointAt(x, y) {
  var temp = _CachedPoints.pop();
  if (temp === undefined) return new go.Point(x, y);
  temp.x = x;
  temp.y = y;
  return temp;
};
 
/**
* @ignore
* @return {Point}
*/
function tempPoint() {
  var temp = _CachedPoints.pop();
  if (temp === undefined) return new go.Point();
  return temp;
};
 
/**
  * @ignore
  * @param {Point} temp
  */
function freePoint(temp) {
  _CachedPoints.push(temp);
};
 
/**
* @ignore
* @param {number} p1x
* @param {number} p1y
* @param {number} p2x
* @param {number} p2y
* @param {number} q1x
* @param {number} q1y
* @param {number} q2x
* @param {number} q2y
* @param {Point} result
* @return {Point}
*/
function getIntersection(p1x, p1y, p2x, p2y, q1x, q1y, q2x, q2y, result) {
  var dx1 = p1x - p2x;
  var dx2 = q1x - q2x;
  var x;
  var y;
 
  if (dx1 === 0 || dx2 === 0) {
    if (dx1 === 0) {
      var m2 = (q1y - q2y) / dx2;
      var b2 = q1y - m2 * q1x;
      x = p1x;
      y = m2 * x + b2;
    }
    else {
      var m1 = (p1y - p2y) / dx1;
      var b1 = p1y - m1 * p1x;
      x = q1x;
      y = m1 * x + b1;
    }
  }
  else {
    var m1 = (p1y - p2y) / dx1;
    var m2 = (q1y - q2y) / dx2;
    var b1 = p1y - m1 * p1x;
    var b2 = q1y - m2 * q1x;
 
    x = (b2 - b1) / (m1 - m2);
    y = m1 * x + b1;
  }
 
  result.x = x;
  result.y = y;
  return result;
};
 
/**
* @ignore
* @param {number} startx
* @param {number} starty
* @param {number} c1x
* @param {number} c1y
* @param {number} c2x
* @param {number} c2y
* @param {number} endx
* @param {number} endy
* @pararm {number} fraction
* @param {Point} curve1cp1  // modified result control point
* @param {Point} curve1cp2  // modified result control point
* @param {Point} midpoint  // modified result
* @param {Point} curve2cp1  // modified result control point
* @param {Point} curve2cp2  // modified result control point
*/
function breakUpBezier(startx, starty, c1x, c1y, c2x, c2y, endx, endy, fraction,
                       curve1cp1, curve1cp2, midpoint, curve2cp1, curve2cp2) {
  var fo = 1 - fraction;
  var so = fraction;
  var m1x = (startx * fo + c1x * so);
  var m1y = (starty * fo + c1y * so);
  var m2x = (c1x * fo + c2x * so);
  var m2y = (c1y * fo + c2y * so);
  var m3x = (c2x * fo + endx * so);
  var m3y = (c2y * fo + endy * so);
  var m12x = (m1x * fo + m2x * so);
  var m12y = (m1y * fo + m2y * so);
  var m23x = (m2x * fo + m3x * so);
  var m23y = (m2y * fo + m3y * so);
  var m123x = (m12x * fo + m23x * so);
  var m123y = (m12y * fo + m23y * so);
 
  curve1cp1.x = m1x;
  curve1cp1.y = m1y;
 
  curve1cp2.x = m12x;
  curve1cp2.y = m12y;
 
  midpoint.x = m123x;
  midpoint.y = m123y;
 
  curve2cp1.x = m23x;
  curve2cp1.y = m23y;
 
  curve2cp2.x = m3x;
  curve2cp2.y = m3y;
};
 
var GeneratorEllipseSpot1 = new go.Spot(0.156, 0.156);
 
var GeneratorEllipseSpot2 = new go.Spot(0.844, 0.844);
 
var KAPPA = 4 * ((Math.sqrt(2) - 1) / 3);
 
 
// PREDEFINED figures, built into the v2.0 library:
 
go.Shape.defineFigureGenerator("Rectangle", function(shape, w, h) {  // predefined in 2.0
  var geo = new go.Geometry(go.Geometry.Rectangle);
  geo.startX = 0;
  geo.startY = 0;
  geo.endX = w;
  geo.endY = h;
  return geo;
});
 
go.Shape.defineFigureGenerator("Square", function(shape, w, h) {  // predefined in 2.0
  var geo = new go.Geometry(go.Geometry.Rectangle);
  geo.startX = 0;
  geo.startY = 0;
  geo.endX = w;
  geo.endY = h;
  geo.defaultStretch = go.GraphObject.Uniform;
  return geo;
});
 
go.Shape.setFigureParameter("RoundedRectangle", 0, new FigureParameter("CornerRounding", 5));
go.Shape.defineFigureGenerator("RoundedRectangle", function(shape, w, h) {  // predefined in 2.0
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1) || param1 < 0) param1 = 5;  // default corner
  param1 = Math.min(param1, w / 3);
  param1 = Math.min(param1, h / 3);
 
  var cpOffset = param1 * KAPPA;
  var geo = new go.Geometry()
         .add(new go.PathFigure(param1, 0, true)
              .add(new go.PathSegment(go.PathSegment.Line, w - param1, 0))
              .add(new go.PathSegment(go.PathSegment.Bezier, w, param1, w - cpOffset, 0, w, cpOffset))
              .add(new go.PathSegment(go.PathSegment.Line, w, h - param1))
              .add(new go.PathSegment(go.PathSegment.Bezier, w - param1, h, w, h - cpOffset, w - cpOffset, h))
              .add(new go.PathSegment(go.PathSegment.Line, param1, h))
              .add(new go.PathSegment(go.PathSegment.Bezier, 0, h - param1, cpOffset, h, 0, h - cpOffset))
              .add(new go.PathSegment(go.PathSegment.Line, 0, param1))
              .add(new go.PathSegment(go.PathSegment.Bezier, param1, 0, 0, cpOffset, cpOffset, 0).close()));
  if (cpOffset > 1) {
    geo.spot1 = new go.Spot(0, 0, cpOffset, cpOffset);
    geo.spot2 = new go.Spot(1, 1, -cpOffset, -cpOffset);
  }
  return geo;
});
 
go.Shape.defineFigureGenerator("Border", "RoundedRectangle");  // predefined in 2.0
 
go.Shape.defineFigureGenerator("Ellipse", function(shape, w, h) {  // predefined in 2.0
  var geo = new go.Geometry(go.Geometry.Ellipse);
  geo.startX = 0;
  geo.startY = 0;
  geo.endX = w;
  geo.endY = h;
  geo.spot1 = GeneratorEllipseSpot1;
  geo.spot2 = GeneratorEllipseSpot2;
  return geo;
});
 
go.Shape.defineFigureGenerator("Circle", function(shape, w, h) {  // predefined in 2.0
  var geo = new go.Geometry(go.Geometry.Ellipse);
  geo.startX = 0;
  geo.startY = 0;
  geo.endX = w;
  geo.endY = h;
  geo.spot1 = GeneratorEllipseSpot1;
  geo.spot2 = GeneratorEllipseSpot2;
  geo.defaultStretch = go.GraphObject.Uniform;
  return geo;
});
 
go.Shape.defineFigureGenerator("TriangleRight", function(shape, w, h) {  // predefined in 2.0
  return new go.Geometry()
         .add(new go.PathFigure(0, 0)
              .add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()))
         .setSpots(0, 0.25, 0.5, 0.75);
});
 
go.Shape.defineFigureGenerator("TriangleDown", function(shape, w, h) {  // predefined in 2.0
  return new go.Geometry()
         .add(new go.PathFigure(0, 0)
              .add(new go.PathSegment(go.PathSegment.Line, w, 0))
              .add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h).close()))
         .setSpots(0.25, 0, 0.75, 0.5);
});
 
go.Shape.defineFigureGenerator("TriangleLeft", function(shape, w, h) {  // predefined in 2.0
  return new go.Geometry()
         .add(new go.PathFigure(w, h)
              .add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h))
              .add(new go.PathSegment(go.PathSegment.Line, w, 0).close()))
         .setSpots(0.5, 0.25, 1, 0.75);
});
 
go.Shape.defineFigureGenerator("TriangleUp", function(shape, w, h) {  // predefined in 2.0
  return new go.Geometry()
         .add(new go.PathFigure(w, h)
              .add(new go.PathSegment(go.PathSegment.Line, 0, h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0).close()))
         .setSpots(0.25, 0.5, 0.75, 1);
});
 
go.Shape.defineFigureGenerator("Triangle", "TriangleUp");  // predefined in 2.0
 
go.Shape.defineFigureGenerator("Diamond", function(shape, w, h) {  // predefined in 2.0
  return new go.Geometry()
         .add(new go.PathFigure(0.5 * w, 0)
              .add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h))
              .add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h).close()))
         .setSpots(0.25, 0.25, 0.75, 0.75);
});
 
go.Shape.defineFigureGenerator("LineH", function(shape, w, h) {  // predefined in 2.0
  var geo = new go.Geometry(go.Geometry.Line);
  geo.startX = 0;
  geo.startY = h / 2;
  geo.endX = w;
  geo.endY = h / 2;
  return geo;
});
 
go.Shape.defineFigureGenerator("LineV", function(shape, w, h) {  // predefined in 2.0
  var geo = new go.Geometry(go.Geometry.Line);
  geo.startX = w / 2;
  geo.startY = 0;
  geo.endX = w / 2;
  geo.endY = h;
  return geo;
});
 
go.Shape.defineFigureGenerator("BarH", "Rectangle");  // predefined in 2.0
go.Shape.defineFigureGenerator("BarV", "Rectangle");  // predefined in 2.0
go.Shape.defineFigureGenerator("MinusLine", "LineH");  // predefined in 2.0
 
go.Shape.defineFigureGenerator("PlusLine", function(shape, w, h) {  // predefined in 2.0
  return new go.Geometry()
         .add(new go.PathFigure(0, h/2, false)
              .add(new go.PathSegment(go.PathSegment.Line, w, h/2))
              .add(new go.PathSegment(go.PathSegment.Move, w/2, 0))
              .add(new go.PathSegment(go.PathSegment.Line, w/2, h)));
});
 
go.Shape.defineFigureGenerator("XLine", function(shape, w, h) {  // predefined in 2.0
  return new go.Geometry()
         .add(new go.PathFigure(0, h, false)
              .add(new go.PathSegment(go.PathSegment.Line, w, 0))
              .add(new go.PathSegment(go.PathSegment.Move, 0, 0))
              .add(new go.PathSegment(go.PathSegment.Line, w, h)));
});
 
 
// OPTIONAL figures, not predefined in the v2.0 library:
 
go.Shape.defineFigureGenerator("AsteriskLine", function(shape, w, h) {
  var offset = .2 / Math.SQRT2;
  return new go.Geometry()
         .add(new go.PathFigure(offset * w, (1 - offset) * h, false)
              .add(new go.PathSegment(go.PathSegment.Line, (1 - offset) * w, offset * h))
              .add(new go.PathSegment(go.PathSegment.Move, offset * w, offset * h))
              .add(new go.PathSegment(go.PathSegment.Line, (1 - offset) * w, (1 - offset) * h))
              .add(new go.PathSegment(go.PathSegment.Move, 0, h / 2))
              .add(new go.PathSegment(go.PathSegment.Line, w, h / 2))
              .add(new go.PathSegment(go.PathSegment.Move, w / 2, 0))
              .add(new go.PathSegment(go.PathSegment.Line, w / 2, h)));
});
 
go.Shape.defineFigureGenerator("CircleLine", function(shape, w, h) {
  var rad = w/2;
  var geo = new go.Geometry()
         .add(new go.PathFigure(w, w / 2, false)  // clockwise
              .add(new go.PathSegment(go.PathSegment.Arc, 0, 360, rad, rad, rad, rad).close()));
  geo.spot1 = GeneratorEllipseSpot1;
  geo.spot2 = GeneratorEllipseSpot2;
  geo.defaultStretch = go.GraphObject.Uniform;
  return geo;
});
 
go.Shape.defineFigureGenerator("Line1", function(shape, w, h) {
  var geo = new go.Geometry(go.Geometry.Line);
  geo.startX = 0;
  geo.startY = 0;
  geo.endX = w;
  geo.endY = h;
  return geo;
});
 
go.Shape.defineFigureGenerator("Line2", function(shape, w, h) {
  var geo = new go.Geometry(go.Geometry.Line);
  geo.startX = w;
  geo.startY = 0;
  geo.endX = 0;
  geo.endY = h;
  return geo;
});
 
go.Shape.defineFigureGenerator("Curve1", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, 0, false)
              .add(new go.PathSegment(go.PathSegment.Bezier, w, h, KAPPA * w, 0, w, (1 - KAPPA) * h)));
});
 
go.Shape.defineFigureGenerator("Curve2", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, 0, false)
              .add(new go.PathSegment(go.PathSegment.Bezier, w, h, 0, KAPPA * h, (1 - KAPPA) * w, h)));
});
 
go.Shape.defineFigureGenerator("Curve3", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(w, 0, false)
              .add(new go.PathSegment(go.PathSegment.Bezier, 0, h, w, KAPPA * h, KAPPA * w, h)));
});
 
go.Shape.defineFigureGenerator("Curve4", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(w, 0, false)
              .add(new go.PathSegment(go.PathSegment.Bezier, 0, h, (1 - KAPPA) * w, 0, 0, (1 - KAPPA) * h)));
});
 
go.Shape.defineFigureGenerator("TriangleDownLeft", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, 0, true)
              .add(new go.PathSegment(go.PathSegment.Line, w, h))
              .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()))
         .setSpots(0, 0.5, 0.5, 1);
});
 
go.Shape.defineFigureGenerator("TriangleDownRight", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(w, 0, true)
              .add(new go.PathSegment(go.PathSegment.Line, w, h))
              .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()))
         .setSpots(0.5, 0.5, 1, 1);
});
 
go.Shape.defineFigureGenerator("TriangleUpLeft", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, 0, true)
              .add(new go.PathSegment(go.PathSegment.Line, w, 0))
              .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()))
         .setSpots(0, 0, 0.5, 0.5);
});
 
go.Shape.defineFigureGenerator("TriangleUpRight", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, 0, true)
              .add(new go.PathSegment(go.PathSegment.Line, w, 0))
              .add(new go.PathSegment(go.PathSegment.Line, w, h).close()))
         .setSpots(0.5, 0, 1, 0.5);
});
 
go.Shape.defineFigureGenerator("RightTriangle", "TriangleDownLeft");
 
go.Shape.setFigureParameter("Parallelogram1", 0, new FigureParameter("Indent", 10, -Infinity, Infinity));
go.Shape.defineFigureGenerator("Parallelogram1", function(shape, w, h) {
  var param1 = shape ? shape.parameter1 : NaN;
  // Topleft corner's x distance from leftmost point
  if (isNaN(param1)) param1 = 10; // default value
  else if (param1 < -w) param1 = -w;
  else if (param1 > w) param1 = w;
  var indent = Math.abs(param1);
 
  if (param1 === 0) {
    var geo = new go.Geometry(go.Geometry.Rectangle);
    geo.startX = 0;
    geo.startY = 0;
    geo.endX = w;
    geo.endY = h;
    return geo;
  } else {
    var geo = new go.Geometry();
    if (param1 > 0) {
      geo.add(new go.PathFigure(indent, 0)
                  .add(new go.PathSegment(go.PathSegment.Line, w, 0))
                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, h))
                  .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()));
    } else {  // param1 < 0
      geo.add(new go.PathFigure(0, 0)
                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, 0))
                  .add(new go.PathSegment(go.PathSegment.Line, w, h))
                  .add(new go.PathSegment(go.PathSegment.Line, indent, h).close()));
    }
    if (indent < w / 2) {
      geo.setSpots(indent / w, 0, (w - indent) / w, 1);
    }
    return geo;
  }
});
 
go.Shape.setFigureParameter("Parallelogram2", 0, new FigureParameter("IndentFraction", 0.2, -0.999, 0.999));
go.Shape.defineFigureGenerator("Parallelogram2", function(shape, w, h) {
  var param1 = shape ? shape.parameter1 : NaN;
  // Topleft corner's x distance from leftmost point
  if (isNaN(param1)) param1 = 0.1; // default value
  else if (param1 < -1) param1 = -1;
  else if (param1 > 1) param1 = 1;
  var indent = Math.abs(param1) * w;
 
  if (param1 === 0) {
    var geo = new go.Geometry(go.Geometry.Rectangle);
    geo.startX = 0;
    geo.startY = 0;
    geo.endX = w;
    geo.endY = h;
    return geo;
  } else {
    var geo = new go.Geometry();
    if (param1 > 0) {
      geo.add(new go.PathFigure(indent, 0)
                  .add(new go.PathSegment(go.PathSegment.Line, w, 0))
                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, h))
                  .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()));
    } else {  // param1 < 0
      geo.add(new go.PathFigure(0, 0)
                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, 0))
                  .add(new go.PathSegment(go.PathSegment.Line, w, h))
                  .add(new go.PathSegment(go.PathSegment.Line, indent, h).close()));
    }
    if (indent < w / 2) {
      geo.setSpots(indent / w, 0, (w - indent) / w, 1);
    }
    return geo;
  }
});
 
go.Shape.defineFigureGenerator("Parallelogram", "Parallelogram1");
 
go.Shape.setFigureParameter("Trapezoid1", 0, new FigureParameter("Indent", 10, -Infinity, Infinity));
go.Shape.defineFigureGenerator("Trapezoid1", function(shape, w, h) {
  var param1 = shape ? shape.parameter1 : NaN;
  // Distance from topleft of bounding rectangle,
  // in % of the total width, of the topleft corner
  if (isNaN(param1)) param1 = 10; // default value
  else if (param1 < -w) param1 = -w/2;
  else if (param1 > w) param1 = w/2;
  var indent = Math.abs(param1);
 
  if (param1 === 0) {
    var geo = new go.Geometry(go.Geometry.Rectangle);
    geo.startX = 0;
    geo.startY = 0;
    geo.endX = w;
    geo.endY = h;
    return geo;
  } else {
    var geo = new go.Geometry();
    if (param1 > 0) {
      geo.add(new go.PathFigure(indent, 0)
                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, 0))
                  .add(new go.PathSegment(go.PathSegment.Line, w, h))
                  .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()));
    } else {  // param1 < 0
      geo.add(new go.PathFigure(0, 0)
                  .add(new go.PathSegment(go.PathSegment.Line, w, 0))
                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, h))
                  .add(new go.PathSegment(go.PathSegment.Line, indent, h).close()));
    }
    if (indent < w / 2) {
      geo.setSpots(indent / w, 0, (w - indent) / w, 1);
    }
    return geo;
  }
});
 
go.Shape.setFigureParameter("Trapezoid2", 0, new FigureParameter("IndentFraction", 0.2, -0.999, 0.999));
go.Shape.defineFigureGenerator("Trapezoid2", function(shape, w, h) {
  var param1 = shape ? shape.parameter1 : NaN;
  // Distance from topleft of bounding rectangle,
  // in % of the total width, of the topleft corner
  if (isNaN(param1)) param1 = 0.2; // default value
  else if (param1 < 0.5) param1 = -0.5;
  else if (param1 > 0.5) param1 = 0.5;
  var indent = Math.abs(param1) * w;
 
  if (param1 === 0) {
    var geo = new go.Geometry(go.Geometry.Rectangle);
    geo.startX = 0;
    geo.startY = 0;
    geo.endX = w;
    geo.endY = h;
    return geo;
  } else {
    var geo = new go.Geometry();
    if (param1 > 0) {
      geo.add(new go.PathFigure(indent, 0)
                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, 0))
                  .add(new go.PathSegment(go.PathSegment.Line, w, h))
                  .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()));
    } else {  // param1 < 0
      geo.add(new go.PathFigure(0, 0)
                  .add(new go.PathSegment(go.PathSegment.Line, w, 0))
                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, h))
                  .add(new go.PathSegment(go.PathSegment.Line, indent, h).close()));
    }
    if (indent < w / 2) {
      geo.setSpots(indent / w, 0, (w - indent) / w, 1);
    }
    return geo;
  }
});
 
go.Shape.setFigureParameter("ManualOperation", 0, new FigureParameter("Indent", 10, -Infinity, Infinity));
go.Shape.defineFigureGenerator("ManualOperation", function(shape, w, h) {
  var param1 = shape ? shape.parameter1 : NaN;
  // Distance from topleft of bounding rectangle,
  // in % of the total width, of the topleft corner
  if (isNaN(param1)) param1 = 10; // default value
  else if (param1 < -w) param1 = -w / 2;
  else if (param1 > w) param1 = w / 2;
  var indent = Math.abs(param1);
 
  if (param1 === 0) {
    var geo = new go.Geometry(go.Geometry.Rectangle);
    geo.startX = 0;
    geo.startY = 0;
    geo.endX = w;
    geo.endY = h;
    return geo;
  } else {
    var geo = new go.Geometry();
    if (param1 > 0) {
      geo.add(new go.PathFigure(0, 0)
                  .add(new go.PathSegment(go.PathSegment.Line, w, 0))
                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, h))
                  .add(new go.PathSegment(go.PathSegment.Line, indent, h).close()));
    } else {  // param1 < 0
      geo.add(new go.PathFigure(indent, 0)
                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, 0))
                  .add(new go.PathSegment(go.PathSegment.Line, w, h))
                  .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()));
    }
    if (indent < w / 2) {
      geo.setSpots(indent / w, 0, (w - indent) / w, 1);
    }
    return geo;
  }
});
 
go.Shape.defineFigureGenerator("Trapezoid", "Trapezoid1");
 
 
// The following functions are used by a group of regular figures that are defined below:
 
/** @ignore */
var _CachedArrays = [];
 
/**
  * @ignore
  * @return {Array}
  */
function tempArray() {
  var temp = _CachedArrays.pop();
  if (temp === undefined) return [];
  return temp;
};
 
/**
  * @ignore
  * @param {Array} a
  */
function freeArray(a) {
  a.length = 0;  // clear any references to objects
  _CachedArrays.push(a);
};
 
 
/**
* @ignore
* This allocates a temporary Array that should be freeArray()'ed by the caller.
* @param {number} sides
* @return {Array}
*/
function createPolygon(sides) {
  // Point[] points = new Point[sides + 1];
  var points = tempArray();
  var radius = .5;
  var center = .5;
  var offsetAngle = Math.PI * 1.5;
  var angle = 0;
 
  // Loop through each side of the polygon
  for (var i = 0; i < sides; i++) {
    angle = 2 * Math.PI / sides * i + offsetAngle;
    points[i] = new go.Point((center + radius * Math.cos(angle)), (center + radius * Math.sin(angle)));
  }
 
  // Add the last line
  // points[points.length - 1] = points[0];
  points.push(points[0]);
  return points;
};
 
/**
* @ignore
* This allocates a temporary Array that should be freeArray()'ed by the caller.
* @param {number} points
* @return {Array}
*/
function createBurst(points) {
  var star = createStar(points);
  var pts = tempArray(); // new Point[points * 3 + 1];
 
  pts[0] = star[0];
  for (var i = 1, count = 1; i < star.length; i += 2, count += 3) {
    pts[count] = star[i];
    pts[count + 1] = star[i];
    pts[count + 2] = star[i + 1];
  }
 
  freeArray(star);
  return pts;
};
 
/**
* @ignore
* This allocates a temporary Array that should be freeArray()'ed by the caller.
* @param {number} points
* @return {Array}
*/
function createStar(points) {
  // First, create a regular polygon
  var polygon = createPolygon(points);
  // Calculate the points inbetween
  var pts = tempArray(); // new Point[points * 2 + 1];
 
  var half = Math.floor(polygon.length / 2);
  var count = polygon.length - 1;
  var offset = (points % 2 === 0) ? 2 : 1;
 
  for (var i = 0; i < count; i++) {
    // Get the intersection of two lines
    var p0 = polygon[i];
    var p1 = polygon[i + 1];
    var q21 = polygon[(half + i - 1) % count];
    var q2off = polygon[(half + i + offset) % count];
    pts[i * 2] = p0;
    pts[i * 2 + 1] = getIntersection(p0.x, p0.y,
      q21.x, q21.y,
      p1.x, p1.y,
      q2off.x, q2off.y, new go.Point());  // ?? not currently managed
  }
 
  pts[pts.length] = pts[0];
 
  freeArray(polygon);
  return pts;
};
 
 
go.Shape.defineFigureGenerator("Pentagon", function(shape, w, h) {
  var points = createPolygon(5);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < 5; i++) {
    fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));
  }
  fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());
  freeArray(points);
  geo.spot1 = new go.Spot(.2, .22);
  geo.spot2 = new go.Spot(.8, .9);
  return geo;
});
 
go.Shape.defineFigureGenerator("Hexagon", function(shape, w, h) {
  var points = createPolygon(6);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < 6; i++) {
    fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));
  }
  fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());
  freeArray(points);
  geo.spot1 = new go.Spot(.07, .25);
  geo.spot2 = new go.Spot(.93, .75);
  return geo;
});
 
go.Shape.defineFigureGenerator("Heptagon", function(shape, w, h) {
  var points = createPolygon(7);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < 7; i++) {
    fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));
  }
  fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());
  freeArray(points);
  geo.spot1 = new go.Spot(.2, .15);
  geo.spot2 = new go.Spot(.8, .85);
  return geo;
});
 
go.Shape.defineFigureGenerator("Octagon", function(shape, w, h) {
  var points = createPolygon(8);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < 8; i++) {
    fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));
  }
  fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());
  freeArray(points);
  geo.spot1 = new go.Spot(.15, .15);
  geo.spot2 = new go.Spot(.85, .85);
  return geo;
});
 
go.Shape.defineFigureGenerator("Nonagon", function(shape, w, h) {
  var points = createPolygon(9);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < 9; i++) {
    fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));
  }
  fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());
  freeArray(points);
  geo.spot1 = new go.Spot(.17, .13);
  geo.spot2 = new go.Spot(.82, .82);
  return geo;
});
 
go.Shape.defineFigureGenerator("Decagon", function(shape, w, h) {
  var points = createPolygon(10);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < 10; i++) {
    fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));
  }
  fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());
  freeArray(points);
  geo.spot1 = new go.Spot(.16, .16);
  geo.spot2 = new go.Spot(.84, .84);
  return geo;
});
 
go.Shape.defineFigureGenerator("Dodecagon", function(shape, w, h) {
  var points = createPolygon(12);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < 12; i++) {
    fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));
  }
  fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());
  freeArray(points);
  geo.spot1 = new go.Spot(.16, .16);
  geo.spot2 = new go.Spot(.84, .84);
  return geo;
});
 
go.Shape.defineFigureGenerator("FivePointedStar", function(shape, w, h) {
  var starPoints = createStar(5);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(starPoints[0].x * w, starPoints[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < 10; i++) {
    fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[i].x * w, starPoints[i].y * h));
  }
  fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[0].x * w, starPoints[0].y * h).close());
  freeArray(starPoints);
  geo.spot1 = new go.Spot(.266, .333);
  geo.spot2 = new go.Spot(.733, .733);
  return geo;
});
 
go.Shape.defineFigureGenerator("SixPointedStar", function(shape, w, h) {
  var starPoints = createStar(6);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(starPoints[0].x * w, starPoints[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < 12; i++) {
    fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[i].x * w, starPoints[i].y * h));
  }
  fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[0].x * w, starPoints[0].y * h).close());
  freeArray(starPoints);
  geo.spot1 = new go.Spot(.17, .25);
  geo.spot2 = new go.Spot(.83, .75);
  return geo;
});
 
go.Shape.defineFigureGenerator("SevenPointedStar", function(shape, w, h) {
  var starPoints = createStar(7);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(starPoints[0].x * w, starPoints[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < 14; i++) {
    fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[i].x * w, starPoints[i].y * h));
  }
  fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[0].x * w, starPoints[0].y * h).close());
  freeArray(starPoints);
  geo.spot1 = new go.Spot(.222, .277);
  geo.spot2 = new go.Spot(.777, .666);
  return geo;
});
 
go.Shape.defineFigureGenerator("EightPointedStar", function(shape, w, h) {
  var starPoints = createStar(8);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(starPoints[0].x * w, starPoints[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < 16; i++) {
    fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[i].x * w, starPoints[i].y * h));
  }
  fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[0].x * w, starPoints[0].y * h).close());
  freeArray(starPoints);
  geo.spot1 = new go.Spot(.25, .25);
  geo.spot2 = new go.Spot(.75, .75);
  return geo;
});
 
go.Shape.defineFigureGenerator("NinePointedStar", function(shape, w, h) {
  var starPoints = createStar(9);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(starPoints[0].x * w, starPoints[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < 18; i++) {
    fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[i].x * w, starPoints[i].y * h));
  }
  fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[0].x * w, starPoints[0].y * h).close());
  freeArray(starPoints);
  geo.spot1 = new go.Spot(.222, .277);
  geo.spot2 = new go.Spot(.777, .666);
  return geo;
});
 
go.Shape.defineFigureGenerator("TenPointedStar", function(shape, w, h) {
  var starPoints = createStar(10);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(starPoints[0].x * w, starPoints[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < 20; i++) {
    fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[i].x * w, starPoints[i].y * h));
  }
  fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[0].x * w, starPoints[0].y * h).close());
  freeArray(starPoints);
  geo.spot1 = new go.Spot(.281, .261);
  geo.spot2 = new go.Spot(.723, .748);
  return geo;
});
 
go.Shape.defineFigureGenerator("FivePointedBurst", function(shape, w, h) {
  var burstPoints = createBurst(5);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(burstPoints[0].x * w, burstPoints[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < burstPoints.length; i += 3) {
    fig.add(new go.PathSegment(go.PathSegment.Bezier, burstPoints[i + 2].x * w,
      burstPoints[i + 2].y * h, burstPoints[i].x * w,
      burstPoints[i].y * h, burstPoints[i + 1].x * w,
      burstPoints[i + 1].y * h));
  }
  fig.segments.last().close();
  freeArray(burstPoints);
  geo.spot1 = new go.Spot(.222, .277);
  geo.spot2 = new go.Spot(.777, .777);
  return geo;
});
 
go.Shape.defineFigureGenerator("SixPointedBurst", function(shape, w, h) {
  var burstPoints = createBurst(6);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(burstPoints[0].x * w, burstPoints[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < burstPoints.length; i += 3) {
    fig.add(new go.PathSegment(go.PathSegment.Bezier, burstPoints[i + 2].x * w,
      burstPoints[i + 2].y * h, burstPoints[i].x * w,
      burstPoints[i].y * h, burstPoints[i + 1].x * w,
      burstPoints[i + 1].y * h));
  }
  fig.segments.last().close();
  freeArray(burstPoints);
  geo.spot1 = new go.Spot(.170, .222);
  geo.spot2 = new go.Spot(.833, .777);
  return geo;
});
 
go.Shape.defineFigureGenerator("SevenPointedBurst", function(shape, w, h) {
  var burstPoints = createBurst(7);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(burstPoints[0].x * w, burstPoints[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < burstPoints.length; i += 3) {
    fig.add(new go.PathSegment(go.PathSegment.Bezier, burstPoints[i + 2].x * w,
      burstPoints[i + 2].y * h, burstPoints[i].x * w,
      burstPoints[i].y * h, burstPoints[i + 1].x * w,
      burstPoints[i + 1].y * h));
  }
  fig.segments.last().close();
  freeArray(burstPoints);
  geo.spot1 = new go.Spot(.222, .222);
  geo.spot2 = new go.Spot(.777, .777);
  return geo;
});
 
go.Shape.defineFigureGenerator("EightPointedBurst", function(shape, w, h) {
  var burstPoints = createBurst(8);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(burstPoints[0].x * w, burstPoints[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < burstPoints.length; i += 3) {
    fig.add(new go.PathSegment(go.PathSegment.Bezier, burstPoints[i + 2].x * w,
      burstPoints[i + 2].y * h, burstPoints[i].x * w,
      burstPoints[i].y * h, burstPoints[i + 1].x * w,
      burstPoints[i + 1].y * h));
  }
  fig.segments.last().close();
  freeArray(burstPoints);
  geo.spot1 = new go.Spot(.222, .222);
  geo.spot2 = new go.Spot(.777, .777);
  return geo;
});
 
go.Shape.defineFigureGenerator("NinePointedBurst", function(shape, w, h) {
  var burstPoints = createBurst(9);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(burstPoints[0].x * w, burstPoints[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < burstPoints.length; i += 3) {
    fig.add(new go.PathSegment(go.PathSegment.Bezier, burstPoints[i + 2].x * w,
      burstPoints[i + 2].y * h, burstPoints[i].x * w,
      burstPoints[i].y * h, burstPoints[i + 1].x * w,
      burstPoints[i + 1].y * h));
  }
  fig.segments.last().close();
  freeArray(burstPoints);
  geo.spot1 = new go.Spot(.222, .222);
  geo.spot2 = new go.Spot(.777, .777);
  return geo;
});
 
go.Shape.defineFigureGenerator("TenPointedBurst", function(shape, w, h) {
  var burstPoints = createBurst(10);
  var geo = new go.Geometry();
  var fig = new go.PathFigure(burstPoints[0].x * w, burstPoints[0].y * h, true);
  geo.add(fig);
 
  for (var i = 1; i < burstPoints.length; i += 3) {
    fig.add(new go.PathSegment(go.PathSegment.Bezier, burstPoints[i + 2].x * w,
      burstPoints[i + 2].y * h, burstPoints[i].x * w,
      burstPoints[i].y * h, burstPoints[i + 1].x * w,
      burstPoints[i + 1].y * h));
  }
  fig.segments.last().close();
  freeArray(burstPoints);
  geo.spot1 = new go.Spot(.222, .222);
  geo.spot2 = new go.Spot(.777, .777);
  return geo;
});
 
 
 
go.Shape.setFigureParameter("FramedRectangle", 0, new FigureParameter("ThicknessX", 8));
go.Shape.setFigureParameter("FramedRectangle", 1, new FigureParameter("ThicknessY", 8));
go.Shape.defineFigureGenerator("FramedRectangle", function(shape, w, h) {
  var param1 = shape ? shape.parameter1 : NaN;
  var param2 = shape ? shape.parameter2 : NaN;
  if (isNaN(param1)) param1 = 8; // default values PARAMETER 1 is for WIDTH
  if (isNaN(param2)) param2 = 8; // default values PARAMETER 2 is for HEIGHT
 
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
  // outer rectangle, clockwise
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  if (param1 < w/2 && param2 < h/2) {
    // inner rectangle, counter-clockwise
    fig.add(new go.PathSegment(go.PathSegment.Move, param1, param2));  // subpath
    fig.add(new go.PathSegment(go.PathSegment.Line, param1, h - param2));
    fig.add(new go.PathSegment(go.PathSegment.Line, w - param1, h - param2));
    fig.add(new go.PathSegment(go.PathSegment.Line, w - param1, param2).close());
  }
  geo.setSpots(0, 0, 1, 1, param1, param2, -param1, -param2);
  return geo;
});
 
go.Shape.setFigureParameter("Ring", 0, new FigureParameter("Thickness", 8));
go.Shape.defineFigureGenerator("Ring", function(shape, w, h) {
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1) || param1 < 0) param1 = 8;
  
  var rad = w / 2;
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w, w / 2, true);  // clockwise
  geo.add(fig);
  fig.add(new go.PathSegment(go.PathSegment.Arc, 0, 360, rad, rad, rad, rad).close());
 
  var rad2 = Math.max(rad - param1, 0);
  if (rad2 > 0) {  // counter-clockwise
    fig.add(new go.PathSegment(go.PathSegment.Move, w / 2 + rad2, w / 2))
    fig.add(new go.PathSegment(go.PathSegment.Arc, 0, -360, rad, rad, rad2, rad2).close());
  }
  geo.spot1 = GeneratorEllipseSpot1;
  geo.spot2 = GeneratorEllipseSpot2;
  geo.defaultStretch = go.GraphObject.Uniform;
  return geo;
});
 
go.Shape.defineFigureGenerator("Cloud", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(.08034461 * w, .1944299 * h, true)
              .add(new go.PathSegment(go.PathSegment.Bezier,
                                      .2008615 * w, .05349299 * h, -.09239631 * w, .07836421 * h, .1406031 * w, -.0542823 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier,
                                      .4338609 * w, .074219 * h, .2450511 * w, -.00697547 * h, .3776197 * w, -.01112067 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier,
                                      .6558228 * w, .07004196 * h, .4539471 * w, 0, .6066018 * w, -.02526587 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier,
                                      .8921095 * w, .08370865 * h, .6914277 * w, -.01904177 * h, .8921095 * w, -.01220843 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier,
                                      .9147671 * w, .3194596 * h, 1.036446 * w, .04105738 * h, 1.020377 * w, .3022052 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier,
                                      .9082935 * w, .562044 * h, 1.04448 * w, .360238 * h, .992256 * w, .5219009 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier,
                                      .9212406 * w, .8217117 * h, 1.032337 * w, .5771781 * h, 1.018411 * w, .8120651 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier,
                                      .7592566 * w, .9156953 * h, 1.028411 * w, .9571472 * h, .8556702 * w, 1.052487 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier,
                                      .5101666 * w, .9310455 * h, .7431877 * w, 1.009325 * h, .5624123 * w, 1.021761 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier,
                                      .2609328 * w, .9344623 * h, .4820677 * w, 1.031761 * h, .3030112 * w, 1.002796 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier,
                                      .08034461 * w, .870098 * h, .2329994 * w, 1.01518 * h, .03213784 * w, 1.01518 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier,
                                      .06829292 * w, .6545475 * h, -.02812061 * w, .9032597 * h, -.01205169 * w, .6835638 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier,
                                      .06427569 * w, .4265613 * h, -.01812061 * w, .6089503 * h, -.00606892 * w, .4555777 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier,
                                      .08034461 * w, .1944299 * h, -.01606892 * w, .3892545 * h, -.01205169 * w, .1944299 * h)))
         .setSpots(.1, .1, .9, .9);
});
 
go.Shape.defineFigureGenerator("StopSign", function(shape, w, h) {
  var part = 1 / (Math.SQRT2 + 2);
  return new go.Geometry()
         .add(new go.PathFigure(part * w, 0, true)
              .add(new go.PathSegment(go.PathSegment.Line, (1 - part) * w, 0))
              .add(new go.PathSegment(go.PathSegment.Line, w, part * h))
              .add(new go.PathSegment(go.PathSegment.Line, w, (1 - part) * h))
              .add(new go.PathSegment(go.PathSegment.Line, (1 - part) * w, h))
              .add(new go.PathSegment(go.PathSegment.Line, part * w, h))
              .add(new go.PathSegment(go.PathSegment.Line, 0, (1 - part) * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0, part * h).close()))
         .setSpots(part / 2, part / 2, 1 - part / 2, 1 - part / 2);
});
 
go.Shape.setFigureParameter("Pie", 0, new FigureParameter("Start", 0, -360, 360));
go.Shape.setFigureParameter("Pie", 1, new FigureParameter("Sweep", 315, -360, 360));
go.Shape.defineFigureGenerator("Pie", function(shape, w, h) {
  var param1 = shape ? shape.parameter1 : NaN;
  var param2 = shape ? shape.parameter2 : NaN;
  if (isNaN(param1)) param1 = 0; // default values PARAMETER 1 is for Start Angle
  if (isNaN(param2)) param2 = 315; // default values PARAMETER 2 is for Sweep Angle
 
  var start = param1 % 360;
  if (start < 0) start += 360;
  var sweep = param2 % 360;
  var rad = Math.min(w, h) / 2;
 
  return new go.Geometry()
        .add(new go.PathFigure(rad, rad)  // start point
             .add(new go.PathSegment(go.PathSegment.Arc,
                                     start, sweep,  // angles
                                     rad, rad,  // center
                                     rad, rad)  // radius
                  .close()));
});
 
go.Shape.setFigureParameter("ThickCross", 0, new FigureParameter("Thickness", 30));
go.Shape.defineFigureGenerator("ThickCross", function(shape, w, h) {
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1) || param1 < 0) param1 = 30;
 
  var t = Math.min(param1, w) / 2;
  var mx = w / 2;
  var my = h / 2;
 
  return new go.Geometry()
         .add(new go.PathFigure(mx - t, 0, true)
              .add(new go.PathSegment(go.PathSegment.Line, mx + t, 0))
              .add(new go.PathSegment(go.PathSegment.Line, mx + t, my - t))
 
              .add(new go.PathSegment(go.PathSegment.Line, w, my - t))
              .add(new go.PathSegment(go.PathSegment.Line, w, my + t))
              .add(new go.PathSegment(go.PathSegment.Line, mx + t, my + t))
 
              .add(new go.PathSegment(go.PathSegment.Line, mx + t, h))
              .add(new go.PathSegment(go.PathSegment.Line, mx - t, h))
              .add(new go.PathSegment(go.PathSegment.Line, mx - t, my + t))
 
              .add(new go.PathSegment(go.PathSegment.Line, 0, my + t))
              .add(new go.PathSegment(go.PathSegment.Line, 0, my - t))
              .add(new go.PathSegment(go.PathSegment.Line, mx - t, my - t).close()));
});
 
go.Shape.setFigureParameter("ThinCross", 0, new FigureParameter("Thickness", 10));
go.Shape.defineFigureGenerator("ThinCross", function(shape, w, h) {
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1) || param1 < 0) param1 = 10;
 
  var t = Math.min(param1, w) / 2;
  var mx = w / 2;
  var my = h / 2;
 
  return new go.Geometry()
         .add(new go.PathFigure(mx - t, 0, true)
              .add(new go.PathSegment(go.PathSegment.Line, mx + t, 0))
              .add(new go.PathSegment(go.PathSegment.Line, mx + t, my - t))
 
              .add(new go.PathSegment(go.PathSegment.Line, w, my - t))
              .add(new go.PathSegment(go.PathSegment.Line, w, my + t))
              .add(new go.PathSegment(go.PathSegment.Line, mx + t, my + t))
 
              .add(new go.PathSegment(go.PathSegment.Line, mx + t, h))
              .add(new go.PathSegment(go.PathSegment.Line, mx - t, h))
              .add(new go.PathSegment(go.PathSegment.Line, mx - t, my + t))
 
              .add(new go.PathSegment(go.PathSegment.Line, 0, my + t))
              .add(new go.PathSegment(go.PathSegment.Line, 0, my - t))
              .add(new go.PathSegment(go.PathSegment.Line, mx - t, my - t).close()));
});
 
 
go.Shape.setFigureParameter("ThickX", 0, new FigureParameter("Thickness", 30));
go.Shape.defineFigureGenerator("ThickX", function(shape, w, h) {
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1) || param1 < 0) param1 = 30;
  if (w === 0 || h === 0) {
    var geo = new go.Geometry(go.Geometry.Rectangle);
    geo.startX = 0;
    geo.startY = 0;
    geo.endX = w;
    geo.endY = h;
    return geo;
  } else {
    var w2 = w / 2;
    var h2 = h / 2;
    var a2 = Math.atan2(h, w);
    var dx = param1 - Math.min(Math.cos(a2) * param1/2, w2);
    var dy = param1 - Math.min(Math.sin(a2) * param1/2, h2);
    var geo = new go.Geometry();
    var fig = new go.PathFigure(dx, 0, true);
    geo.add(fig);
  
    fig.add(new go.PathSegment(go.PathSegment.Line, w2, .2 * h));
    fig.add(new go.PathSegment(go.PathSegment.Line, w-dx, 0));
    fig.add(new go.PathSegment(go.PathSegment.Line, w, dy));
    fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, h2));
    fig.add(new go.PathSegment(go.PathSegment.Line, w, h-dy));
    fig.add(new go.PathSegment(go.PathSegment.Line, w-dx, h));
    fig.add(new go.PathSegment(go.PathSegment.Line, w2, .8 * h));
    fig.add(new go.PathSegment(go.PathSegment.Line, dx, h));
    fig.add(new go.PathSegment(go.PathSegment.Line, 0, h-dy));
    fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h2));
    fig.add(new go.PathSegment(go.PathSegment.Line, 0, dy).close());
    return geo;
  }
});
 
go.Shape.setFigureParameter("ThinX", 0, new FigureParameter("Thickness", 10));
go.Shape.defineFigureGenerator("ThinX", function(shape, w, h) {
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1) || param1 < 0) param1 = 10;
  var geo = new go.Geometry();
  var fig = new go.PathFigure(.1 * w, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .4 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .6 * w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .6 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .4 * w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .1 * h).close());
  return geo;
});
 
// adjust the width of the vertical beam
go.Shape.setFigureParameter("SquareIBeam", 0, new FigureParameter("BeamWidth", 0.2, 0.1, 0.9));
go.Shape.defineFigureGenerator("SquareIBeam", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  // Width of the ibeam in % of the total width
  if (isNaN(param1)) param1 = .2;
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  var fig = new go.PathFigure(0, 0, true);
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, param1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, (.5 + param1 / 2) * w, param1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, (.5 + param1 / 2) * w, (1 - param1) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, (1 - param1) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, (1 - param1) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, (.5 - param1 / 2) * w, (1 - param1) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, (.5 - param1 / 2) * w, param1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, param1 * h).close());
  return geo;
});
 
// parameter allows it easy to adjust the roundness of the curves that cut inward
go.Shape.setFigureParameter("RoundedIBeam", 0, new FigureParameter("SideCurved", .5, .05, .65));
go.Shape.defineFigureGenerator("RoundedIBeam", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = .5; // default value of Parameter1
  // Parameter 1 is based off of the width
  // I guess I will call it "curved"
  // param=.5 = 50% curved
  // .65 has to be the max
  // .05 has to be min, starts to loose roundesss after that
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0)); // top bar
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, h, Math.abs((1 - param1)) * w, .25 * h,
  Math.abs((1 - param1)) * w, .75 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, param1 * w, .75 * h,
  param1 * w, .25 * h).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("HalfEllipse", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, 0, true)
              .add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, KAPPA * w, 0, w, (.5 - KAPPA / 2) * h))
              .add(new go.PathSegment(go.PathSegment.Bezier, 0, h, w, (.5 + KAPPA / 2) * h, KAPPA * w, h).close()))
         .setSpots(0, 0.156, 0.844, 0.844);
});
 
go.Shape.defineFigureGenerator("Crescent", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, 0, true)
              .add(new go.PathSegment(go.PathSegment.Bezier,
                                      0, h, w, 0, w, h))
              .add(new go.PathSegment(go.PathSegment.Bezier,
                                      0, 0, 0.5 * w, 0.75 * h, 0.5 * w, 0.25 * h).close()))
         .setSpots(.311, 0.266, 0.744, 0.744);
});
 
go.Shape.defineFigureGenerator("Heart", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(.5 * w, h, true)
              .add(new go.PathSegment(go.PathSegment.Bezier, 0, .3 * h, .1 * w, .8 * h, 0, .5 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .3 * h, 0, 0, .45 * w, 0))
              .add(new go.PathSegment(go.PathSegment.Bezier, w, .3 * h, .55 * w, 0, w, 0))
              .add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h, w, .5 * h, .9 * w, .8 * h).close()))
         .setSpots(.14, .29, .86, .78);
});
 
go.Shape.defineFigureGenerator("Spade", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(.5 * w, 0, true)
              .add(new go.PathSegment(go.PathSegment.Line, .51 * w, .01 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, .6 * w, .2 * h, w, .25 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier, .55 * w, .7 * h, w, .8 * h, .6 * w, .8 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier, .75 * w, h, .5 * w, .75 * h, .55 * w, .95 * h))
              .add(new go.PathSegment(go.PathSegment.Line, .25 * w, h))
              .add(new go.PathSegment(go.PathSegment.Bezier, .45 * w, .7 * h, .45 * w, .95 * h, .5 * w, .75 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier, 0, .5 * h, .4 * w, .8 * h, 0, .8 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier, .49 * w, .01 * h, 0, .25 * h, .4 * w, .2 * h).close()))
         .setSpots(.14, .26, .86, .78);
});
 
go.Shape.defineFigureGenerator("Club", function(shape, w, h) {
  var geo = new go.Geometry()
  var fig = new go.PathFigure(.4 * w, .6 * h, true);
  geo.add(fig);
  // Start the base
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .15 * w, h, .5 * w, .75 * h, .45 * w, .95 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .85 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .6 * w, .6 * h, .55 * w, .95 * h, .5 * w, .75 * h));
  // First circle:
  var r = .2; // radius
  var cx = .3; // offset from Center x
  var cy = 0; // offset from Center y
  var d = r * KAPPA;
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 + r + cy) * h,
    (.5 - r + cx) * w, (.5 + d + cy) * h,
    (.5 - d + cx) * w, (.5 + r + cy) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (1 - .5 + r + cx) * w, (.5 + cy) * h,
    (.5 + d + cx) * w, (.5 + r + cy) * h,
    (.5 + r + cx) * w, (.5 + d + cy) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 - r + cy) * h,
    (1 - .5 + r + cx) * w, (.5 - d + cy) * h,
    (.5 + d + cx) * w, (.5 - r + cy) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.65) * w, (0.36771243) * h,
    (.5 - d + cx) * w, (.5 - r + cy) * h,
    (.5 - r + cx + .05) * w, (.5 - d + cy - .02) * h));
  r = .2; // radius
  cx = 0; // offset from Center x
  cy = -.3; // offset from Center y
  d = r * KAPPA;
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (1 - .5 + r + cx) * w, (.5 + cy) * h,
    (.5 + d + cx) * w, (.5 + r + cy) * h,
    (.5 + r + cx) * w, (.5 + d + cy) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 - r + cy) * h,
    (1 - .5 + r + cx) * w, (.5 - d + cy) * h,
    (.5 + d + cx) * w, (.5 - r + cy) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 - r + cx) * w, (.5 + cy) * h,
    (.5 - d + cx) * w, (.5 - r + cy) * h,
    (.5 - r + cx) * w, (.5 - d + cy) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 - d + cx) * w, (.5 + r + cy) * h,
    (.5 - r + cx) * w, (.5 + d + cy) * h,
    (.5 - d + cx) * w, (.5 + r + cy) * h));
  r = .2; // radius
  cx = -.3; // offset from Center x
  cy = 0; // offset from Center y
  d = r * KAPPA;
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 - r + cy) * h,
    (1 - .5 + r + cx - .05) * w, (.5 - d + cy - .02) * h,
    (.5 + d + cx) * w, (.5 - r + cy) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 - r + cx) * w, (.5 + cy) * h,
    (.5 - d + cx) * w, (.5 - r + cy) * h,
    (.5 - r + cx) * w, (.5 - d + cy) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 + r + cy) * h,
    (.5 - r + cx) * w, (.5 + d + cy) * h,
    (.5 - d + cx) * w, (.5 + r + cy) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .4 * w, .6 * h,
    (.5 + d + cx) * w, (.5 + r + cy) * h,
    (.5 + r + cx) * w, (.5 + d + cy) * h).close());
  geo.setSpots(.06, .33, .93, .68);
  return geo;
});
 
go.Shape.defineFigureGenerator("YinYang", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w * 0.5, 0, true);
  geo.add(fig);
  // Right semi-circle
  fig.add(new go.PathSegment(go.PathSegment.Arc, 270, 180, w * 0.5, w * 0.5, w * 0.5, w * 0.5));
  // bottom semi-circle
  fig.add(new go.PathSegment(go.PathSegment.Arc, 90, -180, w * 0.5, w * 0.75, w * 0.25, w * 0.25));
  // top semi-circle
  fig.add(new go.PathSegment(go.PathSegment.Arc, 90, 180, w * 0.5, w * 0.25, w * 0.25, w * 0.25));
  var radius = .1;  // of the small circles
  var centerx = .5;
  var centery = .25;
  // Top small circle, goes counter-clockwise
  fig.add(new go.PathSegment(go.PathSegment.Move, (centerx + radius) * w, (centery) * h));
  fig.add(new go.PathSegment(go.PathSegment.Arc, 0, -360, w * centerx, h * centery, radius * w, radius * w).close()); // Right semi-circle
  // Left semi-circle
  fig = new go.PathFigure(w * 0.5, 0, false);
  geo.add(fig);
  fig.add(new go.PathSegment(go.PathSegment.Arc, 270, -180, w * 0.5, w * 0.5, w * 0.5, w * 0.5));
  centery = .75;
  // Bottom small circle
  fig = new go.PathFigure((centerx + radius) * w, (centery) * h, true); // Not a subpath
  geo.add(fig);
  fig.add(new go.PathSegment(go.PathSegment.Arc, 0, 360, w * centerx, h * centery, radius * w, radius * w).close()); // Right semi-circle
  geo.defaultStretch = go.GraphObject.Uniform;
  return geo;
});
 
go.Shape.defineFigureGenerator("Peace", function(shape, w, h) {
  var a = 1.0 - 0.1464466094067262;  // at 45 degrees
  var w2 = 0.5 * w;
  var h2 = 0.5 * h;
  return new go.Geometry()
         .add(new go.PathFigure(w2, 0, true)
              .add(new go.PathSegment(go.PathSegment.Arc, 270, 360, w2, h2, w2, h2))
              .add(new go.PathSegment(go.PathSegment.Line, w2, h))
              .add(new go.PathSegment(go.PathSegment.Move, w2, h2))
              .add(new go.PathSegment(go.PathSegment.Line, (1.0-a) * w, a * h))
              .add(new go.PathSegment(go.PathSegment.Move, w2, h2))
              .add(new go.PathSegment(go.PathSegment.Line, a * w, a * h)));
});
 
go.Shape.defineFigureGenerator("NotAllowed", function(shape, w, h) {
  var geo = new go.Geometry();
  var cpOffset = KAPPA * .5;
  var radius = .5;
  var centerx = .5;
  var centery = .5;
  var fig = new go.PathFigure(centerx * w, (centery - radius) * h);
  geo.add(fig);
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery - radius) * h,
      (centerx - radius) * w, (centery - cpOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h,
      (centerx - cpOffset) * w, (centery + radius) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery + radius) * h,
      (centerx + radius) * w, (centery + cpOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h,
      (centerx + cpOffset) * w, (centery - radius) * h));
  // Inner circle, composed of two parts, separated by
  // a beam across going from top-right to bottom-left.
  radius = .40;
  cpOffset = KAPPA * .40;
  // First we cut up the top right 90 degree curve into two smaller
  // curves.
  // Since its clockwise, StartOfArrow is the first of the two points
  // on the circle. EndOfArrow is the other one.
  var startOfArrowc1 = tempPoint();
  var startOfArrowc2 = tempPoint();
  var startOfArrow = tempPoint();
  var unused = tempPoint();
  breakUpBezier(centerx, centery - radius,
      centerx + cpOffset, centery - radius,
      centerx + radius, centery - cpOffset,
      centerx + radius, centery, .42, startOfArrowc1,
      startOfArrowc2, startOfArrow, unused, unused);
  var endOfArrowc1 = tempPoint();
  var endOfArrowc2 = tempPoint();
  var endOfArrow = tempPoint();
  breakUpBezier(centerx, centery - radius,
      centerx + cpOffset, centery - radius,
      centerx + radius, centery - cpOffset,
      centerx + radius, centery, .58, unused,
      unused, endOfArrow, endOfArrowc1, endOfArrowc2);
  // Cut up the bottom left 90 degree curve into two smaller curves.
  var startOfArrow2c1 = tempPoint();
  var startOfArrow2c2 = tempPoint();
  var startOfArrow2 = tempPoint();
  breakUpBezier(centerx, centery + radius,
      centerx - cpOffset, centery + radius,
      centerx - radius, centery + cpOffset,
      centerx - radius, centery, .42, startOfArrow2c1,
      startOfArrow2c2, startOfArrow2, unused, unused);
  var endOfArrow2c1 = tempPoint();
  var endOfArrow2c2 = tempPoint();
  var endOfArrow2 = tempPoint();
  breakUpBezier(centerx, centery + radius,
      centerx - cpOffset, centery + radius,
      centerx - radius, centery + cpOffset,
      centerx - radius, centery, .58, unused,
      unused, endOfArrow2, endOfArrow2c1, endOfArrow2c2);
  fig.add(new go.PathSegment(go.PathSegment.Move, endOfArrow2.x * w, endOfArrow2.y * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, endOfArrow2c1.x * w, endOfArrow2c1.y * h,
      endOfArrow2c2.x * w, endOfArrow2c2.y * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
      (centerx - cpOffset) * w, (centery - radius) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, startOfArrow.x * w, startOfArrow.y * h, startOfArrowc1.x * w, startOfArrowc1.y * h,
      startOfArrowc2.x * w, startOfArrowc2.y * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, endOfArrow2.x * w, endOfArrow2.y * h).close());
  fig.add(new go.PathSegment(go.PathSegment.Move, startOfArrow2.x * w, startOfArrow2.y * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, endOfArrow.x * w, endOfArrow.y * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, endOfArrowc1.x * w, endOfArrowc1.y * h,
      endOfArrowc2.x * w, endOfArrowc2.y * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
      (centerx + cpOffset) * w, (centery + radius) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, startOfArrow2.x * w, startOfArrow2.y * h, startOfArrow2c1.x * w, startOfArrow2c1.y * h,
      startOfArrow2c2.x * w, startOfArrow2c2.y * h).close());
  freePoint(startOfArrowc1);
  freePoint(startOfArrowc2);
  freePoint(startOfArrow);
  freePoint(unused);
  freePoint(endOfArrowc1);
  freePoint(endOfArrowc2);
  freePoint(endOfArrow);
  freePoint(startOfArrow2c1);
  freePoint(startOfArrow2c2);
  freePoint(startOfArrow2);
  freePoint(endOfArrow2c1);
  freePoint(endOfArrow2c2);
  freePoint(endOfArrow2);
  geo.defaultStretch = go.GraphObject.Uniform;
  return geo;
});
 
go.Shape.defineFigureGenerator("Fragile", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, 0, true)
              .add(new go.PathSegment(go.PathSegment.Line, .25 * w, 0))
              .add(new go.PathSegment(go.PathSegment.Line, .2 * w, .15 * h))
              .add(new go.PathSegment(go.PathSegment.Line, .3 * w, .25 * h))
              .add(new go.PathSegment(go.PathSegment.Line, .29 * w, .33 * h))
              .add(new go.PathSegment(go.PathSegment.Line, .35 * w, .25 * h))
              .add(new go.PathSegment(go.PathSegment.Line, .3 * w, .15 * h))
              .add(new go.PathSegment(go.PathSegment.Line, .4 * w, 0))
              .add(new go.PathSegment(go.PathSegment.Line, w, 0))
              // Left Side
              .add(new go.PathSegment(go.PathSegment.Bezier, .55 * w, .5 * h, w, .25 * h, .75 * w, .5 * h))
              .add(new go.PathSegment(go.PathSegment.Line, .55 * w, .9 * h))
              // The base
              .add(new go.PathSegment(go.PathSegment.Line, .7 * w, .9 * h))
              .add(new go.PathSegment(go.PathSegment.Line, .7 * w, h))
              .add(new go.PathSegment(go.PathSegment.Line, .3 * w, h))
              .add(new go.PathSegment(go.PathSegment.Line, .3 * w, .9 * h))
              // Right side
              .add(new go.PathSegment(go.PathSegment.Line, .45 * w, .9 * h))
              .add(new go.PathSegment(go.PathSegment.Line, .45 * w, .5 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, .25 * w, .5 * h, 0, .25 * h).close()));
});
 
go.Shape.setFigureParameter("HourGlass", 0, new FigureParameter("Thickness", 20));
go.Shape.defineFigureGenerator("HourGlass", function(shape, w, h) {
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1) || param1 < 0) param1 = 30; // default value for param1 
  var line1 = ((w - param1) / 2) + param1; // 35 + 30 = 65
  var line2 = ((w - param1) / 2); // 100 - 30 = 70/2 = 35
  return new go.Geometry()
         .add(new go.PathFigure(line1, 0.5 * h)  // This is the right side, this equals 65, (1 - param1) * w
              .add(new go.PathSegment(go.PathSegment.Line, w, h))
              .add(new go.PathSegment(go.PathSegment.Line, 0, h))
              .add(new go.PathSegment(go.PathSegment.Line, line2, 0.5 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0, 0))
              .add(new go.PathSegment(go.PathSegment.Line, w, 0).close()));
});
 
go.Shape.defineFigureGenerator("Lightning", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, 0.65 * h)
              .add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0))
              .add(new go.PathSegment(go.PathSegment.Line, 0.25 * w, 0.55 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.40 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.50 * h).close()));
});
 
go.Shape.defineFigureGenerator("GenderMale", function(shape, w, h) {
  var geo = new go.Geometry();
  var cpOffset = KAPPA * .4;
  var radius = .4;
  var centerx = .5;
  var centery = .5;
  var unused = tempPoint();
  var mid = tempPoint();
  var c1 = tempPoint();
  var c2 = tempPoint();
  var fig = new go.PathFigure((centerx - radius) * w, centery * h, false);
  geo.add(fig);
 
  // Outer circle
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
    (centerx - cpOffset) * w, (centery - radius) * h));
  breakUpBezier(centerx, centery - radius,
       centerx + cpOffset, centery - radius,
       centerx + radius, centery - cpOffset,
       centerx + radius, centery, .44, c1,
       c2, mid, unused, unused);
  fig.add(new go.PathSegment(go.PathSegment.Bezier, mid.x * w, mid.y * h, c1.x * w, c1.y * h, c2.x * w, c2.y * h));
  var startOfArrow = tempPointAt(mid.x, mid.y);
  breakUpBezier(centerx, centery - radius,
      centerx + cpOffset, centery - radius,
      centerx + radius, centery - cpOffset,
      centerx + radius, centery, .56, unused,
      unused, mid, c1, c2);
  var endOfArrow = tempPointAt(mid.x, mid.y);
  fig.add(new go.PathSegment(go.PathSegment.Line, (startOfArrow.x * .1 + .95 * .9) * w,
    (startOfArrow.y * .1) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .85 * w, (startOfArrow.y * .1) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .85 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .15 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, (endOfArrow.x * .1 + .9) * w, .15 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, (endOfArrow.x * .1 + .9) * w,
    (endOfArrow.y * .1 + .05 * .9) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, endOfArrow.x * w, endOfArrow.y * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, c1.x * w, c1.y * h, c2.x * w, c2.y * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
    (centerx - radius) * w, (centery + cpOffset) * h));
  // Inner circle
  radius = .35;
  cpOffset = KAPPA * .35;
  var fig2 = new go.PathFigure(centerx * w, (centery - radius) * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery - radius) * h,
    (centerx - radius) * w, (centery - cpOffset) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h,
    (centerx - cpOffset) * w, (centery + radius) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery + radius) * h,
    (centerx + radius) * w, (centery + cpOffset) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h,
    (centerx + cpOffset) * w, (centery - radius) * h));
  var fig3 = new go.PathFigure((centerx - radius) * w, centery * h, false);
  geo.add(fig3);
  freePoint(unused);
  freePoint(mid);
  freePoint(c1);
  freePoint(c2);
  freePoint(startOfArrow);
  freePoint(endOfArrow);
  geo.spot1 = new go.Spot(.202, .257);
  geo.spot2 = new go.Spot(.792, .739);
  geo.defaultStretch = go.GraphObject.Uniform;
  return geo;
});
 
go.Shape.defineFigureGenerator("GenderFemale", function(shape, w, h) {
  var geo = new go.Geometry();
  // Outer Circle
  var r = .375; // radius
  var cx = 0; // offset from Center x
  var cy = -.125; // offset from Center y
  var d = r * KAPPA;
  var fig = new go.PathFigure((.525 + cx) * w, (.5 + r + cy) * h, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (1 - .5 + r + cx) * w, (.5 + cy) * h, (.5 + d + cx) * w, (.5 + r + cy) * h,
    (.5 + r + cx) * w, (.5 + d + cy) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 - r + cy) * h, (1 - .5 + r + cx) * w, (.5 - d + cy) * h,
    (.5 + d + cx) * w, (.5 - r + cy) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 - r + cx) * w, (.5 + cy) * h, (.5 - d + cx) * w, (.5 - r + cy) * h,
    (.5 - r + cx) * w, (.5 - d + cy) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.475 + cx) * w, (.5 + r + cy) * h, (.5 - r + cx) * w, (.5 + d + cy) * h,
    (.5 - d + cx) * w, (.5 + r + cy) * h));
  // Legs
  fig.add(new go.PathSegment(go.PathSegment.Line, .475 * w, .85 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .425 * w, .85 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .425 * w, .9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .475 * w, .9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .475 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .525 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .525 * w, .9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .575 * w, .9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .575 * w, .85 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .525 * w, .85 * h).close());
  // Inner circle
  r = .325; // radius
  cx = 0; // offset from Center x
  cy = -.125; // offset from Center y
  d = r * KAPPA;
  var fig = new go.PathFigure((1 - .5 + r + cx) * w, (.5 + cy) * h, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 + r + cy) * h, (.5 + r + cx) * w, (.5 + d + cy) * h,
    (.5 + d + cx) * w, (.5 + r + cy) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 - r + cx) * w, (.5 + cy) * h, (.5 - d + cx) * w, (.5 + r + cy) * h,
    (.5 - r + cx) * w, (.5 + d + cy) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 - r + cy) * h, (.5 - r + cx) * w, (.5 - d + cy) * h,
    (.5 - d + cx) * w, (.5 - r + cy) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (1 - .5 + r + cx) * w, (.5 + cy) * h, (.5 + d + cx) * w, (.5 - r + cy) * h,
    (1 - .5 + r + cx) * w, (.5 - d + cy) * h));
  var fig = new go.PathFigure((.525 + cx) * w, (.5 + r + cy) * h, false);
  geo.add(fig);
  geo.spot1 = new go.Spot(.232, .136);
  geo.spot2 = new go.Spot(.682, .611);
  geo.defaultStretch = go.GraphObject.Uniform;
  return geo;
});
 
go.Shape.defineFigureGenerator("LogicImplies", function(shape, w, h) {
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = .2;  // Distance the arrow folds from the right
  return new go.Geometry()
         .add(new go.PathFigure((1 - param1) * w, 0, false)
              .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h))
              .add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, h))
              .add(new go.PathSegment(go.PathSegment.Move, 0, .5 * h))
              .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h)))
         .setSpots(0, 0, 0.8, 0.5);
});
 
go.Shape.defineFigureGenerator("LogicIff", function(shape, w, h) {
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = .2; // Distance the arrow folds from the right
  return new go.Geometry()
         .add(new go.PathFigure((1 - param1) * w, 0, false)
              .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h))
              .add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, h))
              .add(new go.PathSegment(go.PathSegment.Move, 0, .5 * h))
              .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h))
              .add(new go.PathSegment(go.PathSegment.Move, param1 * w, 0))
              .add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h))
              .add(new go.PathSegment(go.PathSegment.Line, param1 * w, h)))
         .setSpots(0.2, 0, 0.8, 0.5);
});
 
go.Shape.defineFigureGenerator("LogicNot", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, 0, false)
              .add(new go.PathSegment(go.PathSegment.Line, w, 0))
              .add(new go.PathSegment(go.PathSegment.Line, w, h)));
});
 
go.Shape.defineFigureGenerator("LogicAnd", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, h, false)
              .add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0))
              .add(new go.PathSegment(go.PathSegment.Line, w, h)))
         .setSpots(0.25, 0.5, 0.75, 1);
});
 
go.Shape.defineFigureGenerator("LogicOr", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, 0, false)
              .add(new go.PathSegment(go.PathSegment.Line, .5 * w, h))
              .add(new go.PathSegment(go.PathSegment.Line, w, 0)))
         .setSpots(0.219, 0, 0.78, 0.409);
});
 
go.Shape.defineFigureGenerator("LogicXor", function(shape, w, h) {
  var geo = new go.Geometry()
         .add(new go.PathFigure(.5 * w, 0, false)
              .add(new go.PathSegment(go.PathSegment.Line, .5 * w, h))
              .add(new go.PathSegment(go.PathSegment.Move, 0, .5 * h))
              .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h))
              .add(new go.PathSegment(go.PathSegment.Arc, 0, 360, .5 * w, .5 * h, .5 * w, .5 * h)));
  geo.defaultStretch = go.GraphObject.Uniform;
  return geo;
});
 
go.Shape.defineFigureGenerator("LogicTruth", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, 0, false)
              .add(new go.PathSegment(go.PathSegment.Line, w, 0))
              .add(new go.PathSegment(go.PathSegment.Move, .5 * w, 0))
              .add(new go.PathSegment(go.PathSegment.Line, .5 * w, h)));
});
 
go.Shape.defineFigureGenerator("LogicFalsity", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, h, false)
              .add(new go.PathSegment(go.PathSegment.Line, w, h))
              .add(new go.PathSegment(go.PathSegment.Move, .5 * w, h))
              .add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0)));
});
 
go.Shape.defineFigureGenerator("LogicThereExists", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, 0, false)
              .add(new go.PathSegment(go.PathSegment.Line, w, 0))
              .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h))
              .add(new go.PathSegment(go.PathSegment.Move, w, .5 * h))
              .add(new go.PathSegment(go.PathSegment.Line, w, h))
              .add(new go.PathSegment(go.PathSegment.Line, 0, h)));
});
 
go.Shape.defineFigureGenerator("LogicForAll", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, 0, false)
              .add(new go.PathSegment(go.PathSegment.Line, .5 * w, h))
              .add(new go.PathSegment(go.PathSegment.Line, w, 0))
              .add(new go.PathSegment(go.PathSegment.Move, .25 * w, .5 * h))
              .add(new go.PathSegment(go.PathSegment.Line, .75 * w, .5 * h)))
         .setSpots(0.25, 0, 0.75, 0.5);
});
 
go.Shape.defineFigureGenerator("LogicIsDefinedAs", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, 0, false)
              .add(new go.PathSegment(go.PathSegment.Line, w, 0))
              .add(new go.PathSegment(go.PathSegment.Move, 0, .5 * h))
              .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h))
              .add(new go.PathSegment(go.PathSegment.Move, 0, h))
              .add(new go.PathSegment(go.PathSegment.Line, w, h)))
         .setSpots(0.01, 0.01, 0.99, 0.49);
});
 
go.Shape.defineFigureGenerator("LogicIntersect", function(shape, w, h) {
  var radius = 0.5;
  return new go.Geometry()
         .add(new go.PathFigure(0, h, false)
              .add(new go.PathSegment(go.PathSegment.Line, 0, radius * h))
              .add(new go.PathSegment(go.PathSegment.Arc, 180, 180, radius * w, radius * h, radius * w, radius * h))
              .add(new go.PathSegment(go.PathSegment.Line, w, h)))
         .setSpots(0, 0.5, 1, 1);
});
 
go.Shape.defineFigureGenerator("LogicUnion", function(shape, w, h) {
  var radius = 0.5;
  return new go.Geometry()
         .add(new go.PathFigure(w, 0, false)
              .add(new go.PathSegment(go.PathSegment.Line, w, radius * h))
              .add(new go.PathSegment(go.PathSegment.Arc, 0, 180, radius * w, radius * h, radius * w, radius * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0, 0)))
         .setSpots(0, 0, 1, 0.5);
});
 
go.Shape.defineFigureGenerator("Arrow", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  var param2 = shape ? shape.parameter2 : NaN;
  // % from the edge the ends of the arrow are
  if (isNaN(param1)) param1 = .3;
  // Arrow width
  if (isNaN(param2)) param2 = .3;
  var fig = new go.PathFigure(0, (.5 - param2 / 2) * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, (.5 - param2 / 2) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, (.5 + param2 / 2) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, (.5 + param2 / 2) * h).close());
  geo.spot1 = new go.Spot(0, .5 - param2 / 2);
  var temp = getIntersection(0, .5 + param2 / 2,
      1, .5 + param2 / 2,
      1 - param1, 1,
      1, .5,
      tempPoint());
  geo.spot2 = new go.Spot(temp.x, temp.y);
  freePoint(temp);
  return geo;
});
 
go.Shape.setFigureParameter("Arrow2", 0, new FigureParameter("LongHeight", 30));
go.Shape.defineFigureGenerator("Arrow2", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  var param2 = shape ? shape.parameter2 : NaN;
  // % from the edge the ends of the arrow are
  if (isNaN(param1)) param1 = .3;
  // Arrow width
  if (isNaN(param2)) param2 = 30; // 30 is the default value
  param2 = Math.min(param2, h/2);
  var lineWidth = 25;
  var line1 = ((h - param2) / 2) + param2; // 60
  var line2 = ((h - param2) / 2); // 100 - 24
  // 100 - 25 = 75
  // 75/2 = 37.5
  var fig = new go.PathFigure(0, line2, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, line2)); // ends at 56,28
  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, line1)); // height here matters
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, line1).close());
 
  return geo;
});
 
go.Shape.defineFigureGenerator("Chevron", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("DoubleArrow", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0.214 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 1.0 * w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 1.0 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0.786 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 1.0 * h).close());
  return geo;
});
 
// JC 
// added a new parameter to allow to adjust the connecter piece height
// might need to do something about the parameter min and max and make it more accesible
go.Shape.setFigureParameter("DoubleEndArrow", 0, new FigureParameter("ConnecterHeight", .7, .5, 1));
go.Shape.defineFigureGenerator("DoubleEndArrow", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = .7; // default value for param1
  var fig = new go.PathFigure(w, .5 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, param1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, param1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, (1 - param1) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, (1 - param1) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, 0).close());
  var temp = getIntersection(0, .5, .3, 0, 0, .3, .3, .3, tempPoint());  // ?? constant
  geo.spot1 = new go.Spot(temp.x, temp.y);
  temp = getIntersection(.7, 1, 1, .5, .7, .7, 1, .7, temp);  // ?? constant
  geo.spot2 = new go.Spot(temp.x, temp.y);
  freePoint(temp);
  return geo;
});
 
// JC
// this file is the same version as the one above only it uses absolute values
// ABSOLUTEValues
// this allows the user to set exact values
// set it to an exact value that willl NOT scale
// also allowing the user to edit the height of those two arrows
// JC Allowing to modify adjustment too
go.Shape.setFigureParameter("DoubleEndArrow2", 0, new FigureParameter("ConnecterHeight", 40));
go.Shape.setFigureParameter("DoubleEndArrow2", 1, new FigureParameter("ArrowPointerHeight", 70));
go.Shape.defineFigureGenerator("DoubleEndArrow2", function(shape, w, h) {
  // This is absolute 
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = 70; // default value for param1
  var param2 = shape ? shape.parameter2 : NaN;
  if (isNaN(param2)) param2 = 90; // default value for param2
  var fig = new go.PathFigure(w, .5 * h, true);
  geo.add(fig);
 
  // everything is based off of having things be 100 w and 100 h
  var lineThickness = 40;
  // param1 will represent the line thickness
  // lets say H = 100, w = 100
  // h - 40 = 60
  // 60/2 = 30. each length needs to be 30
  var line1 = ((h - param1) / 2) + param1; // 70
  var line2 = ((h - param1) / 2); // 30
  // With abolute value
  if (param1 > h) {
    // in attempts to leave the shape with the same proportions
    var newParamValue = h / param1; // this will be the proportion we try to recreate
    // h - newParamValue = 
    var newMiddle = h * newParamValue; // calculates how big the middle will be now
    // Using the same formula above, we recalculate with the value for the newMiddle instead of Param1
    line1 = ((h - newMiddle) / 2) + newMiddle;
    line2 = ((h - newMiddle) / 2);
  } else {
    var line1 = ((h - param1) / 2) + param1;
    var line2 = ((h - param1) / 2);
  };
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h)); // 70, 100
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, line1));
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, line1));
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, line2));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, line2));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, 0).close());
  var temp = getIntersection(0, .5, .3, 0, 0, .3, .3, .3, tempPoint());  // ?? constant
  geo.spot1 = new go.Spot(temp.x, temp.y);
  temp = getIntersection(.7, 1, 1, .5, .7, .7, 1, .7, temp);  // ?? constant
  geo.spot2 = new go.Spot(temp.x, temp.y);
  freePoint(temp);
  /*
  Backup in case i mess up
  var line1 = ((h - param1) /2) + param1;
  var line2 = ((h - param1) /2);
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, line1));
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, line1));
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, line2));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, line2));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, 0).close());
  var temp = getIntersection(0, .5, .3, 0, 0, .3, .3, .3, tempPoint());  // ?? constant
  geo.spot1 = new go.Spot(temp.x, temp.y);
  temp = getIntersection(.7, 1, 1, .5, .7, .7, 1, .7, temp);  // ?? constant
  geo.spot2 = new go.Spot(temp.x, temp.y);
  freePoint(temp);
  */
  return geo;
});
 
// JC 
// this parameter makes it possible for the user to set a width for a long edge of the IBeamArrow
// allows the user to adjust the vertical width of the long section, i might have to draw a diagram
go.Shape.setFigureParameter("IBeamArrow", 0, new FigureParameter("ArrowLengthWidth", .7, .51, .97));
// go.Shape.setFigureParameter("IBeamArrow", 1, new FigureParameter("ArrowBackSection"))    
go.Shape.defineFigureGenerator("IBeamArrow", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = .7; // default value is 0 for parameter
  var fig = new go.PathFigure(w, .5 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, param1 * h)); // 70
  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, param1 * h)); // bottom horizontal line
  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, 0));
  // above value is .7
  // below value is .3
  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, (1 - param1) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, (1 - param1) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, 0).close());
  geo.spot1 = new go.Spot(0, .3);
  var temp = getIntersection(.7, 1, 1, .5, .7, .7, 1, .7, tempPoint());  // ?? constant
  geo.spot2 = new go.Spot(temp.x, temp.y);
  freePoint(temp);
  return geo;
});
 
// JC
// recreating the same thing above only using absolute values to figure out the size of the long side
go.Shape.setFigureParameter("IBeamArrow2", 0, new FigureParameter("ArrowLengthWidth", 40));
// go.Shape.setFigureParameter("IBeamArrow2", 1, new FigureParameter("ArrowBackSection"))    
go.Shape.defineFigureGenerator("IBeamArrow2", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = 40; // default value is 0 for parameter
  var fig = new go.PathFigure(w, .5 * h, true);
  geo.add(fig);
 
  var line1 = ((h - param1) / 2) + param1; // 100 - 40 = 60/2 = 30 + 40 = 70
  var line2 = ((h - param1) / 2);
  if (param1 >= h) {
    // in attempts to leave the shape with the same proportions
    var newParamValue = h / param1; // this will be the proportion we try to recreate
    // h - newParamValue = 
    var newMiddle = h * newParamValue; // calculates how big the middle will be now
    // Using the same formula above, we recalculate with the value for the newMiddle instead of Param1
    line1 = ((h - newMiddle) / 2) + newMiddle;
    line2 = ((h - newMiddle) / 2);
  } else {
    var line1 = ((h - param1) / 2) + param1;
    var line2 = ((h - param1) / 2);
  };
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, line1));
  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, line1)); // bottom horizontal line
  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, 0));
  // above value is .7
  // below value is .3
  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, line2));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, line2));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, 0).close());
  geo.spot1 = new go.Spot(0, .3);
  var temp = getIntersection(.7, 1, 1, .5, .7, .7, 1, .7, tempPoint());  // ?? constant
  geo.spot2 = new go.Spot(temp.x, temp.y);
  freePoint(temp);
  return geo;
});
 
// JC
// go.Shape.setFigureParameter("Pointer", 0, new FigureParameter("BackPoint", 0.25, 0.1, 0.65));
// back point that cuts into the pointer
go.Shape.setFigureParameter("Pointer", 0, new FigureParameter("BackPoint", .2, 0, .2));
go.Shape.defineFigureGenerator("Pointer", function(shape, w, h) {
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = .1; // BackPoint Default Value
  // var param1 shape ? shape.parameter1 : NaN;
  // if (isNaN(param1)) param1 = .5;
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w, .5 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0).close());
  geo.spot1 = new go.Spot(.2, .35);
  var temp = getIntersection(.2, .65, 1, .65, 0, 1, 1, .5, tempPoint());  // ?? constant
  geo.spot2 = new go.Spot(temp.x, temp.y);
  freePoint(temp);
  return geo;
});
 
// JC - FigureParameter the steepness of the rounded edge 
// go.Shape.setFigureParameter("RoundedPointer", 0 new FigureParameter("RoundedEdged", 0, 0, 0));// ???
go.Shape.defineFigureGenerator("RoundedPointer", function(shape, w, h) {
  // var param1 = shape ? shape.parameter1 : NaN;
  // if (isNaN(param1)) param1 = 5; // default value, this represents the roundness of the back arrow and how "steep" it is
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w, .5 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, .5 * w, .75 * h,
      .5 * w, .25 * h).close());
  geo.spot1 = new go.Spot(.4, .35);
  var temp = getIntersection(.2, .65, 1, .65, 0, 1, 1, .5, tempPoint());  // ?? constant
  geo.spot2 = new go.Spot(temp.x, temp.y);
  freePoint(temp);
  return geo;
});
 
// JC Adding soem parameters to this  
// add param to make long part adjustable
go.Shape.setFigureParameter("SplitEndArrow", 0, new FigureParameter("LengthThickness", 0.7, 0.52, .9));
go.Shape.defineFigureGenerator("SplitEndArrow", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w, .5 * h, true);
  geo.add(fig);
 
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = .7 // default value if user has not set one
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, param1 * h)); // line 1 need to add a param to this
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, param1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, (1 - param1) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, (1 - param1) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, 0).close());
  geo.spot1 = new go.Spot(.2, .3);
  var temp = getIntersection(.7, 1, 1, .5, .7, .7, 1, .7, tempPoint());  // ?? constant
  geo.spot2 = new go.Spot(temp.x, temp.y);
  freePoint(temp);
  return geo;
});
 
// JC
// the same thing as splitendarrow except with the ability to edit the line was absolute value
go.Shape.setFigureParameter("SplitEndArrow2", 0, new FigureParameter("LengthThickness", 50));
go.Shape.defineFigureGenerator("SplitEndArrow2", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w, .5 * h, true);
  geo.add(fig);
 
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = 50 // default value if user has not set one
  if (param1 >= h) {
    // in attempts to leave the shape with the same proportions
    var newParamValue = h / param1; // this will be the proportion we try to recreate
    // h - newParamValue = 
    var newMiddle = h * newParamValue; // calculates how big the middle will be now
    // Using the same formula above, we recalculate with the value for the newMiddle instead of Param1
    line1 = ((h - newMiddle) / 2) + newMiddle;
    line2 = ((h - newMiddle) / 2);
  } else {
    var line1 = ((h - param1) / 2) + param1;
    var line2 = ((h - param1) / 2);
  };
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, line1)); // line 1 need to add a param to this
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, line1));
  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, line2));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, line2));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, 0).close());
  geo.spot1 = new go.Spot(.2, .3);
  var temp = getIntersection(.7, 1, 1, .5, .7, .7, 1, .7, tempPoint());  // ?? constant
  geo.spot2 = new go.Spot(temp.x, temp.y);
  freePoint(temp);
  return geo;
});
 
// JC
// Adding perameter to allow user to edit the pointyness of this arrow
// parameter would allow you to edit the pointness of the arrow if nesscary
// this is kinda tedious not sure if any user would be interested in it
go.Shape.setFigureParameter("SquareArrow", 0, new FigureParameter("ArrowPoint", .7, .2, .9));
go.Shape.defineFigureGenerator("SquareArrow", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w, .5 * h, true);
  geo.add(fig);
 
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = .7;
  fig.add(new go.PathSegment(go.PathSegment.Line, param1 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, param1 * w, 0).close());
  geo.spot1 = go.Spot.TopLeft;
  geo.spot2 = new go.Spot(.7, 1);
  return geo;
});
 
go.Shape.defineFigureGenerator("Cone1", function(shape, w, h) {
  var geo = new go.Geometry();
  var cpxOffset = KAPPA * .5;
  var cpyOffset = KAPPA * .1;
  var fig = new go.PathFigure(0, .9 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h, w, (.9 + cpyOffset) * h,
    (.5 + cpxOffset) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .9 * h, (.5 - cpxOffset) * w, h,
    0, (.9 + cpyOffset) * h).close());
  geo.spot1 = new go.Spot(.25, .5);
  geo.spot2 = new go.Spot(.75, .97);
  return geo;
});
 
go.Shape.defineFigureGenerator("Cone2", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, .9 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .9 * h, (1 - .85 / .9) * w, h,
    (.85 / .9) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .9 * h).close());
  var fig2 = new go.PathFigure(0, .9 * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, w, .9 * h, (1 - .85 / .9) * w, .8 * h,
    (.85 / .9) * w, .8 * h));
  geo.spot1 = new go.Spot(.25, .5);
  geo.spot2 = new go.Spot(.75, .82);
  return geo;
});
 
go.Shape.defineFigureGenerator("Cube1", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(.5 * w, h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .85 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .15 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .15 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .85 * h).close());
  var fig2 = new go.PathFigure(.5 * w, h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .3 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, .15 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, .5 * w, .3 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, .15 * h));
  geo.spot1 = new go.Spot(0, .3);
  geo.spot2 = new go.Spot(.5, .85);
  return geo;
});
 
go.Shape.defineFigureGenerator("Cube2", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, .3 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .7 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0).close());
  var fig2 = new go.PathFigure(0, .3 * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, .7 * w, .3 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig2.add(new go.PathSegment(go.PathSegment.Move, .7 * w, .3 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));
  geo.spot1 = new go.Spot(0, .3);
  geo.spot2 = new go.Spot(.7, 1);
  return geo;
});
 
go.Shape.defineFigureGenerator("Cylinder1", function(shape, w, h) {
  var geo = new go.Geometry();
  var cpxOffset = KAPPA * .5;
  var cpyOffset = KAPPA * .1;
  var fig = new go.PathFigure(0, .1 * h, true);
  geo.add(fig);
 
  // The base (top) 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, 0, 0, (.1 - cpyOffset) * h,
    (.5 - cpxOffset) * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 1.0 * w, .1 * h, (.5 + cpxOffset) * w, 0,
    1.0 * w, (.1 - cpyOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .9 * h));
  // Bottom curve
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, 1.0 * h, 1.0 * w, (.9 + cpyOffset) * h,
    (.5 + cpxOffset) * w, 1.0 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .9 * h, (.5 - cpxOffset) * w, 1.0 * h,
    0, (.9 + cpyOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .1 * h));
  var fig2 = new go.PathFigure(0, .1 * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .2 * h, 0, (.1 + cpyOffset) * h,
    (.5 - cpxOffset) * w, .2 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 1.0 * w, .1 * h, (.5 + cpxOffset) * w, .2 * h,
    1.0 * w, (.1 + cpyOffset) * h));
  geo.spot1 = new go.Spot(0, .2);
  geo.spot2 = new go.Spot(1, .9);
  return geo;
});
 
go.Shape.defineFigureGenerator("Cylinder2", function(shape, w, h) {
  var geo = new go.Geometry();
  var cpxOffset = KAPPA * .5;
  var cpyOffset = KAPPA * .1
  var fig = new go.PathFigure(0, .9 * h, true);
  geo.add(fig);
 
  // The body, starting and ending bottom left
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, 0, 0, (.1 - cpyOffset) * h,
    (.5 - cpxOffset) * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .1 * h, (.5 + cpxOffset) * w, 0,
    w, (.1 - cpyOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h, w, (.9 + cpyOffset) * h,
    (.5 + cpxOffset) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .9 * h, (.5 - cpxOffset) * w, h,
    0, (.9 + cpyOffset) * h));
  var fig2 = new go.PathFigure(0, .9 * h, false);
  geo.add(fig2);
  // The base (bottom)
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .8 * h, 0, (.9 - cpyOffset) * h,
    (.5 - cpxOffset) * w, .8 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, w, .9 * h, (.5 + cpxOffset) * w, .8 * h,
    w, (.9 - cpyOffset) * h));
  geo.spot1 = new go.Spot(0, .1);
  geo.spot2 = new go.Spot(1, .8);
  return geo;
});
 
go.Shape.defineFigureGenerator("Cylinder3", function(shape, w, h) {
  var geo = new go.Geometry();
  var cpxOffset = KAPPA * .1;
  var cpyOffset = KAPPA * .5;
  var fig = new go.PathFigure(.1 * w, 0, true);
  geo.add(fig);
 
  // The body, starting and ending top left
  fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, (.9 + cpxOffset) * w, 0,
    w, (.5 - cpyOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .9 * w, h, w, (.5 + cpyOffset) * h,
    (.9 + cpxOffset) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .5 * h, (.1 - cpxOffset) * w, h,
    0, (.5 + cpyOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .1 * w, 0, 0, (.5 - cpyOffset) * h,
    (.1 - cpxOffset) * w, 0));
  var fig2 = new go.PathFigure(.1 * w, 0, false);
  geo.add(fig2);
  // Cylinder line (left)
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .2 * w, .5 * h, (.1 + cpxOffset) * w, 0,
    .2 * w, (.5 - cpyOffset) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .1 * w, h, .2 * w, (.5 + cpyOffset) * h,
    (.1 + cpxOffset) * w, h));
  geo.spot1 = new go.Spot(.2, 0);
  geo.spot2 = new go.Spot(.9, 1);
  return geo;
});
 
go.Shape.defineFigureGenerator("Cylinder4", function(shape, w, h) {
  var geo = new go.Geometry();
  var cpxOffset = KAPPA * .1;
  var cpyOffset = KAPPA * .5;
  var fig = new go.PathFigure(.9 * w, 0, true);
  geo.add(fig);
 
  // The body, starting and ending top right
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, (.9 + cpxOffset) * w, 0,
    w, (.5 - cpyOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .9 * w, h, w, (.5 + cpyOffset) * h,
    (.9 + cpxOffset) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .5 * h, (.1 - cpxOffset) * w, h,
    0, (.5 + cpyOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .1 * w, 0, 0, (.5 - cpyOffset) * h,
    (.1 - cpxOffset) * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, 0));
  var fig2 = new go.PathFigure(.9 * w, 0, false);
  geo.add(fig2);
  // Cylinder line (right)
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .8 * w, .5 * h, (.9 - cpxOffset) * w, 0,
    .8 * w, (.5 - cpyOffset) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .9 * w, h, .8 * w, (.5 + cpyOffset) * h,
    (.9 - cpxOffset) * w, h));
  geo.spot1 = new go.Spot(.1, 0);
  geo.spot2 = new go.Spot(.8, 1);
  return geo;
});
 
go.Shape.defineFigureGenerator("Prism1", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(.25 * w, .25 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  var fig2 = new go.PathFigure(.25 * w, .25 * h, false);
  geo.add(fig2);
  // Inner prism line
  fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
  geo.spot1 = new go.Spot(.408, .172);
  geo.spot2 = new go.Spot(.833, .662);
  return geo;
});
 
go.Shape.defineFigureGenerator("Prism2", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, .25 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .25 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, .75 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  var fig2 = new go.PathFigure(0, h, false);
  geo.add(fig2);
  // Inner prism lines
  fig2.add(new go.PathSegment(go.PathSegment.Line, .25 * w, .5 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, .25 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, 0, .25 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .25 * w, .5 * h));
  geo.spot1 = new go.Spot(.25, .5);
  geo.spot2 = new go.Spot(.75, .75);
  return geo;
});
 
go.Shape.defineFigureGenerator("Pyramid1", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(.5 * w, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .75 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .75 * h).close());
  var fig2 = new go.PathFigure(.5 * w, 0, false);
  geo.add(fig2);
  // Inner pyramind line
  fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
  geo.spot1 = new go.Spot(.25, .367);
  geo.spot2 = new go.Spot(.75, .875);
  return geo;
});
 
go.Shape.defineFigureGenerator("Pyramid2", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(.5 * w, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .85 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .85 * h).close());
  var fig2 = new go.PathFigure(.5 * w, 0, false);
  geo.add(fig2);
  // Inner pyramid lines
  fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .7 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, .85 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, .5 * w, .7 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, .85 * h));
  geo.spot1 = new go.Spot(.25, .367);
  geo.spot2 = new go.Spot(.75, .875);
  return geo;
});
 
go.Shape.defineFigureGenerator("Actor", function(shape, w, h) {
  var geo = new go.Geometry();
  var radiusw = .2;
  var radiush = .1;
  var offsetw = KAPPA * radiusw;
  var offseth = KAPPA * radiush;
  var centerx = .5;
  var centery = .1;
  var fig = new go.PathFigure(centerx * w, (centery + radiush) * h, true);
  geo.add(fig);
 
  // Head
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radiusw) * w, centery * h, (centerx - offsetw) * w, (centery + radiush) * h,
  (centerx - radiusw) * w, (centery + offseth) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radiush) * h, (centerx - radiusw) * w, (centery - offseth) * h,
  (centerx - offsetw) * w, (centery - radiush) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radiusw) * w, centery * h, (centerx + offsetw) * w, (centery - radiush) * h,
  (centerx + radiusw) * w, (centery - offseth) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radiush) * h, (centerx + radiusw) * w, (centery + offseth) * h,
  (centerx + offsetw) * w, (centery + radiush) * h));
  var r = .05;
  var cpOffset = KAPPA * r;
  centerx = .05;
  centery = .25;
  var fig2 = new go.PathFigure(.5 * w, .2 * h, true);
  geo.add(fig2);
  // Body
  fig2.add(new go.PathSegment(go.PathSegment.Line, .95 * w, .2 * h));
  centerx = .95;
  centery = .25;
  // Right arm
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + r) * w, centery * h, (centerx + cpOffset) * w, (centery - r) * h,
  (centerx + r) * w, (centery - cpOffset) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, .6 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .85 * w, .6 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .85 * w, .35 * h));
  r = .025;
  cpOffset = KAPPA * r;
  centerx = .825;
  centery = .35;
  // Right under arm
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - r) * h, (centerx + r) * w, (centery - cpOffset) * h,
  (centerx + cpOffset) * w, (centery - r) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - r) * w, centery * h, (centerx - cpOffset) * w, (centery - r) * h,
  (centerx - r) * w, (centery - cpOffset) * h));
  // Right side/leg
  fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .55 * w, h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .55 * w, .7 * h));
  // Right in between
  r = .05;
  cpOffset = KAPPA * r;
  centerx = .5;
  centery = .7;
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - r) * h, (centerx + r) * w, (centery - cpOffset) * h,
  (centerx + cpOffset) * w, (centery - r) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - r) * w, centery * h, (centerx - cpOffset) * w, (centery - r) * h,
  (centerx - r) * w, (centery - cpOffset) * h));
  // Left side/leg
  fig2.add(new go.PathSegment(go.PathSegment.Line, .45 * w, h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .35 * h));
  r = .025;
  cpOffset = KAPPA * r;
  centerx = .175;
  centery = .35;
  // Left under arm
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - r) * h, (centerx + r) * w, (centery - cpOffset) * h,
  (centerx + cpOffset) * w, (centery - r) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - r) * w, centery * h, (centerx - cpOffset) * w, (centery - r) * h,
  (centerx - r) * w, (centery - cpOffset) * h));
  // Left arm
  fig2.add(new go.PathSegment(go.PathSegment.Line, .15 * w, .6 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, .6 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, .25 * h));
  r = .05;
  cpOffset = KAPPA * r;
  centerx = .05;
  centery = .25;
  // Left shoulder
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - r) * h, (centerx - r) * w, (centery - cpOffset) * h,
  (centerx - cpOffset) * w, (centery - r) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .2 * h));
  geo.spot1 = new go.Spot(.2, .2);
  geo.spot2 = new go.Spot(.8, .65);
  return geo;
});
 
// JC
// adding parameter to make top corner size adjustable 
// these are going to have to be adjusted
go.Shape.setFigureParameter("Card", 0, new FigureParameter("CornerCutoutSize", .2, .1, .9)); // the cutout in the corner
go.Shape.defineFigureGenerator("Card", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = .2; // Distance between left and inner rect
  var fig = new go.PathFigure(w, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, param1 * h)); // .2 * h
  fig.add(new go.PathSegment(go.PathSegment.Line, param1 * w, 0).close()); // creates the line segment
  // then reconnects to the rest of the points
  geo.spot1 = new go.Spot(0, .2);
  geo.spot2 = go.Spot.BottomRight;
  return geo;
});
 
go.Shape.defineFigureGenerator("Collate", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(.5 * w, .5 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h));
  var fig2 = new go.PathFigure(.5 * w, .5 * h, true);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h));
  geo.spot1 = new go.Spot(.25, 0);
  geo.spot2 = new go.Spot(.75, .25);
  return geo;
});
 
go.Shape.defineFigureGenerator("CreateRequest", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = .1;
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  // Body
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  var fig2 = new go.PathFigure(0, param1 * h, false);
  geo.add(fig2);
  // Inside lines 
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, param1 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, 0, (1 - param1) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, (1 - param1) * h));
  //??? geo.spot1 = new go.Spot(0, param1);
  //??? geo.spot2 = new go.Spot(1, 1 - param1);
  return geo;
});
 
go.Shape.defineFigureGenerator("Database", function(shape, w, h) {
  var geo = new go.Geometry();
  var cpxOffset = KAPPA * .5;
  var cpyOffset = KAPPA * .1;
  var fig = new go.PathFigure(w, .1 * h, true);
  geo.add(fig);
 
  // Body
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h, w, (.9 + cpyOffset) * h,
    (.5 + cpxOffset) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .9 * h, (.5 - cpxOffset) * w, h,
    0, (.9 + cpyOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, 0, 0, (.1 - cpyOffset) * h,
    (.5 - cpxOffset) * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .1 * h, (.5 + cpxOffset) * w, 0,
    w, (.1 - cpyOffset) * h));
  var fig2 = new go.PathFigure(w, .1 * h, false);
  geo.add(fig2);
  // Rings
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .2 * h, w, (.1 + cpyOffset) * h,
    (.5 + cpxOffset) * w, .2 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0, .1 * h, (.5 - cpxOffset) * w, .2 * h,
    0, (.1 + cpyOffset) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, w, .2 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .3 * h, w, (.2 + cpyOffset) * h,
    (.5 + cpxOffset) * w, .3 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0, .2 * h, (.5 - cpxOffset) * w, .3 * h,
    0, (.2 + cpyOffset) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, w, .3 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .4 * h, w, (.3 + cpyOffset) * h,
    (.5 + cpxOffset) * w, .4 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0, .3 * h, (.5 - cpxOffset) * w, .4 * h,
    0, (.3 + cpyOffset) * h));
  geo.spot1 = new go.Spot(0, .4);
  geo.spot2 = new go.Spot(1, .9);
  return geo;
});
 
go.Shape.defineFigureGenerator("DataStorage", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .75 * w, h, w, 0, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, .25 * w, .9 * h, .25 * w, .1 * h).close());
  geo.spot1 = new go.Spot(.226, 0);
  geo.spot2 = new go.Spot(.81, 1);
  return geo;
});
 
go.Shape.defineFigureGenerator("DiskStorage", function(shape, w, h) {
  var geo = new go.Geometry();
  var cpxOffset = KAPPA * .5;
  var cpyOffset = KAPPA * .1;
  var fig = new go.PathFigure(w, .1 * h, true);
  geo.add(fig);
 
  // Body
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h, w, (.9 + cpyOffset) * h,
    (.5 + cpxOffset) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .9 * h, (.5 - cpxOffset) * w, h,
    0, (.9 + cpyOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, 0, 0, (.1 - cpyOffset) * h,
    (.5 - cpxOffset) * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .1 * h, (.5 + cpxOffset) * w, 0,
    w, (.1 - cpyOffset) * h));
  var fig2 = new go.PathFigure(w, .1 * h, false);
  geo.add(fig2);
  // Rings 
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .2 * h, w, (.1 + cpyOffset) * h,
    (.5 + cpxOffset) * w, .2 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0, .1 * h, (.5 - cpxOffset) * w, .2 * h,
    0, (.1 + cpyOffset) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, w, .2 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .3 * h, w, (.2 + cpyOffset) * h,
    (.5 + cpxOffset) * w, .3 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0, .2 * h, (.5 - cpxOffset) * w, .3 * h,
    0, (.2 + cpyOffset) * h));
  geo.spot1 = new go.Spot(0, .3);
  geo.spot2 = new go.Spot(1, .9);
  return geo;
});
 
go.Shape.defineFigureGenerator("Display", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(.25 * w, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .75 * w, h, w, 0, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .25 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h).close());
  geo.spot1 = new go.Spot(.25, 0);
  geo.spot2 = new go.Spot(.75, 1);
  return geo;
});
 
go.Shape.defineFigureGenerator("DividedEvent", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = .2;
  else if (param1 < .15) param1 = .15; // Minimum
  var cpOffset = KAPPA * .2;
  var fig = new go.PathFigure(0, .2 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .2 * w, 0, 0, (.2 - cpOffset) * h,
    (.2 - cpOffset) * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .2 * h, (.8 + cpOffset) * w, 0,
    w, (.2 - cpOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .8 * w, h, w, (.8 + cpOffset) * h,
    (.8 + cpOffset) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .8 * h, (.2 - cpOffset) * w, h,
    0, (.8 + cpOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .2 * h));
  var fig2 = new go.PathFigure(0, param1 * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, param1 * h));
  //??? geo.spot1 = new go.Spot(0, param1);
  //??? geo.spot2 = new go.Spot(1, 1 - param1);
  return geo;
});
 
go.Shape.defineFigureGenerator("DividedProcess", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1) || param1 < .1) param1 = .1; // Minimum
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  var fig2 = new go.PathFigure(0, param1 * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, param1 * h));
  //??? geo.spot1 = new go.Spot(0, param1);
  //??? geo.spot2 = go.Spot.BottomRight;
  return geo;
});
 
go.Shape.defineFigureGenerator("Document", function(shape, w, h) {
  var geo = new go.Geometry();
  h = h / .8;
  var fig = new go.PathFigure(0, .7 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .7 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .7 * h, .5 * w, .4 * h, .5 * w, h).close());
  geo.spot1 = go.Spot.TopLeft;
  geo.spot2 = new go.Spot(1, .6);
  return geo;
});
 
go.Shape.defineFigureGenerator("ExternalOrganization", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1) || param1 < .2) param1 = .2; // Minimum
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  // Body
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  var fig2 = new go.PathFigure(param1 * w, 0, false);
  geo.add(fig2);
  // Top left triangle
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, param1 * h));
  // Top right triangle
  fig2.add(new go.PathSegment(go.PathSegment.Move, w, param1 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, 0));
  // Bottom left triangle
  fig2.add(new go.PathSegment(go.PathSegment.Move, 0, (1 - param1) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, param1 * w, h));
  // Bottom right triangle
  fig2.add(new go.PathSegment(go.PathSegment.Move, (1 - param1) * w, h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, (1 - param1) * h));
  //??? geo.spot1 = new go.Spot(param1 / 2, param1 / 2);
  //??? geo.spot2 = new go.Spot(1 - param1 / 2, 1 - param1 / 2);
  return geo;
});
 
go.Shape.defineFigureGenerator("ExternalProcess", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(.5 * w, 0, true);
  geo.add(fig);
 
  // Body
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h).close());
  var fig2 = new go.PathFigure(.1 * w, .4 * h, false);
  geo.add(fig2);
  // Top left triangle
  fig2.add(new go.PathSegment(go.PathSegment.Line, .1 * w, .6 * h));
  // Top right triangle
  fig2.add(new go.PathSegment(go.PathSegment.Move, .9 * w, .6 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .4 * h));
  // Bottom left triangle
  fig2.add(new go.PathSegment(go.PathSegment.Move, .6 * w, .1 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .4 * w, .1 * h));
  // Bottom right triangle
  fig2.add(new go.PathSegment(go.PathSegment.Move, .4 * w, .9 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .6 * w, .9 * h));
  geo.spot1 = new go.Spot(.25, .25);
  geo.spot2 = new go.Spot(.75, .75);
  return geo;
});
 
// JC - work on this parameter
// go.Shape.setFigureParameter("File", 0, new FigureParameter(""))     // ???
go.Shape.defineFigureGenerator("File", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, true); // starting point
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .25 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  var fig2 = new go.PathFigure(.75 * w, 0, false);
  geo.add(fig2);
  // The Fold
  fig2.add(new go.PathSegment(go.PathSegment.Line, .75 * w, .25 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, .25 * h));
  geo.spot1 = new go.Spot(0, .25);
  geo.spot2 = go.Spot.BottomRight;
  return geo;
});
 
go.Shape.defineFigureGenerator("Interrupt", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w, .5 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
  var fig2 = new go.PathFigure(w, .5 * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, h));
  var fig3 = new go.PathFigure(w, .5 * h, false);
  geo.add(fig3);
  fig3.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  geo.spot1 = new go.Spot(0, .25);
  geo.spot2 = new go.Spot(.5, .75);
  return geo;
});
 
go.Shape.defineFigureGenerator("InternalStorage", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  var param2 = shape ? shape.parameter2 : NaN;
  if (isNaN(param1)) param1 = .1; // Distance from left
  if (isNaN(param2)) param2 = .1; // Distance from top
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  // The main body
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  var fig2 = new go.PathFigure(param1 * w, 0, false);
  geo.add(fig2);
  // Two lines
  fig2.add(new go.PathSegment(go.PathSegment.Line, param1 * w, h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, 0, param2 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, param2 * h));
  //??? geo.spot1 = new go.Spot(param1, param2);
  //??? geo.spot2 = go.Spot.BottomRight;
  return geo;
});
 
go.Shape.defineFigureGenerator("Junction", function(shape, w, h) {
  var geo = new go.Geometry();
  var dist = (1 / Math.SQRT2);
  var small = ((1 - 1 / Math.SQRT2) / 2);
  var cpOffset = KAPPA * .5;
  var radius = .5;
  var fig = new go.PathFigure(w, radius * h, true);
  geo.add(fig);
 
  // Circle
  fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, h, w, (radius + cpOffset) * h,
    (radius + cpOffset) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, radius * h, (radius - cpOffset) * w, h,
    0, (radius + cpOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, 0, 0, (radius - cpOffset) * h,
    (radius - cpOffset) * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, radius * h, (radius + cpOffset) * w, 0,
    w, (radius - cpOffset) * h));
  var fig2 = new go.PathFigure((small + dist) * w, (small + dist) * h, false);
  geo.add(fig2);
  // X
  fig2.add(new go.PathSegment(go.PathSegment.Line, small * w, small * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, small * w, (small + dist) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, (small + dist) * w, small * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("LinedDocument", function(shape, w, h) {
  var geo = new go.Geometry();
  h = h / .8;
  var fig = new go.PathFigure(0, .7 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .7 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .7 * h, .5 * w, .4 * h, .5 * w, h).close());
  var fig2 = new go.PathFigure(.1 * w, 0, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, .1 * w, .75 * h));
  geo.spot1 = new go.Spot(.1, 0);
  geo.spot2 = new go.Spot(1, .6);
  return geo;
});
 
go.Shape.defineFigureGenerator("LoopLimit", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .25 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .25 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .25 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h).close());
  geo.spot1 = new go.Spot(0, .25);
  geo.spot2 = go.Spot.BottomRight;
  return geo;
});
 
go.Shape.defineFigureGenerator("MagneticTape", function(shape, w, h) {
  var geo = new go.Geometry();
  var cpOffset = KAPPA * .5;
  var radius = .5;
  var fig = new go.PathFigure(.5 * w, h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, radius * h, (radius - cpOffset) * w, h,
               0, (radius + cpOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, 0, 0, (radius - cpOffset) * h,
               (radius - cpOffset) * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, radius * h, (radius + cpOffset) * w, 0,
               w, (radius - cpOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (radius + .1) * w, .9 * h, w, (radius + cpOffset) * h,
               (radius + cpOffset) * w, .9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
  geo.spot1 = new go.Spot(.15, .15);
  geo.spot2 = new go.Spot(.85, .8);
  return geo;
});
 
go.Shape.defineFigureGenerator("ManualInput", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .25 * h).close());
  geo.spot1 = new go.Spot(0, .25);
  geo.spot2 = go.Spot.BottomRight;
  return geo;
});
 
go.Shape.defineFigureGenerator("MessageFromUser", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = .7; // How far from the right the point is
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, param1 * w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  geo.spot1 = go.Spot.TopLeft;
  //??? geo.spot2 = new go.Spot(param1, 1);
  return geo;
});
 
go.Shape.defineFigureGenerator("MicroformProcessing", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = .25; // How far from the top/bottom the points are
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, param1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, (1 - param1) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  //??? geo.spot1 = new go.Spot(0, param1);
  //??? geo.spot2 = new go.Spot(1, 1 - param1);
  return geo;
});
 
go.Shape.defineFigureGenerator("MicroformRecording", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, .25 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .15 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .85 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, .75 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  geo.spot1 = new go.Spot(0, .25);
  geo.spot2 = new go.Spot(1, .75);
  return geo;
});
 
go.Shape.defineFigureGenerator("MultiDocument", function(shape, w, h) {
  var geo = new go.Geometry();
  h = h / .8;
  var fig = new go.PathFigure(w, 0, true);
  geo.add(fig);
 
  // Outline
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .9 * w, .44 * h, .96 * w, .47 * h, .93 * w, .45 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .6 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .8 * w, .54 * h, .86 * w, .57 * h, .83 * w, .55 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .7 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .7 * h, .4 * w, .4 * h, .4 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .2 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, .2 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, .1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, 0).close());
  var fig2 = new go.PathFigure(.1 * w, .2 * h, false);
  geo.add(fig2);
  // Inside lines 
  fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .2 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .54 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, .2 * w, .1 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .1 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .44 * h));
  geo.spot1 = new go.Spot(0, .25);
  geo.spot2 = new go.Spot(.8, .77);
  return geo;
});
 
go.Shape.defineFigureGenerator("MultiProcess", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(.1 * w, .1 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .2 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, .2 * h).close());
  var fig2 = new go.PathFigure(.2 * w, .1 * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .1 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .8 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, .1 * w, .2 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .2 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .9 * h));
  geo.spot1 = new go.Spot(0, .2);
  geo.spot2 = new go.Spot(.8, 1);
  return geo;
});
 
go.Shape.defineFigureGenerator("OfflineStorage", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = .1; // Distance between 2 top lines
  var l = 1 - param1; // Length of the top line
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h).close());
  var fig2 = new go.PathFigure(.5 * param1 * w, param1 * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - .5 * param1) * w, param1 * h));
  //??? geo.spot1 = new go.Spot(l / 4 + .5 * param1, param1);
  //??? geo.spot2 = new go.Spot(3 * l / 4 + .5 * param1, param1 + .5 * l);
  return geo;
});
 
go.Shape.defineFigureGenerator("OffPageConnector", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  geo.spot1 = go.Spot.TopLeft;
  geo.spot2 = new go.Spot(.75, 1);
  return geo;
});
 
go.Shape.defineFigureGenerator("Or", function(shape, w, h) {
  var geo = new go.Geometry();
  var cpOffset = KAPPA * .5;
  var radius = .5;
  var fig = new go.PathFigure(w, radius * h, true);
  geo.add(fig);
 
  // Circle
  fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, h, w, (radius + cpOffset) * h,
    (radius + cpOffset) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, radius * h, (radius - cpOffset) * w, h,
    0, (radius + cpOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, 0, 0, (radius - cpOffset) * h,
    (radius - cpOffset) * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, radius * h, (radius + cpOffset) * w, 0,
    w, (radius - cpOffset) * h));
  var fig2 = new go.PathFigure(w, .5 * h, false);
  geo.add(fig2);
  // +
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, .5 * w, h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));
  return geo;
});
 
go.Shape.defineFigureGenerator("PaperTape", function(shape, w, h) {
  var geo = new go.Geometry();
  h = h / .8;
  var fig = new go.PathFigure(0, .7 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .3 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .3 * h, .5 * w, .6 * h,
    .5 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .7 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .7 * h, .5 * w, .4 * h,
    .5 * w, h).close());
  geo.spot1 = new go.Spot(0, .49);
  geo.spot2 = new go.Spot(1, .75);
  return geo;
});
 
go.Shape.defineFigureGenerator("PrimitiveFromCall", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  var param2 = shape ? shape.parameter2 : NaN;
  if (isNaN(param1)) param1 = .1; // Distance of left line from left
  if (isNaN(param2)) param2 = .3; // Distance of point from right
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param2) * w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  //??? geo.spot1 = new go.Spot(param1, 0);
  //??? geo.spot2 = new go.Spot(1 - param2, 1);
  return geo;
});
 
go.Shape.defineFigureGenerator("PrimitiveToCall", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  var param2 = shape ? shape.parameter2 : NaN;
  if (isNaN(param1)) param1 = .1; // Distance of left line from left
  if (isNaN(param2)) param2 = .3; // Distance of top and bottom right corners from right
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param2) * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param2) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  //??? geo.spot1 = new go.Spot(param1, 0);
  //??? geo.spot2 = new go.Spot(1 - param2, 1);
  return geo;
});
 
go.Shape.defineFigureGenerator("Procedure", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  // Distance of left  and right lines from edge
  if (isNaN(param1)) param1 = .1;
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  var fig2 = new go.PathFigure((1 - param1) * w, 0, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, param1 * w, 0));
  fig2.add(new go.PathSegment(go.PathSegment.Line, param1 * w, h));
  //??? geo.spot1 = new go.Spot(param1, 0);
  //??? geo.spot2 = new go.Spot(1 - param1, 1);
  return geo;
});
 
go.Shape.defineFigureGenerator("Process", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = .1; // Distance of left  line from left edge
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  var fig2 = new go.PathFigure(param1 * w, 0, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, param1 * w, h));
  //??? geo.spot1 = new go.Spot(param1, 0);
  geo.spot2 = go.Spot.BottomRight;
  return geo;
});
 
go.Shape.defineFigureGenerator("Sort", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(.5 * w, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h).close());
  var fig2 = new go.PathFigure(0, .5 * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
  geo.spot1 = new go.Spot(.25, .25);
  geo.spot2 = new go.Spot(.75, .5);
  return geo;
});
 
go.Shape.defineFigureGenerator("Start", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = 0.25;
  var fig = new go.PathFigure(param1 * w, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Arc, 270, 180, .75 * w, 0.5 * h, .25 * w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Arc, 90, 180, .25 * w, 0.5 * h, .25 * w, .5 * h));
  var geo = new go.Geometry();
  var fig2 = new go.PathFigure(param1 * w, 0, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, param1 * w, h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, (1 - param1) * w, 0));
  fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, h));
  //??? geo.spot1 = new go.Spot(param1, 0);
  //??? geo.spot2 = new go.Spot((1 - param1), 1);
  return geo;
});
 
go.Shape.defineFigureGenerator("Terminator", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(.25 * w, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Arc, 270, 180, .75 * w, 0.5 * h, .25 * w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Arc, 90, 180, .25 * w, 0.5 * h, .25 * w, .5 * h));
  geo.spot1 = new go.Spot(.23, 0);
  geo.spot2 = new go.Spot(.77, 1);
  return geo;
});
 
go.Shape.defineFigureGenerator("TransmittalTape", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = shape ? shape.parameter1 : NaN;
  if (isNaN(param1)) param1 = .1; // Bottom line's distance from the point on the triangle
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, (1 - param1) * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, (1 - param1) * h).close());
  geo.spot1 = go.Spot.TopLeft;
  //??? geo.spot2 = new go.Spot(1, 1 - param1);
  return geo;
});
 
go.Shape.defineFigureGenerator("AndGate", function(shape, w, h) {
  var geo = new go.Geometry();
  var cpOffset = KAPPA * .5;
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  // The gate body
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, (.5 + cpOffset) * w, 0,
    w, (.5 - cpOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h, w, (.5 + cpOffset) * h,
    (.5 + cpOffset) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  geo.spot1 = go.Spot.TopLeft;
  geo.spot2 = new go.Spot(.55, 1);
  return geo;
});
 
go.Shape.defineFigureGenerator("Buffer", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  geo.spot1 = new go.Spot(0, .25);
  geo.spot2 = new go.Spot(.5, .75);
  return geo;
});
 
go.Shape.defineFigureGenerator("Clock", function(shape, w, h) {
  var geo = new go.Geometry();
  var cpOffset = KAPPA * .5;
  var radius = .5;
  var fig = new go.PathFigure(w, radius * h, true);
  geo.add(fig);
 
  // Ellipse
  fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, h, w, (radius + cpOffset) * h,
    (radius + cpOffset) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, radius * h, (radius - cpOffset) * w, h,
    0, (radius + cpOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, 0, 0, (radius - cpOffset) * h,
    (radius - cpOffset) * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, radius * h, (radius + cpOffset) * w, 0,
    w, (radius - cpOffset) * h));
  var fig2 = new go.PathFigure(w, radius * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, radius * h));
  var fig3 = new go.PathFigure(.8 * w, .75 * h, false);
  geo.add(fig3);
  // Inside clock
  // This first line solves a GDI+ graphical error with 
  // more complex gradient brushes
  fig3.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .25 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, .6 * w, .25 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, .6 * w, .75 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, .4 * w, .75 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, .4 * w, .25 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .25 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .75 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Ground", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(.5 * w, 0, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .4 * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, .2 * w, .6 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .6 * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, .3 * w, .8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, .8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, .4 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .6 * w, h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Inverter", function(shape, w, h) {
  var geo = new go.Geometry();
  var cpOffset = KAPPA * .1;
  var radius = .1;
  var centerx = .9;
  var centery = .5;
  var fig = new go.PathFigure(.8 * w, .5 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .5 * h));
  var fig2 = new go.PathFigure((centerx + radius) * w, centery * h, true);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
    (centerx - radius) * w, (centery + cpOffset) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
    (centerx - cpOffset) * w, (centery - radius) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,
    (centerx + radius) * w, (centery - cpOffset) * h));
  geo.spot1 = new go.Spot(0, .25);
  geo.spot2 = new go.Spot(.4, .75);
  return geo;
});
 
go.Shape.defineFigureGenerator("NandGate", function(shape, w, h) {
  var geo = new go.Geometry();
  var cpxOffset = KAPPA * .5;
  var cpyOffset = KAPPA * .4;
  var cpOffset = KAPPA * .1;
  var radius = .1;
  var centerx = .9;
  var centery = .5;
  var fig = new go.PathFigure(.8 * w, .5 * h, true);
  geo.add(fig);
 
  // The gate body
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .4 * w, h, .8 * w, (.5 + cpyOffset) * h,
    (.4 + cpxOffset) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .4 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .8 * w, .5 * h, (.4 + cpxOffset) * w, 0,
    .8 * w, (.5 - cpyOffset) * h));
  var fig2 = new go.PathFigure((centerx + radius) * w, centery * h, true);
  geo.add(fig2);
  // Inversion
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
    (centerx - radius) * w, (centery + cpOffset) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
    (centerx - cpOffset) * w, (centery - radius) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, (centery) * h, (centerx + cpOffset) * w, (centery - radius) * h,
    (centerx + radius) * w, (centery - cpOffset) * h));
  geo.spot1 = new go.Spot(0, .05);
  geo.spot2 = new go.Spot(.55, .95);
  return geo;
});
 
go.Shape.defineFigureGenerator("NorGate", function(shape, w, h) {
  var geo = new go.Geometry();
  var radius = .5;
  var cpOffset = KAPPA * radius;
  var centerx = 0;
  var centery = .5;
  var fig = new go.PathFigure(.8 * w, .5 * h, true);
  geo.add(fig);
 
  // Normal
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h, .7 * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, .25 * w, .75 * h,
    .25 * w, .25 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .8 * w, .5 * h, (centerx + cpOffset) * w, (centery - radius) * h,
    .7 * w, (centery - cpOffset) * h));
  radius = .1;
  cpOffset = KAPPA * .1;
  centerx = .9;
  centery = .5;
  var fig2 = new go.PathFigure((centerx - radius) * w, centery * h, true);
  geo.add(fig2);
  // Inversion
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
    (centerx - cpOffset) * w, (centery - radius) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,
    (centerx + radius) * w, (centery - cpOffset) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
    (centerx - radius) * w, (centery + cpOffset) * h));
  geo.spot1 = new go.Spot(.2, .25);
  geo.spot2 = new go.Spot(.6, .75);
  return geo;
});
 
go.Shape.defineFigureGenerator("OrGate", function(shape, w, h) {
  var geo = new go.Geometry();
  var radius = .5;
  var cpOffset = KAPPA * radius;
  var centerx = 0;
  var centery = .5;
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, (centerx + cpOffset + cpOffset) * w, (centery - radius) * h,
    .8 * w, (centery - cpOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h, .8 * w, (centery + cpOffset) * h,
    (centerx + cpOffset + cpOffset) * w, (centery + radius) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, .25 * w, .75 * h, .25 * w, .25 * h).close());
  geo.spot1 = new go.Spot(.2, .25);
  geo.spot2 = new go.Spot(.75, .75);
  return geo;
});
 
go.Shape.defineFigureGenerator("XnorGate", function(shape, w, h) {
  var geo = new go.Geometry();
  var radius = .5;
  var cpOffset = KAPPA * radius;
  var centerx = .2;
  var centery = .5;
  var fig = new go.PathFigure(.1 * w, 0, false);
  geo.add(fig);
 
  // Normal
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .1 * w, h, .35 * w, .25 * h, .35 * w, .75 * h));
  var fig2 = new go.PathFigure(.8 * w, .5 * h, true);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .2 * w, h, .7 * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .2 * w, 0, .45 * w, .75 * h, .45 * w, .25 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .8 * w, .5 * h, (centerx + cpOffset) * w, (centery - radius) * h,
    .7 * w, (centery - cpOffset) * h));
  radius = .1;
  cpOffset = KAPPA * .1;
  centerx = .9;
  centery = .5;
  var fig3 = new go.PathFigure((centerx - radius) * w, centery * h, true);
  geo.add(fig3);
  // Inversion
  fig3.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
    (centerx - cpOffset) * w, (centery - radius) * h));
  fig3.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,
    (centerx + radius) * w, (centery - cpOffset) * h));
  fig3.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig3.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
    (centerx - radius) * w, (centery + cpOffset) * h));
  geo.spot1 = new go.Spot(.4, .25);
  geo.spot2 = new go.Spot(.65, .75);
  return geo;
});
 
go.Shape.defineFigureGenerator("XorGate", function(shape, w, h) {
  var geo = new go.Geometry();
  var radius = .5;
  var cpOffset = KAPPA * radius;
  var centerx = .2;
  var centery = .5;
  var fig = new go.PathFigure(.1 * w, 0, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .1 * w, h, .35 * w, .25 * h, .35 * w, .75 * h));
  var fig2 = new go.PathFigure(.2 * w, 0, true);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, (centerx + cpOffset) * w, (centery - radius) * h,
    .9 * w, (centery - cpOffset) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .2 * w, h, .9 * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .2 * w, 0, .45 * w, .75 * h, .45 * w, .25 * h).close());
  geo.spot1 = new go.Spot(.4, .25);
  geo.spot2 = new go.Spot(.8, .75);
  return geo;
});
 
go.Shape.defineFigureGenerator("Capacitor", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, false);
  geo.add(fig);
 
  // Two vertical lines
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Move, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Resistor", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, .5 * h, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .4 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .6 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, .5 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Inductor", function(shape, w, h) {
  var geo = new go.Geometry();
  var cpOffset = KAPPA * .1;
  var radius = .1;
  var centerx = .1;
  var centery = .5;
  // Up
  var fig = new go.PathFigure((centerx - cpOffset * .5) * w, h, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, 0, (centerx - cpOffset) * w, h, (centerx - radius) * w, 0));
  // Down up
  centerx = .3;
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, h, (centerx + radius) * w, 0, (centerx + cpOffset) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, 0, (centerx - cpOffset) * w, h, (centerx - radius) * w, 0));
  // Down up
  centerx = .5;
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, h, (centerx + radius) * w, 0, (centerx + cpOffset) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, 0, (centerx - cpOffset) * w, h, (centerx - radius) * w, 0));
  // Down up
  centerx = .7;
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, h, (centerx + radius) * w, 0, (centerx + cpOffset) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, 0, (centerx - cpOffset) * w, h, (centerx - radius) * w, 0));
  // Down up
  centerx = .9;
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + cpOffset * .5) * w, h, (centerx + radius) * w, 0, (centerx + cpOffset) * w, h));
  return geo;
});
 
go.Shape.defineFigureGenerator("ACvoltageSource", function(shape, w, h) {
  var geo = new go.Geometry();
  var cpOffset = KAPPA * .5;
  var radius = .5;
  var centerx = .5;
  var centery = .5;
  var fig = new go.PathFigure((centerx - radius) * w, centery * h, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
  (centerx - cpOffset) * w, (centery - radius) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,
  (centerx + radius) * w, (centery - cpOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
  (centerx + cpOffset) * w, (centery + radius) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
  (centerx - radius) * w, (centery + cpOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, (centerx - radius + .1) * w, centery * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius - .1) * w, centery * h, centerx * w, (centery - radius) * h,
  centerx * w, (centery + radius) * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("DCvoltageSource", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, .75 * h, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .25 * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Diode", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w, 0, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  geo.spot1 = new go.Spot(0, .25);
  geo.spot2 = new go.Spot(.5, .75);
  return geo;
});
 
go.Shape.defineFigureGenerator("Wifi", function(shape, w, h) {
  var geo = new go.Geometry();
  var origw = w;
  var origh = h;
  w = w * .38;
  h = h * .6;
  var cpOffset = KAPPA * .8;
  var radius = .8;
  var centerx = 0;
  var centery = .5;
  var xOffset = (origw - w) / 2;
  var yOffset = (origh - h) / 2;
  var fig = new go.PathFigure(centerx * w + xOffset, (centery + radius) * h + yOffset, true);
  geo.add(fig);
 
  // Left curves 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w + xOffset,
      centery * h + yOffset, (centerx - cpOffset) * w + xOffset,
      (centery + radius) * h + yOffset,
      (centerx - radius) * w + xOffset,
      (centery + cpOffset) * h + yOffset));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,
      (centery - radius) * h + yOffset, (centerx - radius) * w + xOffset,
      (centery - cpOffset) * h + yOffset,
      (centerx - cpOffset) * w + xOffset,
      (centery - radius) * h + yOffset));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius + cpOffset * .5) * w + xOffset,
      centery * h + yOffset, centerx * w + xOffset,
      (centery - radius) * h + yOffset,
      (centerx - radius + cpOffset * .5) * w + xOffset,
      (centery - cpOffset) * h + yOffset));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,
      (centery + radius) * h + yOffset, (centerx - radius + cpOffset * .5) * w + xOffset,
      (centery + cpOffset) * h + yOffset,
      centerx * w + xOffset,
      (centery + radius) * h + yOffset).close());
  cpOffset = KAPPA * .4;
  radius = .4;
  centerx = .2;
  centery = .5;
  var fig2 = new go.PathFigure(centerx * w + xOffset, (centery + radius) * h + yOffset, true);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w + xOffset,
      centery * h + yOffset, (centerx - cpOffset) * w + xOffset,
      (centery + radius) * h + yOffset,
      (centerx - radius) * w + xOffset,
      (centery + cpOffset) * h + yOffset));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,
      (centery - radius) * h + yOffset, (centerx - radius) * w + xOffset,
      (centery - cpOffset) * h + yOffset,
      (centerx - cpOffset) * w + xOffset,
      (centery - radius) * h + yOffset));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius + cpOffset * .5) * w + xOffset,
      centery * h + yOffset, centerx * w + xOffset,
      (centery - radius) * h + yOffset,
      (centerx - radius + cpOffset * .5) * w + xOffset,
      (centery - cpOffset) * h + yOffset));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,
      (centery + radius) * h + yOffset, (centerx - radius + cpOffset * .5) * w + xOffset,
      (centery + cpOffset) * h + yOffset,
      centerx * w + xOffset,
      (centery + radius) * h + yOffset).close());
  cpOffset = KAPPA * .2;
  radius = .2;
  centerx = .5;
  centery = .5;
  var fig3 = new go.PathFigure((centerx - radius) * w + xOffset, centery * h + yOffset, true);
  geo.add(fig3);
  // Center circle
  fig3.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,
      (centery - radius) * h + yOffset, (centerx - radius) * w + xOffset,
      (centery - cpOffset) * h + yOffset,
      (centerx - cpOffset) * w + xOffset,
      (centery - radius) * h + yOffset));
  fig3.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w + xOffset,
      centery * h + yOffset, (centerx + cpOffset) * w + xOffset,
      (centery - radius) * h + yOffset,
      (centerx + radius) * w + xOffset,
      (centery - cpOffset) * h + yOffset));
  fig3.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,
      (centery + radius) * h + yOffset, (centerx + radius) * w + xOffset,
      (centery + cpOffset) * h + yOffset,
      (centerx + cpOffset) * w + xOffset,
      (centery + radius) * h + yOffset));
  fig3.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w + xOffset,
      centery * h + yOffset, (centerx - cpOffset) * w + xOffset,
      (centery + radius) * h + yOffset,
      (centerx - radius) * w + xOffset,
      (centery + cpOffset) * h + yOffset));
  cpOffset = KAPPA * .4;
  radius = .4;
  centerx = .8;
  centery = .5;
  var fig4 = new go.PathFigure(centerx * w + xOffset, (centery - radius) * h + yOffset, true);
  geo.add(fig4);
  // Right curves
  fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w + xOffset,
      centery * h + yOffset, (centerx + cpOffset) * w + xOffset,
      (centery - radius) * h + yOffset,
      (centerx + radius) * w + xOffset,
      (centery - cpOffset) * h + yOffset));
  fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,
      (centery + radius) * h + yOffset, (centerx + radius) * w + xOffset,
      (centery + cpOffset) * h + yOffset,
      (centerx + cpOffset) * w + xOffset,
      (centery + radius) * h + yOffset));
  fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius - cpOffset * .5) * w + xOffset,
      centery * h + yOffset, centerx * w + xOffset,
      (centery + radius) * h + yOffset,
      (centerx + radius - cpOffset * .5) * w + xOffset,
      (centery + cpOffset) * h + yOffset));
  fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,
      (centery - radius) * h + yOffset, (centerx + radius - cpOffset * .5) * w + xOffset,
      (centery - cpOffset) * h + yOffset,
      centerx * w + xOffset,
      (centery - radius) * h + yOffset).close());
  cpOffset = KAPPA * .8;
  radius = .8;
  centerx = 1;
  centery = .5;
  var fig5 = new go.PathFigure(centerx * w + xOffset, (centery - radius) * h + yOffset, true);
  geo.add(fig5);
  fig5.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w + xOffset,
      centery * h + yOffset, (centerx + cpOffset) * w + xOffset,
      (centery - radius) * h + yOffset,
      (centerx + radius) * w + xOffset,
      (centery - cpOffset) * h + yOffset));
  fig5.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,
      (centery + radius) * h + yOffset, (centerx + radius) * w + xOffset,
      (centery + cpOffset) * h + yOffset,
      (centerx + cpOffset) * w + xOffset,
      (centery + radius) * h + yOffset));
  fig5.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius - cpOffset * .5) * w + xOffset,
      centery * h + yOffset, centerx * w + xOffset,
      (centery + radius) * h + yOffset,
      (centerx + radius - cpOffset * .5) * w + xOffset,
      (centery + cpOffset) * h + yOffset));
  fig5.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,
      (centery - radius) * h + yOffset, (centerx + radius - cpOffset * .5) * w + xOffset,
      (centery - cpOffset) * h + yOffset,
      centerx * w + xOffset,
      (centery - radius) * h + yOffset).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("Email", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0).close());
  var fig2 = new go.PathFigure(0, 0, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .6 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig2.add(new go.PathSegment(go.PathSegment.Move, 0, h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .45 * w, .54 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, w, h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .55 * w, .54 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Ethernet", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(.35 * w, 0, true);
  geo.add(fig);
  // Boxes above the wire
  fig.add(new go.PathSegment(go.PathSegment.Line, .65 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .65 * w, .4 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .35 * w, .4 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .35 * w, 0).close());
  var fig2 = new go.PathFigure(.10 * w, h, true, true);
  geo.add(fig2);
  // Boxes under the wire
  fig2.add(new go.PathSegment(go.PathSegment.Line, .40 * w, h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .40 * w, .6 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .10 * w, .6 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .10 * w, h).close());
  var fig3 = new go.PathFigure(.60 * w, h, true, true);
  geo.add(fig3);
  fig3.add(new go.PathSegment(go.PathSegment.Line, .90 * w, h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, .90 * w, .6 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, .60 * w, .6 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, .60 * w, h).close());
  var fig4 = new go.PathFigure(0, .5 * h, false);
  geo.add(fig4);
  // Wire
  fig4.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
  fig4.add(new go.PathSegment(go.PathSegment.Move, .5 * w, .5 * h));
  fig4.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .4 * h));
  fig4.add(new go.PathSegment(go.PathSegment.Move, .75 * w, .5 * h));
  fig4.add(new go.PathSegment(go.PathSegment.Line, .75 * w, .6 * h));
  fig4.add(new go.PathSegment(go.PathSegment.Move, .25 * w, .5 * h));
  fig4.add(new go.PathSegment(go.PathSegment.Line, .25 * w, .6 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Power", function(shape, w, h) {
  var geo = new go.Geometry();
  var cpOffset = KAPPA * .4;
  var radius = .4;
  var centerx = .5;
  var centery = .5;
  var unused = tempPoint();
  var mid = tempPoint();
  var c1 = tempPoint();
  var c2 = tempPoint();
  // Find the 45 degree midpoint for the first bezier
  breakUpBezier(centerx, centery - radius,
      centerx + cpOffset, centery - radius,
      centerx + radius, centery - cpOffset,
      centerx + radius, centery, .5, unused,
      unused, mid, c1, c2);
  var start = tempPointAt(mid.x, mid.y);
  var fig = new go.PathFigure(mid.x * w, mid.y * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, c1.x * w, c1.y * h, c2.x * w, c2.y * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
    (centerx - radius) * w, (centery + cpOffset) * h));
  // Find the 45 degree midpoint of for the fourth bezier
  breakUpBezier(centerx - radius, centery,
      centerx - radius, centery - cpOffset,
      centerx - cpOffset, centery - radius,
      centerx, centery - radius, .5, c1,
      c2, mid, unused, unused);
  fig.add(new go.PathSegment(go.PathSegment.Bezier, mid.x * w, mid.y * h, c1.x * w, c1.y * h,
    c2.x * w, c2.y * h));
  // now make a smaller circle
  cpOffset = KAPPA * .3;
  radius = .3;
  // Find the 45 degree midpoint for the first bezier
  breakUpBezier(centerx - radius, centery,
      centerx - radius, centery - cpOffset,
      centerx - cpOffset, centery - radius,
      centerx, centery - radius, .5, c1,
      c2, mid, unused, unused);
  fig.add(new go.PathSegment(go.PathSegment.Line, mid.x * w, mid.y * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, c2.x * w, c2.y * h, c1.x * w, c1.y * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h,
    (centerx - cpOffset) * w, (centery + radius) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery + radius) * h,
    (centerx + radius) * w, (centery + cpOffset) * h));
  // Find the 45 degree midpoint for the fourth bezier
  breakUpBezier(centerx, centery - radius,
      centerx + cpOffset, centery - radius,
      centerx + radius, centery - cpOffset,
      centerx + radius, centery, .5, unused,
      unused, mid, c1, c2);
  fig.add(new go.PathSegment(go.PathSegment.Bezier, mid.x * w, mid.y * h, c2.x * w, c2.y * h, c1.x * w, c1.y * h).close());
  var fig = new go.PathFigure(.45 * w, 0, true);
  geo.add(fig);
  fig.add(new go.PathSegment(go.PathSegment.Line, .45 * w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .55 * w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .55 * w, 0).close());
  freePoint(unused);
  freePoint(mid);
  freePoint(c1);
  freePoint(c2);
  freePoint(start);
  geo.spot1 = new go.Spot(.25, .45);
  geo.spot2 = new go.Spot(.75, .8);
  return geo;
});
 
go.Shape.defineFigureGenerator("Fallout", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, h/2, true);
  geo.add(fig);
 
  // Containing circle
  fig.add(new go.PathSegment(go.PathSegment.Arc, 180, 360, w/2, h/2, w/2, h/2))
 
  function drawTriangle(fig, offsetx, offsety) {
    fig.add(new go.PathSegment(go.PathSegment.Move, (.3 + offsetx) * w, (.8 + offsety) * h));
    fig.add(new go.PathSegment(go.PathSegment.Line, (.5 + offsetx) * w, (.5 + offsety) * h));
    fig.add(new go.PathSegment(go.PathSegment.Line, (.1 + offsetx) * w, (.5 + offsety) * h));
    fig.add(new go.PathSegment(go.PathSegment.Line, (.3 + offsetx) * w, (.8 + offsety) * h).close());
  }
 
  // Triangles
  drawTriangle(fig, 0, 0);
  drawTriangle(fig, 0.4, 0);
  drawTriangle(fig, 0.2, -0.3);
  return geo;
});
 
go.Shape.defineFigureGenerator("IrritationHazard", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(.2 * w, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .3 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .2 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .7 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .2 * h).close());
  geo.spot1 = new go.Spot(.3, .3);
  geo.spot2 = new go.Spot(.7, .7);
  return geo;
});
 
go.Shape.defineFigureGenerator("ElectricalHazard", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(.37 * w, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .11 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .77 * w, .04 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .33 * w, .49 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .37 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .63 * w, .86 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .77 * w, .91 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .34 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .34 * w, .78 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .44 * w, .8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .65 * w, .56 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .68 * h).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("FireHazard", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(.1 * w, h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .29 * w, 0, -.25 * w, .63 * h,
  .45 * w, .44 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .51 * w, .42 * h, .48 * w, .17 * h,
  .54 * w, .35 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .59 * w, .18 * h, .59 * w, .29 * h,
  .58 * w, .28 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .75 * w, .6 * h, .8 * w, .34 * h,
  .88 * w, .43 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .88 * w, .31 * h, .87 * w, .48 * h,
  .88 * w, .43 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .9 * w, h, 1.17 * w, .76 * h,
  .82 * w, .8 * h).close());
  geo.spot1 = new go.Spot(.07, .445);
  geo.spot2 = new go.Spot(.884, .958);
  return geo;
});
 
go.Shape.defineFigureGenerator("BpmnActivityLoop", function(shape, w, h) {
  var geo = new go.Geometry();
  var r = .5;
  var cx = 0; // offset from Center x
  var cy = 0; // offset from Center y
  var d = r * KAPPA;
  var mx1 = (.4 * Math.SQRT2 / 2 + .5);
  var my1 = (.5 - .5 * Math.SQRT2 / 2);
  var x1 = 1;
  var y1 = .5;
  var x2 = .5;
  var y2 = 0;
  var fig = new go.PathFigure(mx1 * w, (1 - my1) * h, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, x1 * w, y1 * h, x1 * w, .7 * h,
  x1 * w, y1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (x2 + cx) * w, (y2 + cx) * h, (.5 + r + cx) * w, (.5 - d + cx) * h,
  (.5 + d + cx) * w, (.5 - r + cx) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 - r + cx) * w, (.5 + cy) * h, (.5 - d + cx) * w, (.5 - r + cy) * h,
  (.5 - r + cx) * w, (.5 - d + cy) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.35 + cx) * w, .9 * h, (.5 - r + cx) * w, (.5 + d + cy) * h,
  (.5 - d + cx) * w, .9 * h));
  // Arrowhead
  fig.add(new go.PathSegment(go.PathSegment.Move, (.25 + cx) * w, 0.8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, (.35 + cx) * w, 0.9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, (.20 + cx) * w, 0.95 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("BpmnActivityParallel", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Move, .5 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Move, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  return geo;
});
 
go.Shape.defineFigureGenerator("BpmnActivitySequential", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  return geo;
});
 
go.Shape.defineFigureGenerator("BpmnActivityAdHoc", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, false);
  geo.add(fig);
 
  var fig2 = new go.PathFigure(w, h, false);
  geo.add(fig2);
  var fig3 = new go.PathFigure(0, .5 * h, false);
  geo.add(fig3);
  fig3.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .5 * h, .2 * w, .35 * h,
    .3 * w, .35 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, .7 * w, .65 * h,
    .8 * w, .65 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("BpmnActivityCompensation", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, .5 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("BpmnTaskMessage", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, .2 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .2 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .8 * h).close());
  var fig = new go.PathFigure(0, .2 * h, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, .2 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("BpmnTaskScript", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(.7 * w, h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.3 * w, 0, .6 * w, .5 * h,
  0, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, .7 * w, h, .4 * w, .5 * h,
  w, .5 * h).close());
  var fig2 = new go.PathFigure(.45 * w, .73 * h, false);
  geo.add(fig2);
  // Lines on script
  fig2.add(new go.PathSegment(go.PathSegment.Line, .7 * w, .73 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, .38 * w, .5 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .63 * w, .5 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, .31 * w, .27 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .56 * w, .27 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("BpmnTaskUser", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, false);
  geo.add(fig);
 
  var fig2 = new go.PathFigure(.335 * w, (1 - .555) * h, true);
  geo.add(fig2);
  // Shirt
  fig2.add(new go.PathSegment(go.PathSegment.Line, .335 * w, (1 - .405) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - .335) * w, (1 - .405) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - .335) * w, (1 - .555) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, w, .68 * h, (1 - .12) * w, .46 * h,
    (1 - .02) * w, .54 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, .68 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .335 * w, (1 - .555) * h, .02 * w, .54 * h,
    .12 * w, .46 * h));
  // Start of neck
  fig2.add(new go.PathSegment(go.PathSegment.Line, .365 * w, (1 - .595) * h));
  var radiushead = .5 - .285;
  var centerx = .5;
  var centery = radiushead;
  var alpha2 = Math.PI / 4;
  var KAPPA = ((4 * (1 - Math.cos(alpha2))) / (3 * Math.sin(alpha2)));
  var cpOffset = KAPPA * .5;
  var radiusw = radiushead;
  var radiush = radiushead;
  var offsetw = KAPPA * radiusw;
  var offseth = KAPPA * radiush;
  // Circle (head)
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radiusw) * w, centery * h, (centerx - ((offsetw + radiusw) / 2)) * w, (centery + ((radiush + offseth) / 2)) * h,
    (centerx - radiusw) * w, (centery + offseth) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radiush) * h, (centerx - radiusw) * w, (centery - offseth) * h,
    (centerx - offsetw) * w, (centery - radiush) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radiusw) * w, centery * h, (centerx + offsetw) * w, (centery - radiush) * h,
    (centerx + radiusw) * w, (centery - offseth) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (1 - .365) * w, (1 - .595) * h, (centerx + radiusw) * w, (centery + offseth) * h,
    (centerx + ((offsetw + radiusw) / 2)) * w, (centery + ((radiush + offseth) / 2)) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - .365) * w, (1 - .595) * h));
  // Neckline
  fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - .335) * w, (1 - .555) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - .335) * w, (1 - .405) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .335 * w, (1 - .405) * h));
  var fig3 = new go.PathFigure(.2 * w, h, false);
  geo.add(fig3);
  // Arm lines
  fig3.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .8 * h));
  var fig4 = new go.PathFigure(.8 * w, h, false);
  geo.add(fig4);
  fig4.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .8 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("BpmnEventConditional", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(.1 * w, 0, true);
  geo.add(fig);
 
  // Body
  fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, h).close());
  var fig2 = new go.PathFigure(.2 * w, .2 * h, false);
  geo.add(fig2);
  // Inside lines
  fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .2 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, .2 * w, .4 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .4 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, .2 * w, .6 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .6 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, .2 * w, .8 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .8 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("BpmnEventError", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, .33 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .66 * w, .50 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, .66 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .33 * w, .50 * h).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("BpmnEventEscalation", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, false);
  geo.add(fig);
  // Set dimensions
  var fig2 = new go.PathFigure(w, h, false);
  geo.add(fig2);
  var fig3 = new go.PathFigure(.1 * w, h, true);
  geo.add(fig3);
  fig3.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));
  fig3.add(new go.PathSegment(go.PathSegment.Line, .9 * w, h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("Caution", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0.05 * w, h, true);
  geo.add(fig);
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.1 * w, .8 * h, 0, h, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, .1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.55 * w, .1 * h, 0.5 * w, 0, 0.5 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.95 * w, 0.9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.9 * w, h, w, h, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.05 * w, h));
  var radius = 0.05;
  // Bottom circle of exclamation point
  fig.add(new go.PathSegment(go.PathSegment.Move, (0.5 - radius) * w, 0.875 * h));
  fig.add(new go.PathSegment(go.PathSegment.Arc, 180, -360, 0.5 * w, 0.875 * h, radius * w, radius * h));
  // Upper rectangle of exclamation point
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.75 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.325 * h, 0.575 * w, 0.725 * h, 0.625 * w, 0.375 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.75 * h, 0.375 * w, 0.375 * h, 0.425 * w, 0.725 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Recycle", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0.45 * w, 0.95 * h, false);
  geo.add(fig);
 
  // Bottom left arrow
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, 0.95 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.185 * w, 0.85 * h, 0.17 * w, 0.95 * h, 0.15 * w, 0.9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.235 * w, 0.75 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.30 * w, 0.625 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.35 * w, 0.65 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.275 * w, 0.45 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.05 * w, 0.45 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0.5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.05 * w, 0.575 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.1875 * w, 0.95 * h, 0, 0.675 * h, 0, 0.7 * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.45 * w, 0.95 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.775 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.22 * w, 0.775 * h));
  var fig2 = new go.PathFigure(0.475 * w, 0.2 * h, false);
  geo.add(fig2);
  // Top arrow
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.4 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.225 * w, 0.3 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.275 * w, 0.175 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.325 * w, 0.05 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0.4 * w, 0.05 * h, 0.35 * w, 0, 0.375 * w, 0));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.575 * w, 0.375 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.525 * w, 0.4 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0.475 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.85 * w, 0.315 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.32 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.05 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0.575 * w, 0, 0.65 * w, 0.05 * h, 0.625 * w, 0));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.38 * w, 0.0105 * h));
  var fig3 = new go.PathFigure(0.675 * w, 0.575 * h, false);
  geo.add(fig3);
  // Bottom right arrow
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.875 * w, 0.525 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, w, 0.775 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Bezier, 0.85 * w, 0.95 * h, w, 0.8 * h, w, 0.85 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.95 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, 0.85 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.725 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.775 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.7 * w, 0.775 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, w, 0.775 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Move, 0.675 * w, 0.575 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.775 * w, 0.775 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("BpmnEventTimer", function(shape, w, h) {
  var geo = new go.Geometry();
  var radius = .5;
  var cpOffset = KAPPA * .5;
  var fig = new go.PathFigure(w, radius * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, h, w, (radius + cpOffset) * h,
    (radius + cpOffset) * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, radius * h, (radius - cpOffset) * w, h,
    0, (radius + cpOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, 0, 0, (radius - cpOffset) * h,
    (radius - cpOffset) * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, radius * h, (radius + cpOffset) * w, 0,
    w, (radius - cpOffset) * h));
  var fig2 = new go.PathFigure(radius * w, 0, false);
  geo.add(fig2);
  // Hour lines
  fig2.add(new go.PathSegment(go.PathSegment.Line, radius * w, .15 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, radius * w, h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, radius * w, .85 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, 0, radius * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .15 * w, radius * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, w, radius * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .85 * w, radius * h));
  // Clock hands
  fig2.add(new go.PathSegment(go.PathSegment.Move, radius * w, radius * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .58 * w, 0.1 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Move, radius * w, radius * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .78 * w, .54 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Package", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0.15 * h, true);
  geo.add(fig);
 
  // Package bottom rectangle
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.15 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  var fig2 = new go.PathFigure(0, 0.15 * h, true);
  geo.add(fig2);
  // Package top flap
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.15 * h).close());
  geo.spot1 = new go.Spot(0, 0.1);
  geo.spot2 = new go.Spot(1, 1);
  return geo;
});
 
go.Shape.defineFigureGenerator("Class", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  // Class box
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0).close());
  var fig2 = new go.PathFigure(0, 0.2 * h, false);
  geo.add(fig2);
  // Top box separater
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0.2 * h).close());
  var fig3 = new go.PathFigure(0, 0.5 * h, false);
  geo.add(fig3);
  // Middle box separater
  fig3.add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("Component", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w, h, true);
  geo.add(fig);
 
  // Component Box
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h).close());
  var fig2 = new go.PathFigure(0, 0.2 * h, true);
  geo.add(fig2);
  // Component top sub box
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.2 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.4 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, 0.4 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, 0.2 * h).close());
  var fig3 = new go.PathFigure(0, 0.6 * h, true);
  geo.add(fig3);
  // Component bottom sub box
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.6 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.8 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0, 0.8 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0, 0.6 * h).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("Boat Shipment", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0.15 * w, 0.6 * h, true);
  geo.add(fig);
 
  // Boat shipment flag
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, 0.6 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.6 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.85 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.6 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.85 * w, 0.6 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, 0.6 * h));
  var fig2 = new go.PathFigure(0.15 * w, 0.6 * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.85 * w, 0.6 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Customer/Supplier", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w, h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.66 * w, 0.33 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.66 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.33 * w, 0.33 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.33 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.33 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("Workcell", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.4 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.35 * w, 0.4 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.35 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("Supermarket", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.33 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.33 * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, w, 0.33 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.66 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.66 * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, w, 0.66 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  return geo;
});
 
go.Shape.defineFigureGenerator("TruckShipment", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  // Left rectangle
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0).close());
  var fig2 = new go.PathFigure(w, 0.8 * h, true);
  geo.add(fig2);
  // Right rectangle
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0.4 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.4 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.8 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0.8 * h).close());
  var radius = .1;
  var cpOffset = KAPPA * .1;
  var centerx = .2;
  var centery = .9;
  var fig3 = new go.PathFigure((centerx - radius) * w, centery * h, true);
  geo.add(fig3);
  // Left wheel
  fig3.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
      (centerx - cpOffset) * w, (centery - radius) * h));
  fig3.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,
      (centerx + radius) * w, (centery - cpOffset) * h));
  fig3.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
      (centerx + cpOffset) * w, (centery + radius) * h));
  fig3.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
      (centerx - radius) * w, (centery + cpOffset) * h).close());
  radius = .1;
  cpOffset = KAPPA * .1;
  centerx = .8;
  centery = .9;
  var fig4 = new go.PathFigure((centerx - radius) * w, centery * h, true);
  geo.add(fig4);
  // Right wheel
  fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
      (centerx - cpOffset) * w, (centery - radius) * h));
  fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,
      (centerx + radius) * w, (centery - cpOffset) * h));
  fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
      (centerx + cpOffset) * w, (centery + radius) * h));
  fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
      (centerx - radius) * w, (centery + cpOffset) * h).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("KanbanPost", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0.2 * w, 0, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, .5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Forklift", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
  var fig2 = new go.PathFigure(0, 0.5 * h, true);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, 0.8 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.8 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.5 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h));
  var fig3 = new go.PathFigure(0.50 * w, 0.8 * h, true);
  geo.add(fig3);
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.50 * w, 0.1 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, 0.1 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, 0.8 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.50 * w, 0.8 * h));
  var fig4 = new go.PathFigure(0.5 * w, 0.7 * h, false);
  geo.add(fig4);
  fig4.add(new go.PathSegment(go.PathSegment.Line, w, 0.7 * h));
  var radius = .1;
  var cpOffset = KAPPA * .1;
  var centerx = .1;
  var centery = .9
  var fig5 = new go.PathFigure((centerx - radius) * w, centery * h, true);
  geo.add(fig5);
  fig5.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
    (centerx - cpOffset) * w, (centery - radius) * h));
  fig5.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,
    (centerx + radius) * w, (centery - cpOffset) * h));
  fig5.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig5.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
    (centerx - radius) * w, (centery + cpOffset) * h));
  radius = .1;
  cpOffset = KAPPA * .1;
  centerx = .4;
  centery = .9;
  var fig6 = new go.PathFigure((centerx - radius) * w, centery * h, true);
  geo.add(fig6);
  fig6.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
    (centerx - cpOffset) * w, (centery - radius) * h));
  fig6.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,
    (centerx + radius) * w, (centery - cpOffset) * h));
  fig6.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig6.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
    (centerx - radius) * w, (centery + cpOffset) * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("RailShipment", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0.1 * w, 0.4 * h, true);
  geo.add(fig);
 
  // Left cart
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.4 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0.9 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0.4 * h).close());
  var fig2 = new go.PathFigure(0.45 * w, 0.7 * h, false);
  geo.add(fig2);
  // Line connecting carts
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, 0.7 * h));
  var fig3 = new go.PathFigure(0.55 * w, 0.4 * h, true);
  geo.add(fig3);
  // Right cart
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.4 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.9 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, 0.9 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, 0.4 * h).close());
  var radius = .05;
  var cpOffset = KAPPA * .05;
  var centerx = .175;
  var centery = .95;
  var fig4 = new go.PathFigure((centerx - radius) * w, centery * h, true);
  geo.add(fig4);
  // Wheels
  fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
    (centerx - cpOffset) * w, (centery - radius) * h));
  fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,
    (centerx + radius) * w, (centery - cpOffset) * h));
  fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
    (centerx - radius) * w, (centery + cpOffset) * h));
  var radius = .05;
  var cpOffset = KAPPA * .05;
  var centerx = .375;
  var centery = .95;
  var fig5 = new go.PathFigure((centerx - radius) * w, centery * h, true);
  geo.add(fig5);
  fig5.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
    (centerx - cpOffset) * w, (centery - radius) * h));
  fig5.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,
    (centerx + radius) * w, (centery - cpOffset) * h));
  fig5.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig5.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
    (centerx - radius) * w, (centery + cpOffset) * h));
  var radius = .05;
  var cpOffset = KAPPA * .05;
  var centerx = .625;
  var centery = .95;
  var fig6 = new go.PathFigure((centerx - radius) * w, centery * h, true);
  geo.add(fig6);
  fig6.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
    (centerx - cpOffset) * w, (centery - radius) * h));
  fig6.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,
    (centerx + radius) * w, (centery - cpOffset) * h));
  fig6.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig6.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
    (centerx - radius) * w, (centery + cpOffset) * h));
  var radius = .05;
  var cpOffset = KAPPA * .05;
  var centerx = .825;
  var centery = .95;
  var fig7 = new go.PathFigure((centerx - radius) * w, centery * h, true);
  geo.add(fig7);
  fig7.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
    (centerx - cpOffset) * w, (centery - radius) * h));
  fig7.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,
    (centerx + radius) * w, (centery - cpOffset) * h));
  fig7.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig7.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
    (centerx - radius) * w, (centery + cpOffset) * h).close());
  var fig8 = new go.PathFigure(0, h, false);
  geo.add(fig8);
  fig8.add(new go.PathSegment(go.PathSegment.Line, w, h).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("Warehouse", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0).close());
  var fig2 = new go.PathFigure(0, 0.2 * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0.2 * h).close());
  var fig3 = new go.PathFigure(0.15 * w, h, true);
  geo.add(fig3);
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, 0.5 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.40 * w, 0.5 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.40 * w, h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, h).close());
  var radius = .05;
  var cpOffset = KAPPA * .05;
  var centerx = .35;
  var centery = .775;
  var fig4 = new go.PathFigure((centerx - radius) * w, centery * h, true);
  geo.add(fig4);
  // Door handle
  fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
  (centerx - cpOffset) * w, (centery - radius) * h));
  fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,
  (centerx + radius) * w, (centery - cpOffset) * h));
  fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
  (centerx + cpOffset) * w, (centery + radius) * h));
  fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
  (centerx - radius) * w, (centery + cpOffset) * h).close());;
  return geo;
});
 
go.Shape.defineFigureGenerator("ControlCenter", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0.8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.1 * w, 0.8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.8 * h).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("Bluetooth", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0.75 * h, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.75 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.25 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.75 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.25 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Bookmark", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.6 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.2 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.2 * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.4 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.4 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Bookmark", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.6 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.2 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.2 * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.4 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.4 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Globe", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0.5 * w, 0, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0, 0.5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, 0.5 * h, 0.75 * w, 0, w, 0.25 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, h, w, 0.75 * h, 0.75 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0.5 * h, 0.25 * w, h, 0, 0.75 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0, 0, 0.25 * h, 0.25 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, h, 0.15 * w, 0.25 * h, 0.15 * w, 0.75 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0, 0.85 * w, 0.75 * h, 0.85 * w, 0.25 * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.1675 * w, 0.15 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.8325 * w, 0.15 * h, 0.35 * w, 0.3 * h, 0.65 * w, 0.3 * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.1675 * w, 0.85 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.8325 * w, 0.85 * h, 0.35 * w, 0.7 * h, 0.65 * w, 0.7 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Wave", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0.25 * h, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.3 * w, 0.25 * h, 0.10 * w, 0, 0.2 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.7 * w, 0.25 * h, 0.425 * w, 0.5 * h, 0.575 * w, 0.5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, 0.25 * h, 0.8 * w, 0, 0.9 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.75 * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0, 0.25 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.75 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.3 * w, 0.75 * h, 0.10 * w, 0.5 * h, 0.2 * w, 0.5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.7 * w, 0.75 * h, 0.425 * w, h, 0.575 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, 0.75 * h, 0.8 * w, 0.5 * h, 0.9 * w, 0.5 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Operator", function(shape, w, h) {
  var geo = new go.Geometry();
  var radius = .3;
  var cpOffset = KAPPA * .3;
  var centerx = .5;
  var centery = .7;
  var fig = new go.PathFigure((centerx - radius) * w, centery * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
    (centerx - cpOffset) * w, (centery - radius) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,
    (centerx + radius) * w, (centery - cpOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
    (centerx - radius) * w, (centery + cpOffset) * h));
  var fig2 = new go.PathFigure(0, 0.7 * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, w, 0.7 * h, 0, 0, w, 0));
  return geo;
});
 
go.Shape.defineFigureGenerator("TripleFanBlades", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0.5 * w, 0, true);
  geo.add(fig);
 
  // Top blade
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.65 * h, 0.65 * w, 0.3 * h, 0.65 * w, 0.5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0, 0.35 * w, 0.5 * h, 0.35 * w, 0.3 * h));
  // Bottom left blade
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.65 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h, 0.3 * w, 0.6 * h, 0.1 * w, 0.8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.65 * h, 0.2 * w, h, 0.35 * w, 0.95 * h));
  // Bottom right blade
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.65 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, h, 0.7 * w, 0.6 * h, 0.9 * w, 0.8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.65 * h, 0.8 * w, h, 0.65 * w, 0.95 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("CentrifugalPump", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0.5 * h, 0, 0.075 * h, 0, 0.5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.4 * w, h, 0, h, 0.4 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.8 * w, 0.4 * h, 0.8 * w, h, 0.85 * w, 0.6 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.4 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
  return geo;
});
 
go.Shape.defineFigureGenerator("Battery", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.4 * w, 0.1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.1 * h));
  var fig2 = new go.PathFigure(0, 0.6 * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Move, 0, 0.4 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0.4 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Delete", function(shape, w, h) {
  var geo = new go.Geometry();
  var radius = .5;
  var cpOffset = KAPPA * .5;
  var centerx = .5;
  var centery = .5;
  var fig = new go.PathFigure((centerx - radius) * w, centery * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
    (centerx - cpOffset) * w, (centery - radius) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,
    (centerx + radius) * w, (centery - cpOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
    (centerx - radius) * w, (centery + cpOffset) * h));
  var fig2 = new go.PathFigure(0.15 * w, 0.5 * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.85 * w, 0.5 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Flag", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0.1 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0, 0.1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.1 * h, 0.15 * w, 0, 0.35 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, 0.1 * h, 0.65 * w, 0.2 * h, 0.85 * w, 0.2 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.5 * h, 0.85 * w, 0.6 * h, 0.65 * w, 0.6 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0.5 * h, 0.35 * w, 0.4 * h, 0.15 * w, 0.4 * h).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("Help", function(shape, w, h) {
  var geo = new go.Geometry();
  var radius = .5;
  var cpOffset = KAPPA * .5;
  var centerx = .5;
  var centery = .5;
  var fig = new go.PathFigure((centerx - radius) * w, centery * h, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
    (centerx - cpOffset) * w, (centery - radius) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,
    (centerx + radius) * w, (centery - cpOffset) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
    (centerx - radius) * w, (centery + cpOffset) * h).close());
  radius = .05;
  cpOffset = KAPPA * .05;
  centerx = .5;
  centery = .8;
  var fig2 = new go.PathFigure((centerx - radius) * w, centery * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,
    (centerx - cpOffset) * w, (centery - radius) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,
    (centerx + radius) * w, (centery - cpOffset) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,
    (centerx + cpOffset) * w, (centery + radius) * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,
    (centerx - radius) * w, (centery + cpOffset) * h).close());
  fig2.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.7 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.5 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.2 * h, 0.75 * w, 0.475 * h, 0.75 * w, 0.225 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0.3 * w, 0.35 * h, 0.4 * w, 0.2 * h, 0.3 * w, 0.25 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Location", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0.5 * w, h, true)
              .add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0.5 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0, .975 * w, 0.025 * h, 0.5 * w, 0))
              .add(new go.PathSegment(go.PathSegment.Bezier, 0.25 * w, 0.5 * h, 0.5 * w, 0, 0.025 * w, 0.025 * h).close())
              .add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.2 * h))
              .add(new go.PathSegment(go.PathSegment.Arc, 270, 360, 0.5 * w, 0.3 * h, 0.1 * w, 0.1 * h).close()));
});
 
go.Shape.defineFigureGenerator("Lock", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0.5 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h));
  var fig2 = new go.PathFigure(0.2 * w, 0.5 * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.5 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, 0.3 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0.8 * w, 0.3 * h, 0.25 * w, 0, 0.75 * w, 0));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.5 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.3 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Unlocked", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0.5 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h));
  var fig2 = new go.PathFigure(0.2 * w, 0.5 * h, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.5 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, 0.3 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0.8 * w, 0.3 * h, 0.25 * w, 0, 0.75 * w, 0));
  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.35 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Gear", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0.9375 * w, 0.56246875 * h, true)
              .add(new go.PathSegment(go.PathSegment.Line, 0.9375 * w, 0.4375 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.80621875 * w, 0.4375 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier, 0.763 * w, 0.3316875 * h, 0.79840625 * w, 0.39915625 * h, 0.7834375 * w, 0.3635 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.8566875 * w, 0.23796875 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.76825 * w, 0.14959375 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.67596875 * w, 0.24184375 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier, 0.5625 * w, 0.19378125 * h, 0.64228125 * w, 0.2188125 * h, 0.603875 * w, 0.2021875 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.5625 * w, 0.0625 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.4375 * w, 0.0625 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.4375 * w, 0.19378125 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier, 0.32775 * w, 0.239375 * h, 0.39759375 * w, 0.20190625 * h, 0.36053125 * w, 0.2176875 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.2379375 * w, 0.14959375 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.14953125 * w, 0.2379375 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.23934375 * w, 0.3278125 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier, 0.19378125 * w, 0.4375 * h, 0.21765625 * w, 0.36059375 * h, 0.201875 * w, 0.397625 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.0625 * w, 0.4375 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.0625 * w, 0.5625 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.1938125 * w, 0.5625 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier, 0.241875 * w, 0.67596875 * h, 0.20221875 * w, 0.603875 * h, 0.21884375 * w, 0.64228125 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.1495625 * w, 0.76825 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.238 * w, 0.8566875 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.3316875 * w, 0.76296875 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier, 0.43753125 * w, 0.80621875 * h, 0.36353125 * w, 0.78340625 * h, 0.3991875 * w, 0.79840625 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.43753125 * w, 0.9375 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.5625 * w, 0.9375 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.5625 * w, 0.80621875 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier, 0.67225 * w, 0.760625 * h, 0.602375 * w, 0.79809375 * h, 0.63946875 * w, 0.78234375 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.76828125 * w, 0.8566875 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.85671875 * w, 0.76825 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.76065625 * w, 0.67221875 * h))
              .add(new go.PathSegment(go.PathSegment.Bezier, 0.80621875 * w, 0.56246875 * h, 0.78234375 * w, 0.63940625 * h, 0.798125 * w, 0.602375 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.9375 * w, 0.56246875 * h).close())
 
              .add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.6 * h))
              .add(new go.PathSegment(go.PathSegment.Arc, 90, 360, 0.5 * w, 0.5 * h, 0.1 * w, 0.1 * h).close()));
});
 
go.Shape.defineFigureGenerator("Hand", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0.5 * h, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.1 * w, 0.3 * h, 0, 0.375 * h, 0.05 * w, 0.325 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.45 * w, 0.075 * h, 0.3 * w, 0.225 * h, 0.4 * w, 0.175 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.525 * w, 0.075 * h, 0.46 * w, 0.05 * h, 0.525 * w, 0.05 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.3 * w, 0.4 * h, 0.525 * w, 0.275 * h, 0.475 * w, 0.325 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.4 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.9 * w, 0.55 * h, w, 0.4 * h, w, 0.55 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.425 * w, 0.55 * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.6 * w, 0.55 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.6 * w, 0.7 * h, 0.675 * w, 0.55 * h, 0.675 * w, 0.7 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.7 * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.575 * w, 0.7 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.575 * w, 0.85 * h, 0.65 * w, 0.7 * h, 0.65 * w, 0.85 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.85 * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.525 * w, 0.85 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.535 * w, h, 0.61 * w, 0.85 * h, 0.61 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0.9 * h, 0.435 * w, h, 0, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h));
  geo.spot1 = new go.Spot(0, 0.6, 10, 0);
  geo.spot2 = new go.Spot(1, 1);
  return geo;
});
 
go.Shape.defineFigureGenerator("Map", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0.2 * h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.25 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.2 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.2 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0.8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.25 * w, 0.8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.25 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.25 * w, 0.8 * h));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.2 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h));
  fig.add(new go.PathSegment(go.PathSegment.Move, 0.75 * w, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0.8 * h));
  return geo;
});
 
go.Shape.defineFigureGenerator("Eject", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, h, true);
  geo.add(fig);
 
  // bottam rectangle section
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h * .7));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * .7).close());
  var fig2 = new go.PathFigure(0, (h * .6), true);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, w, (.6 * h)));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("Pencil", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, 0, true)
              .add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, 0.1 * h))
              .add(new go.PathSegment(go.PathSegment.Line, w, 0.9 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0.2 * h).close()));
  });
 
// JC
// Building that kinda looks like a bank
go.Shape.defineFigureGenerator("Building", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w * 1, h * 1, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * 1)); // bottom part
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * .85));
  fig.add(new go.PathSegment(go.PathSegment.Line, .046 * w, h * .85));
  fig.add(new go.PathSegment(go.PathSegment.Line, .046 * w, h * .45));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * .45));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * .30));
  fig.add(new go.PathSegment(go.PathSegment.Line, .046 * w, h * .30));
  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h * 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - .046) * w, h * .30));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h * .30));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h * .45));
  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - .046) * w, h * .45));
  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - .046) * w, h * .85));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h * .85).close());
  var geo2 = new go.Geometry();
  var fig2 = new go.PathFigure(.126 * w, .85 * h, false); // is filled in our not
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, .126 * w, .45 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .322 * w, .45 * h));
  fig2.add(new go.PathSegment(go.PathSegment.Line, .322 * w, .85 * h).close());
  var geo2 = new go.Geometry();
  var fig3 = new go.PathFigure(.402 * w, .85 * h, false); // is filled in our not
  geo.add(fig3);
  fig3.add(new go.PathSegment(go.PathSegment.Line, .402 * w, .45 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, .598 * w, .45 * h));
  fig3.add(new go.PathSegment(go.PathSegment.Line, .598 * w, .85 * h).close());
  var geo2 = new go.Geometry();
  var fig4 = new go.PathFigure(.678 * w, .85 * h, false); // is filled in our not
  geo.add(fig4);
  fig4.add(new go.PathSegment(go.PathSegment.Line, .678 * w, .45 * h));
  fig4.add(new go.PathSegment(go.PathSegment.Line, .874 * w, .45 * h));
  fig4.add(new go.PathSegment(go.PathSegment.Line, .874 * w, .85 * h).close());
  // the top inner triangle
  var geo3 = new go.Geometry();
  var fig5 = new go.PathFigure(.5 * w, .1 * h, false); // is filled in our not
  geo.add(fig5);
  fig5.add(new go.PathSegment(go.PathSegment.Line, (.046 + .15) * w, .30 * h));
  fig5.add(new go.PathSegment(go.PathSegment.Line, (1 - (.046 + .15)) * w, .30 * h).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("Staircase", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, h * 1, true);
  geo.add(fig);
 
  // Bottom part
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .20, h * 1)); // bottom left part
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .20, h * .80));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .40, h * .80));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .40, h * .60));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * .60));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * .40));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .80, h * .40));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .80, h * .20));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .20));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .15));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * .15));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * .35));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, h * .35));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, h * .55));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .35, h * .55));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .35, h * .75));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .15, h * .75));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .15, h * .95));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * .95).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("5Bars", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, h * 1, true); // bottom left
  geo.add(fig);
 
  // Width of each bar is .184
  // space in between each bar is .2
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .184, h * 1)); // bottom left part
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .184, h * (1 - .184)).close());
  var geo2 = new go.Geometry();
  var fig3 = new go.PathFigure(w * .204, h, true); // is filled in our not
  geo.add(fig3);
  fig3.add(new go.PathSegment(go.PathSegment.Line, w * .204, h * (1 - .184)));
  fig3.add(new go.PathSegment(go.PathSegment.Line, w * .388, h * (1 - (.184 * 2))));
  fig3.add(new go.PathSegment(go.PathSegment.Line, w * .388, h * 1).close());
  var geo3 = new go.Geometry();
  var fig4 = new go.PathFigure(w * .408, h, true); // is filled in our not
  geo.add(fig4);
  fig4.add(new go.PathSegment(go.PathSegment.Line, w * .408, h * (1 - (.184 * 2))));
  fig4.add(new go.PathSegment(go.PathSegment.Line, w * .592, h * (1 - (.184 * 3))));
  fig4.add(new go.PathSegment(go.PathSegment.Line, w * .592, h * 1).close());
  var geo4 = new go.Geometry();
  var fig5 = new go.PathFigure(w * .612, h, true); // is filled in our not
  geo.add(fig5);
  fig5.add(new go.PathSegment(go.PathSegment.Line, w * .612, h * (1 - (.184 * 3))));
  fig5.add(new go.PathSegment(go.PathSegment.Line, w * .796, h * (1 - (.184 * 4))));
  fig5.add(new go.PathSegment(go.PathSegment.Line, w * .796, h * 1).close());
  var geo5 = new go.Geometry();
  var fig6 = new go.PathFigure(w * .816, h, true); // is filled in our not
  geo.add(fig6);
  fig6.add(new go.PathSegment(go.PathSegment.Line, w * .816, h * (1 - (.184 * 4))));
  fig6.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * (1 - (.184 * 5))));
  fig6.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1).close());
  return geo;
});
 
// desktop
go.Shape.defineFigureGenerator("PC", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, true); // top right
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .3, h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .3, 0).close());
  // Drive looking rectangle 1
  var geo2 = new go.Geometry();
  var fig2 = new go.PathFigure(w * .055, .07 * h, true); // is filled in our not
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .245, h * .07));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .245, h * .1));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .055, h * .1).close());
  // Drive looking rectangle 2
  var geo3 = new go.Geometry();
  var fig3 = new go.PathFigure(w * .055, .13 * h, true); // is filled in our not
  geo.add(fig3);
  fig3.add(new go.PathSegment(go.PathSegment.Line, w * .245, h * .13));
  fig3.add(new go.PathSegment(go.PathSegment.Line, w * .245, h * .16));
  fig3.add(new go.PathSegment(go.PathSegment.Line, w * .055, h * .16).close());
  // Drive/cd rom looking rectangle 3
  var geo3 = new go.Geometry();
  var fig4 = new go.PathFigure(w * .055, .18 * h, true); // is filled in our not
  geo.add(fig4);
  fig4.add(new go.PathSegment(go.PathSegment.Line, w * .245, h * .18));
  fig4.add(new go.PathSegment(go.PathSegment.Line, w * .245, h * .21));
  fig4.add(new go.PathSegment(go.PathSegment.Line, w * .055, h * .21).close());
  var geo4 = new go.Geometry();
  var fig5 = new go.PathFigure(w * 1, 0, true); // is filled in our not
  geo.add(fig5);
  fig5.add(new go.PathSegment(go.PathSegment.Line, w * .4, 0));
  fig5.add(new go.PathSegment(go.PathSegment.Line, w * .4, h * .65));
  fig5.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .65).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("Plane", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0.55 * w, h, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.6 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.7 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, 0.475 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.35 * w, 0.525 * h, 0, 0.4 * h, 0.225 * w, 0.45 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.475 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, 0.35 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, 0.325 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.325 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.85 * w, 0.1 * h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.9 * w, 0.2 * h, 0.975 * w, 0, w, .08 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.7 * w, 0.45 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.95 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, h).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("Key", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w * 1, h * .5, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .9, 0.4 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .35, 0.4 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .35, 0.36 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .32, 0.36 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .275, 0.24 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .12, 0.24 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .08, 0.4 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .08, 0.5 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .08, 0.6 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .12, 0.76 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .275, 0.76 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .32, 0.64 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .35, 0.64 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .35, 0.60 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .41, 0.60 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .43, 0.58 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .475, 0.58 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .495, 0.60 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .52, 0.58 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .56, 0.58 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .6, 0.538 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .645, 0.538 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .69, 0.58 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .70, 0.58 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .73, 0.60 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, 0.58 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .76, 0.60 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .80, 0.538 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .82, 0.58 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .84, 0.538 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .85, 0.558 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .86, 0.538 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .88, 0.538 * h));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .9, 0.6 * h).close());
  var geo2 = new go.Geometry();
  var fig2 = new go.PathFigure(w * .18, h * .5, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Arc, 0, 360, w * 0.15, w * 0.5, w * 0.03)); // small circle on far left
  return geo;
});
 
// movie like logo
go.Shape.defineFigureGenerator("FilmTape", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(0, 0, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Arc, 270, 180, w * 0, w * 0.3, w * 0.055)); // left semi-circle
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .08, h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .08, h * .95));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 1), h * .95));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 1), h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 2), h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 2), h * .95));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 3), h * .95));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 3), h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 4), h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 4), h * .95));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 5), h * .95));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 5), h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 6), h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 6), h * .95));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 7), h * .95));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 7), h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 8), h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 8), h * .95));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 9), h * .95));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 9), h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 10), h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 10), h * .95));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 11), h * .95));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 11), h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 12), h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 12), h * .95));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 13), h * .95));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 13), h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 14), h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 14), h * .95));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 15), h * .95));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 15), h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1));
  var geo2 = new go.Geometry();
  var fig2 = new go.PathFigure(0, 0, false); // is filled in our not
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 0));
  fig2.add(new go.PathSegment(go.PathSegment.Arc, 270, -180, w * 1, w * 0.3, w * 0.055)); // right semi circle
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1));
  // Each of the little square boxes on the tape
  var geo3 = new go.Geometry();
  var fig3 = new go.PathFigure(w * .11, h * .1, false); // is filled in our not
  geo.add(fig3);
  fig3.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 1) + (.028 * 0)), h * .1));
  fig3.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 1) + (.028 * 0)), h * .8));
  fig3.add(new go.PathSegment(go.PathSegment.Line, w * .11, h * .8).close());
  var geo4 = new go.Geometry();
  var fig4 = new go.PathFigure(w * (.11 + (.24133333 * 1) + (.028 * 1)), h * .1, false); // is filled in our not
  geo.add(fig4);
  fig4.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 2) + (.028 * 1)), h * .1));
  fig4.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 2) + (.028 * 1)), h * .8));
  fig4.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 1) + (.028 * 1)), h * .8).close());
  var geo5 = new go.Geometry();
  var fig5 = new go.PathFigure(w * (.11 + (.24133333 * 2) + (.028 * 2)), h * .1, false); // is filled in our not
  geo.add(fig5);
  fig5.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 3) + (.028 * 2)), h * .1));
  fig5.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 3) + (.028 * 2)), h * .8));
  fig5.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 2) + (.028 * 2)), h * .8).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("FloppyDisk", function(shape, w, h) {
  var geo = new go.Geometry();
  var roundValue = 8;
  var cpOffset = roundValue * KAPPA;
  var fig = new go.PathFigure(roundValue, 0, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .86, 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .14));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h - roundValue));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w - roundValue, h, w, h - cpOffset, w - cpOffset, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, roundValue, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h - roundValue, cpOffset, h, 0, h - cpOffset));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, roundValue));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, roundValue, 0, 0, cpOffset, cpOffset, 0).close());
  // interior slightly  rectangle
  var geo2 = new go.Geometry();
  var fig2 = new go.PathFigure(w * .83, 0, false);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .83, h * .3));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .17, h * .3));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .17, h * 0).close());
  var geo3 = new go.Geometry();
  var fig3 = new go.PathFigure(w * .83, h * 1, false);
  geo.add(fig3);
  fig3.add(new go.PathSegment(go.PathSegment.Line, w * .83, h * .5));
  fig3.add(new go.PathSegment(go.PathSegment.Line, w * .17, h * .5));
  fig3.add(new go.PathSegment(go.PathSegment.Line, w * .17, h * 1).close());
  var geo4 = new go.Geometry();
  var fig4 = new go.PathFigure(w * .78, h * .05, false);
  geo.add(fig4);
  fig4.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * .05));
  fig4.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * .25));
  fig4.add(new go.PathSegment(go.PathSegment.Line, w * .78, h * .25).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("SpeechBubble", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = 25;
  var cpOffset = param1 * KAPPA;
  var fig = new go.PathFigure(param1, 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w - param1, 0));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, param1, w - cpOffset, 0, w, cpOffset));
  fig.add(new go.PathSegment(go.PathSegment.Line, w, (h * .60) - param1));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w - param1, (h * .60), w, (h * .60) - cpOffset, w - cpOffset, (h * .60)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .70, (h * .60)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .70, (h * .775)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, (h * .60)));
  fig.add(new go.PathSegment(go.PathSegment.Line, param1, (h * .60))); // ends at 25 
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, (h * .60) - param1, cpOffset, (h * .60), 0, (h * .60) - cpOffset));
  fig.add(new go.PathSegment(go.PathSegment.Line, 0, param1));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, param1, 0, 0, cpOffset, cpOffset, 0).close());
  if (cpOffset > 1) {
    geo.spot1 = new go.Spot(0, 0, cpOffset, cpOffset);
    geo.spot2 = new go.Spot(1, 1, -cpOffset, -cpOffset);
  } else {
    geo.spot1 = go.Spot.TopLeft;
    geo.spot2 = go.Spot.BottomRight;
  }
  return geo;
});
 
go.Shape.defineFigureGenerator("Repeat", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w * 0, h * .45, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .25, h * 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .50, h * .45));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .30, h * .45));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .30, h * .90));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * .90));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .65, h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .20, h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .20, h * .45).close());
  var geo2 = new go.Geometry();
  var fig2 = new go.PathFigure(w * 1, h * .55, true); // is filled in our not
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * 1));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .50, h * .55));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .70, h * .55));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .70, h * .10));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .40, h * .10));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .35, h * 0));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .80, h * 0));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .80, h * .55).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("Windows", function(shape, w, h) {
  return new go.Geometry()
         .add(new go.PathFigure(0, 0, true)
              .add(new go.PathSegment(go.PathSegment.Line, w, 0))
              .add(new go.PathSegment(go.PathSegment.Line, w, h))
              .add(new go.PathSegment(go.PathSegment.Line, 0, h).close())
              .add(new go.PathSegment(go.PathSegment.Move, 0.4 * w, 0.4 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.8 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.8 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.4 * h).close())
              .add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.1 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, 0.6 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.7 * w, 0.6 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.7 * w, 0.1 * h).close())
              .add(new go.PathSegment(go.PathSegment.Move, 0.1 * w, 0.6 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0.9 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.9 * h))
              .add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.6 * h).close()));
});
 
go.Shape.defineFigureGenerator("Terminal", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w * 0, h * .10, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .10));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .90));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 0, h * .90).close());
  var geo2 = new go.Geometry();
  var fig2 = new go.PathFigure(w * .10, h * .20, true); // is filled in our not
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .10, h * .25));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .22, h * .285)); // midpoint
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .10, h * .32));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .10, h * .37));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .275, h * .32));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .275, h * .25).close());
  var geo3 = new go.Geometry();
  var fig3 = new go.PathFigure(w * .28, h * .37, true); // is filled in our not
  geo.add(fig3);
  fig3.add(new go.PathSegment(go.PathSegment.Line, w * .45, h * .37));
  fig3.add(new go.PathSegment(go.PathSegment.Line, w * .45, h * .41));
  fig3.add(new go.PathSegment(go.PathSegment.Line, w * .28, h * .41).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("Beaker", function(shape, w, h) {
  var geo = new go.Geometry();
  var param1 = 15;
  var cpOffset = param1 * KAPPA;
  var fig = new go.PathFigure(w * .62, h * .475, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h - param1));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w - param1, h, w, h - cpOffset, w - cpOffset, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, param1, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h - param1, cpOffset, h, 0, h - cpOffset));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .38, h * .475));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .38, h * .03));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .36, h * 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .64, h * 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .62, h * .03).close());
  if (cpOffset > 1) {
    geo.spot1 = new go.Spot(0, 0, cpOffset, cpOffset);
    geo.spot2 = new go.Spot(1, 1, -cpOffset, -cpOffset);
  } else {
    geo.spot1 = go.Spot.TopLeft;
    geo.spot2 = go.Spot.BottomRight;
  }
  /*
  var param1 = 15;
var cpOffset = param1 * KAPPA;
  var fig = new go.PathFigure(w * .62, h *.475, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w, h - param1));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, w - param1, h, w, h - cpOffset, w - cpOffset, h));
  fig.add(new go.PathSegment(go.PathSegment.Line, param1, h));
  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h - param1, cpOffset, h, 0, h - cpOffset));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .38, h * .475));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .38, h * .03));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .36, h * 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .64, h * 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .62, h * .03).close());
  */
  return geo;
});
 
go.Shape.defineFigureGenerator("Download", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w * 0, h * 1, true);
  geo.add(fig);
 
  var third = .1 / .3; // just to keep values consistent
  // outer frame
  // starts bottom left
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * (1 - third)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .8, h * 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * .055));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .755, h * .055));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .93, h * (1 - third)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .64, h * (1 - third)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .61, h * .75));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .5, h * .75));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .39, h * .75));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .36, h * (1 - third)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .07, h * (1 - third)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .755), h * (.055)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .66), h * (.055)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .66), h * (0)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .8), h * (0)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 0, h * (1 - third)).close());
  // arrow pointing down
  var geo2 = new go.Geometry();
  var fig2 = new go.PathFigure(w * .40, h * 0, true);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .40, h * .44));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .26, h * .44));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .5, h * .66));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .26), h * .44));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * .44));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * 0).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("Bin", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w * 0, h * 1, true);
  geo.add(fig);
 
  var third = .1 / .3; // just to keep values consistent
  // outer frame
  // starts bottom left
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * (1 - third)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .8, h * 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * .055));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .755, h * .055));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .93, h * (1 - third)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .64, h * (1 - third)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .61, h * .75));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .5, h * .75));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .39, h * .75));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .36, h * (1 - third)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .07, h * (1 - third)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .755), h * (.055)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .66), h * (.055)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .66), h * (0)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .8), h * (0)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 0, h * (1 - third)).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("Upload", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w * 0, h * 1, true);
  geo.add(fig);
 
  var third = .1 / .3; // just to keep values consistent
  // outer frame
  // starts bottom left
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * (1 - third)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .8, h * 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * .055));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .755, h * .055));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .93, h * (1 - third)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .64, h * (1 - third)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .61, h * .75));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .5, h * .75));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .39, h * .75));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .36, h * (1 - third)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .07, h * (1 - third)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .755), h * (.055)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .66), h * (.055)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .66), h * (0)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .8), h * (0)));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 0, h * (1 - third)).close());
  var geo2 = new go.Geometry();
  var fig2 = new go.PathFigure(w * .5, h * 0, true);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .26, h * .25));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .40, h * .25));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .40, h * .63));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * .63));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * .25));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .74, h * .25).close());
 
  return geo;
});
 
go.Shape.defineFigureGenerator("EmptyDrink", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w * .15, h * 0, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .85, h * 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .70, h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .30, h * 1).close());
  return geo;
});
 
go.Shape.defineFigureGenerator("Drink", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w * .15, h * 0, false);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .85, h * 0));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .70, h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .30, h * 1).close());
 
  var geo2 = new go.Geometry();
  var fig2 = new go.PathFigure(w * .235, h * .28, true);
  geo.add(fig2);
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .765, h * .28));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .655, h * .97));
  fig2.add(new go.PathSegment(go.PathSegment.Line, w * .345, h * .97).close());
 
  return geo;
});
 
go.Shape.defineFigureGenerator("4Arrows", function(shape, w, h) {
  var geo = new go.Geometry();
  var fig = new go.PathFigure(w * .5, h * 0, true);
  geo.add(fig);
 
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .65, h * .25));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, h * .25));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, h * .45));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * .45));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * .35));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .5));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * .65));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * .55));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, h * .55));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, h * .75));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .65, h * .75));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .5, h * 1));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .35, h * .75));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .45, h * .75));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .45, h * .55));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .25, h * .55));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .25, h * .65));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * 0, h * .5));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .25, h * .35));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .25, h * .45));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .45, h * .45));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .45, h * .25));
  fig.add(new go.PathSegment(go.PathSegment.Line, w * .35, h * .25).close());
  return geo;
});
 
/*
go.Shape.defineFigureGenerator("CoffeeCup", function(shape, w, h) {
      var geo = new go.Geometry();
      var fig = new go.PathFigure(w * .2, h * 0, true);
      geo.add(fig);
    
    fig.add(new go.PathSegment(go.PathSegment.Line, w * .8, h * 0));
        fig.add(new go.PathSegment(go.PathSegment.Line, w * .8, h * .05));
    
      return geo;
  });
*/
 
go.Shape.defineFigureGenerator("Connector", "Ellipse");
go.Shape.defineFigureGenerator("Alternative", "TriangleUp");
go.Shape.defineFigureGenerator("Merge", "TriangleUp");
go.Shape.defineFigureGenerator("Decision", "Diamond");
go.Shape.defineFigureGenerator("DataTransmissions", "Hexagon");
go.Shape.defineFigureGenerator("Gate", "Crescent");
go.Shape.defineFigureGenerator("Delay", "HalfEllipse");
go.Shape.defineFigureGenerator("Input", "Parallelogram1");
go.Shape.defineFigureGenerator("ManualLoop", "ManualOperation");
go.Shape.defineFigureGenerator("ISOProcess", "Chevron");
go.Shape.defineFigureGenerator("MessageToUser", "SquareArrow");
go.Shape.defineFigureGenerator("MagneticData", "Cylinder1");
go.Shape.defineFigureGenerator("DirectData", "Cylinder4");
go.Shape.defineFigureGenerator("StoredData", "DataStorage");
go.Shape.defineFigureGenerator("SequentialData", "MagneticTape");
go.Shape.defineFigureGenerator("Subroutine", "Procedure");
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/FishboneLayout.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/FishboneLayout.js

Statements: 1.75% (3 / 171)      Branches: 0% (0 / 113)      Functions: 0% (0 / 13)      Lines: 1.92% (3 / 156)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253                                    1           2                                                                                                                                                                                                                                                                                                                                               1                                                                                                                        
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// FishboneLayout is a custom Layout derived from TreeLayout for creating "fishbone" diagrams.
// A fishbone diagram also requires a Link class that implements custom routing, FishboneLink,
// which is also defined in this file.
 
/**
* @constructor
* @extends TreeLayout
* @class
* This only works for angle === 0 or angle === 180.
* <p>
* This layout assumes Links are automatically routed in the way needed by fishbone diagrams,
* by using the FishboneLink class instead of go.Link.
*/
function FishboneLayout() {
  go.TreeLayout.call(this);
  this.alignment = go.TreeLayout.AlignmentBusBranching;
  this.setsPortSpot = false;
  this.setsChildPortSpot = false;
}
go.Diagram.inherit(FishboneLayout, go.TreeLayout);
 
FishboneLayout.prototype.makeNetwork = function(coll) {
  // assert(this.angle === 0 || this.angle === 180);
  // assert(this.alignment === go.TreeLayout.AlignmentBusBranching);
  // assert(this.path !== go.TreeLayout.PathSource);
 
  // call base method for standard behavior
  var net = go.TreeLayout.prototype.makeNetwork.call(this, coll);
  // make a copy of the collection of TreeVertexes
  // because we will be modifying the TreeNetwork.vertexes collection in the loop
  var verts = new go.List(go.TreeVertex).addAll(net.vertexes);
  verts.each(function(v) {
    // ignore leaves of tree
    if (v.destinationEdges.count === 0) return;
    if (v.destinationEdges.count % 2 === 1) {
      // if there's an odd number of real children, add two dummies
      var dummy = new go.TreeVertex();
      dummy.bounds = new go.Rect();
      dummy.focus = new go.Point();
      net.addVertex(dummy);
      net.linkVertexes(v, dummy, null);
    }
    // make sure there's an odd number of children, including at least one dummy;
    // commitNodes will move the parent node to where this dummy child node is placed
    var dummy2 = new go.TreeVertex();
    dummy2.bounds = v.bounds;
    dummy2.focus = v.focus;
    net.addVertex(dummy2);
    net.linkVertexes(v, dummy2, null);
  });
  return net;
};
 
FishboneLayout.prototype.assignTreeVertexValues = function(v) {
  go.TreeLayout.prototype.assignTreeVertexValues.call(this, v);
  v._direction = 0;  // add this property to each TreeVertex
  if (v.parent !== null) {
    // The parent node will be moved to where the last dummy will be;
    // reduce the space to account for the future hole.
    if (v.angle === 0 || v.angle === 180) {
      v.layerSpacing -= v.bounds.width;
    } else {
      v.layerSpacing -= v.bounds.height;
    }
  }
};
 
FishboneLayout.prototype.commitNodes = function() {
  // vertex Angle is set by BusBranching "inheritance";
  // assign spots assuming overall Angle === 0 or 180
  // and links are always connecting horizontal with vertical
  this.network.edges.each(function(e) {
    var link = e.link;
    if (link === null) return;
    link.fromSpot = go.Spot.None;
    link.toSpot = go.Spot.None;
 
    var v = e.fromVertex;
    var w = e.toVertex;
 
    if (v.angle === 0) {
      link.fromSpot = go.Spot.MiddleLeft;
    } else if (v.angle === 180) {
      link.fromSpot = go.Spot.MiddleRight;
    }
 
    if (w.angle === 0) {
      link.toSpot = go.Spot.MiddleLeft;
    } else if (w.angle === 180) {
      link.toSpot = go.Spot.MiddleRight;
    }
  });
 
  // move the parent node to the location of the last dummy
  this.network.vertexes.each(function(v) {
    var len = v.children.length;
    if (len === 0) return;  // ignore leaf nodes
    if (v.parent === null) return; // don't move root node
    var dummy2 = v.children[len-1];
    v.centerX = dummy2.centerX;
    v.centerY = dummy2.centerY;
  });
 
  var layout = this;
  this.network.vertexes.each(function(v) {
    if (v.parent === null) {
      layout.shift(v);
    }
  });
 
  // now actually change the Node.location of all nodes
  go.TreeLayout.prototype.commitNodes.call(this);
};
 
// don't use the standard routing done by TreeLayout
FishboneLayout.prototype.commitLinks = function() { };
 
FishboneLayout.prototype.shift = function(v) {
  var p = v.parent;
  if (p !== null && (v.angle === 90 || v.angle === 270)) {
    var g = p.parent;
    if (g !== null) {
      var shift = v.nodeSpacing;
      if (g._direction > 0) {
        if (g.angle === 90) {
          if (p.angle === 0) {
            v._direction = 1;
            if (v.angle === 270) this.shiftAll(2, -shift, p, v);
          } else if (p.angle === 180) {
            v._direction = -1;
            if (v.angle === 90) this.shiftAll(-2, shift, p, v);
          }
        } else if (g.angle === 270) {
          if (p.angle === 0) {
            v._direction = 1;
            if (v.angle === 90) this.shiftAll(2, -shift, p, v);
          } else if (p.angle === 180) {
            v._direction = -1;
            if (v.angle === 270) this.shiftAll(-2, shift, p, v);
          }
        }
      } else if (g._direction < 0) {
        if (g.angle === 90) {
          if (p.angle === 0) {
            v._direction = 1;
            if (v.angle === 90) this.shiftAll(2, -shift, p, v);
          } else if (p.angle === 180) {
            v._direction = -1;
            if (v.angle === 270) this.shiftAll(-2, shift, p, v);
          }
        } else if (g.angle === 270) {
          if (p.angle === 0) {
            v._direction = 1;
            if (v.angle === 270) this.shiftAll(2, -shift, p, v);
          } else if (p.angle === 180) {
            v._direction = -1;
            if (v.angle === 90) this.shiftAll(-2, shift, p, v);
          }
        }
      }
    } else {  // g === null: V is a child of the tree ROOT
      var dir = ((p.angle === 0) ? 1 : -1);
      v._direction = dir;
      this.shiftAll(dir, 0, p, v);
    }
  }
  for (var i = 0; i < v.children.length; i++) {
    var c = v.children[i];
    this.shift(c);
  };
};
 
FishboneLayout.prototype.shiftAll = function(direction, absolute, root, v) {
  // assert(root.angle === 0 || root.angle === 180);
  var locx = v.centerX;
  locx += direction * Math.abs(root.centerY - v.centerY) / 2;
  locx += absolute;
  v.centerX = locx;
  for (var i = 0; i < v.children.length; i++) {
    var c = v.children[i];
    this.shiftAll(direction, absolute, root, c);
  };
};
// end FishboneLayout
 
 
// FishboneLink has custom routing
function FishboneLink() {
  go.Link.call(this);
};
go.Diagram.inherit(FishboneLink, go.Link);
 
FishboneLink.prototype.computePoints = function() {
  var result = go.Link.prototype.computePoints.call(this);
  if (result) {
    // insert middle point to maintain horizontal lines
    if (this.fromSpot.equals(go.Spot.MiddleRight) || this.fromSpot.equals(go.Spot.MiddleLeft)) {
      var p1;
      // deal with root node being on the "wrong" side
      var fromnode = this.fromNode;
      if (fromnode.findLinksInto().count === 0) {
        // pretend the link is coming from the opposite direction than the declared FromSpot
        var fromport = this.fromPort;
        var fromctr = fromport.getDocumentPoint(go.Spot.Center);
        var fromfar = fromctr.copy();
        fromfar.x += (this.fromSpot.equals(go.Spot.MiddleLeft) ? 99999 : -99999);
        p1 = this.getLinkPointFromPoint(fromnode, fromport, fromctr, fromfar, true).copy();
        // update the route points
        this.setPoint(0, p1);
        var endseg = this.fromEndSegmentLength;
        if (isNaN(endseg)) endseg = fromport.fromEndSegmentLength;
        p1.x += (this.fromSpot.equals(go.Spot.MiddleLeft)) ? endseg : -endseg;
        this.setPoint(1, p1);
      } else {
        p1 = this.getPoint(1);  // points 0 & 1 should be OK already
      }
      var tonode = this.toNode;
      var toport = this.toPort;
      var toctr = toport.getDocumentPoint(go.Spot.Center);
      var far = toctr.copy();
      far.x += (this.fromSpot.equals(go.Spot.MiddleLeft)) ? -99999/2 : 99999/2;
      far.y += (toctr.y < p1.y) ? 99999 : -99999;
      var p2 = this.getLinkPointFromPoint(tonode, toport, toctr, far, false);
      this.setPoint(2, p2);
      var dx = Math.abs(p2.y-p1.y)/2;
      if (this.fromSpot.equals(go.Spot.MiddleLeft)) dx = -dx;
      this.insertPoint(2, new go.Point(p2.x+dx, p1.y));
    } else if (this.toSpot.equals(go.Spot.MiddleRight) || this.toSpot.equals(go.Spot.MiddleLeft)) {
      var p1 = this.getPoint(1);  // points 1 & 2 should be OK already
      var fromnode = this.fromNode;
      var fromport = this.fromPort;
      var parentlink = fromnode.findLinksInto().first();
      var fromctr = fromport.getDocumentPoint(go.Spot.Center);
      var far = fromctr.copy();
      far.x += (parentlink !== null && parentlink.fromSpot.equals(go.Spot.MiddleLeft)) ? -99999/2 : 99999/2;
      far.y += (fromctr.y < p1.y) ? 99999 : -99999;
      var p0 = this.getLinkPointFromPoint(fromnode, fromport, fromctr, far, true);
      this.setPoint(0, p0);
      var dx = Math.abs(p1.y-p0.y)/2;
      if (parentlink !== null && parentlink.fromSpot.equals(go.Spot.MiddleLeft)) dx = -dx;
      this.insertPoint(1, new go.Point(p0.x+dx, p1.y));
    }
  }
  return result;
};
// end FishboneLink
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/FloorPlanner.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/FloorPlanner.js

Statements: 3.31% (52 / 1569)      Branches: 0% (0 / 768)      Functions: 0% (0 / 215)      Lines: 3.92% (52 / 1327)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590                1                   1                                   1                             1                                     1                               1           1         1                 1                   2 2                             1               1               1           1                     1                                             1                           1                         1                           1                                       1             2                                                                                                                                                                                                                                                                                                                                                     1                 1                 1                                                                       1                                                                                   1                                                                                     1                             1                                                                                                                               1         1                                                                                                                             1                                                 1                                                                                                                                                                                                                                                                                                                                                                                       1                                             1                                                                                                                                                                                                                                                                                                                                                                                                                                             1                                                 1                                   1       1                                                 1                                                                                                                                                                                                                                                       1                       1                                                                                                                                                                                                                                                             1                                                                                           1               1                                       1                           1                                                                                                                                                                                                                                                                                                                                                                                                                                 1                                           1     1                                             1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
/*
* Copyright (C) 1998-2017 by Northwoods Software Corporation
* All Rights Reserved.
*
* FLOOR PLANNER CODE
* Provides core functionality for FloorPlanner.html
*/
 
function checkLocalStorage() {
    try {
        window.localStorage.setItem('item', 'item');
        window.localStorage.removeItem('item');
        return true;
    } catch (e) {
        return false;
    }
}
 
function updateFileList(id) {
    // displays cached floor plan files in the listboxes
    var listbox = document.getElementById(id);
    // remove any old listing of files
    var last;
    while (last = listbox.lastChild) listbox.removeChild(last);
    // now add all saved files to the listbox
    for (key in window.localStorage) {
        var storedFile = window.localStorage.getItem(key);
        if (!storedFile) continue;
        var option = document.createElement("option");
        option.value = key;
        option.text = key;
        listbox.add(option, null)
    }
}
 
// deletes selected file from local storage
function removeFile() {
    var listbox = document.getElementById("mySavedFiles2");
    // get selected filename
    var fileName = undefined;
    for (var i = 0; i < listbox.options.length; i++) {
        if (listbox.options[i].selected) fileName = listbox.options[i].text; // selected file
    }
    if (fileName !== undefined) {
        // removes file from local storage
        window.localStorage.removeItem(fileName);
        // the current document remains open, even if its storage was deleted
    }
    closeElement("removeDocument");
}
 
function loadFileToModel(str) {
    myDiagram.model = go.Model.fromJson(str);
    myDiagram.skipsUndoManager = true;
    myDiagram.startTransaction("generate walls");
    var wallParts = [];
    myDiagram.nodes.each(function (node) {
        if (node.category === "WallGroup") updateWall(node);
        if ((node.category === "WindowNode" || node.category === "DoorNode") && node.containingGroup !== null) wallParts.push(node);
    });
    updateUI();
 
    myDiagram.commitTransaction("generate walls");
    myDiagram.undoManager.isEnabled = true;
    myDiagram.addModelChangedListener(function (e) {
        if (e.isTransactionFinished) enableAll();
    });
    myDiagram.isModified = false;
}
 
function loadFile() {
    var listbox = document.getElementById("mySavedFiles");
    // get selected filename
    var fileName = undefined;
    for (var i = 0; i < listbox.options.length; i++) {
        if (listbox.options[i].selected) fileName = listbox.options[i].text; // selected file
    }
    if (fileName !== undefined) {
        var savedFile = window.localStorage.getItem(fileName);
        loadFileToModel(savedFile);
    }
    closeElement("openDocument");
}
 
// Store shared model state in the Model.modelData property
// (will be loaded by loadDiagramProperties)
function saveDiagramProperties() {
    myDiagram.model.modelData.position = go.Point.stringify(myDiagram.position);
}
 
// Called by myDiagram.addDiagramListener("InitialLayoutCompleted" ...,
// NOT directly by loadFile.
function loadDiagramProperties(e) {
    var pos = myDiagram.model.modelData.position;
    if (pos) myDiagram.position = go.Point.parse(pos);
}
 
function openElement(id, listid) {
    var panel = document.getElementById(id);
    if (panel.style.visibility === "hidden") {
        updateFileList(listid);
        panel.style.visibility = "visible";
    }
}
 
// hides the open/remove elements when the "X" button is pressed
function closeElement(id) {
    var panel = document.getElementById(id);
    if (id === "nodeInfoWindow") document.getElementById("nodeInfoWindowButton").innerHTML = "Show Node Info Help <p class='shortcut'> (Ctrl + I)</p>";
    if (id === "myPaletteWindow") document.getElementById("myPaletteWindowButton").innerHTML = "Show Palettes <p class='shortcut'> (Ctrl + P)</p>";
    if (id === "myOverviewWindow") document.getElementById("myOverviewWindowButton").innerHTML = "Show Overview <p class='shortcut'> (Ctrl + E)</p>";
    if (id === "optionsWindow") document.getElementById("optionsWindowButton").innerHTML = "Show Options <p class='shortcut'> (Ctrl + B)</p>";
    if (id === "statisticsWindow") document.getElementById("statisticsWindowButton").innerHTML = "Show Statistics <p class='shortcut'> (Ctrl + G)</p>";
    panel.style.visibility = "hidden";
}
 
var UnsavedFileName = "(Unsaved File)";
var DEFAULT_MODELDATA = {
    "units": "centimeters",
    "unitsAbbreviation": "cm",
    "gridSize": 10,
    "wallWidth": 5,
    "preferences": {
        showWallGuidelines: true,
        showWallLengths: true,
        showWallAngles: true,
        showOnlySmallWallAngles: true,
        showGrid: true,
        gridSnap: true
    }
};
 
function setCurrentFileName(name) {
    var currentFile = document.getElementById("currentFile");
    if (myDiagram.isModified) {
        name += "*";
    }
    currentFile.textContent = name;
}
 
function getCurrentFileName() {
    var currentFile = document.getElementById("currentFile");
    var name = currentFile.textContent;
    if (name[name.length - 1] === "*") return name.substr(0, name.length - 1);
    return name;
}
 
// enable or disable a particular button
function enable(name, ok) {
    var button = document.getElementById(name);
    if (button) button.disabled = !ok;
}
 
// enable or disable all context-sensitive command buttons
function enableAll() {
    var cmdhnd = myDiagram.commandHandler;
    enable("Undo", cmdhnd.canUndo());
    enable("Redo", cmdhnd.canRedo());
    enable("Cut", cmdhnd.canCutSelection());
    enable("Copy", cmdhnd.canCopySelection());
    enable("Paste", cmdhnd.canPasteSelection());
    enable("Delete", cmdhnd.canDeleteSelection());
    enable("SelectAll", cmdhnd.canSelectAll());
}
 
function newDocument() {
    // checks to see if all changes have been saved
    if (myDiagram.isModified) {
        var save = confirm("Would you like to save changes to " + getCurrentFileName() + "?");
        if (save) {
            saveDocument();
        }
    }
    setCurrentFileName(UnsavedFileName);
    // loads an empty diagram
    var model = new go.GraphLinksModel;
    // initialize all modelData
    model.modelData = DEFAULT_MODELDATA;
    myDiagram.model = model;
    myDiagram.undoManager.isEnabled = true;
    myDiagram.addModelChangedListener(function (e) {
        if (e.isTransactionFinished) enableAll();
    });
    myDiagram.isModified = false;
    updateUI();
}
 
// update the UI properly in accordance with model.modelData
function updateUI() {
    var modelData = myDiagram.model.modelData;
    changeUnits(modelData.units);
    // update options GUI based on model.modelData.preferences
    var preferences = modelData.preferences;
    document.getElementById("showGridCheckbox").checked = preferences.showGrid;
    document.getElementById("gridSnapCheckbox").checked = preferences.gridSnap;
    document.getElementById("wallGuidelinesCheckbox").checked = preferences.showWallGuidelines;
    document.getElementById("wallLengthsCheckbox").checked = preferences.showWallLengths;
    document.getElementById("wallAnglesCheckbox").checked = preferences.showWallAngles;
    document.getElementById("smallWallAnglesCheckbox").checked = preferences.showOnlySmallWallAngles;
}
 
// checks to see if all changes have been saved -> shows the open HTML element
function openDocument() {
    if (checkLocalStorage()) {
        if (myDiagram.isModified) {
            var save = confirm("Would you like to save changes to " + getCurrentFileName() + "?");
            if (save) {
                saveDocument();
            }
        }
        openElement("openDocument", "mySavedFiles");
    }
}
 
// saves the current floor plan to local storage
function saveDocument() {
    if (checkLocalStorage()) {
        var saveName = getCurrentFileName();
        if (saveName === UnsavedFileName) {
            saveDocumentAs();
        } else {
            saveDiagramProperties()
            window.localStorage.setItem(saveName, myDiagram.model.toJson());
            myDiagram.isModified = false;
        }
    }
}
 
// saves floor plan to local storage with a new name
function saveDocumentAs() {
    if (checkLocalStorage()) {
        var saveName = prompt("Save file as...", getCurrentFileName());
        // if saveName is already in list of files, ask if overwrite is ok
        if (saveName && saveName !== UnsavedFileName) {
            var override = true;
            if (window.localStorage.getItem(saveName) !== null) {
                override = confirm("Do you want to overwrite " + saveName + "?");
            }
            if (override) {
                setCurrentFileName(saveName);
                saveDiagramProperties()
                window.localStorage.setItem(saveName, myDiagram.model.toJson());
                myDiagram.isModified = false;
            }
        }
    }
}
 
// shows the remove file HTML element
function removeDocument() {
    if (checkLocalStorage()) {
        openElement("removeDocument", "mySavedFiles2");
    }
}
 
// if user closes browser with unsaved changes, let them know they may lose unsaved data
window.onbeforeunload = function (e) {
    if (myDiagram.isModified) {
        var e = e || window.event;
        //IE, Chrome, Firefox, Opera
        if (e) {
            e.returnValue = 'You have unsaved changes!';
        }
        // For Safari
        return 'You have unsaved changes!';
    }
};
 
/***************************************************NON-INIT() functionality **************************************************/
 
var furnitureNodeDataArray = [
 
              {
                  category: "MultiPurposeNode",
                  key: "MultiPurposeNode",
                  color: "#ffffff",
                  stroke: '#000000',
                  name: "Writable Node",
                  type: "Writable Node",
                  shape: "Rectangle",
                  text: "Write here",
                  width: 60,
                  height: 60,
                  notes: ""
              },
              {
                  key: "roundTable",
                  color: "#ffffff",
                  stroke: '#000000',
                  caption: "Round Table",
                  type: "Round Table",
                  shape: "Ellipse",
                  width: 61,
                  height: 61,
                  notes: ""
              },
              {
                  key: "armChair",
                  color: "#ffffff",
                  stroke: '#000000',
                  caption: "Arm Chair",
                  type: "Arm Chair",
                  geo: "F1 M0 0 L40 0 40 40 0 40 0 0 M10 30 L10 10 M0 0 Q8 0 10 10 M0 40 Q20 15 40 40 M30 10 Q32 0 40 0 M30 10 L30 30",
                  width: 45,
                  height: 45,
                  notes: ""
              },
              {
                  key: "sofaMedium",
                  color: "#ffffff",
                  stroke: "#000000",
                  caption: "Sofa",
                  type: "Sofa",
                  geo: "F1 M0 0 L80 0 80 40 0 40 0 0 M10 35 L10 10 M0 0 Q8 0 10 10 M0 40 Q40 15 80 40 M70 10 Q72 0 80 0 M70 10 L70 35",
                  height: 45,
                  width: 90,
                  notes: ""
              },
              {
                  key: "sink",
                  color: "#ffffff",
                  stroke: '#000000',
                  caption: "Sink",
                  type: "Sink",
                  geo: "F1 M0 0 L40 0 40 40 0 40 0 0z M5 7.5 L18.5 7.5 M 21.5 7.5 L35 7.5 35 35 5 35 5 7.5 M 15 21.25 A 5 5 180 1 0 15 21.24 M23 3.75 A 3 3 180 1 1 23 3.74 M21.5 6.25 L 21.5 12.5 18.5 12.5 18.5 6.25 M15 3.75 A 1 1 180 1 1 15 3.74 M 10 4.25 L 10 3.25 13 3.25 M 13 4.25 L 10 4.25 M27 3.75 A 1 1 180 1 1 27 3.74 M 26.85 3.25 L 30 3.25 30 4.25 M 26.85 4.25 L 30 4.25",
                  width: 27,
                  height: 27,
                  notes: ""
              },
              {
                  key: "doubleSink",
                  color: "#ffffff",
                  stroke: '#000000',
                  caption: "Double Sink",
                  type: "Double Sink",
                  geo: "F1 M0 0 L75 0 75 40 0 40 0 0 M5 7.5 L35 7.5 35 35 5 35 5 7.5 M44 7.5 L70 7.5 70 35 40 35 40 9 M15 21.25 A5 5 180 1 0 15 21.24 M50 21.25 A 5 5 180 1 0 50 21.24 M40.5 3.75 A3 3 180 1 1 40.5 3.74 M40.5 3.75 L50.5 13.75 47.5 16.5 37.5 6.75 M32.5 3.75 A 1 1 180 1 1 32.5 3.74 M 27.5 4.25 L 27.5 3.25 30.5 3.25 M 30.5 4.25 L 27.5 4.25 M44.5 3.75 A 1 1 180 1 1 44.5 3.74 M 44.35 3.25 L 47.5 3.25 47.5 4.25 M 44.35 4.25 L 47.5 4.25",
                  height: 27,
                  width: 52,
                  notes: ""
              },
              {
                  key: "toilet",
                  color: "#ffffff",
                  stroke: '#000000',
                  caption: "Toilet",
                  type: "Toilet",
                  geo: "F1 M0 0 L25 0 25 10 0 10 0 0 M20 10 L20 15 5 15 5 10 20 10 M5 15 Q0 15 0 25 Q0 40 12.5 40 Q25 40 25 25 Q25 15 20 15",
                  width: 25,
                  height: 35,
                  notes: ""
              },
              {
                  key: "shower",
                  color: "#ffffff",
                  stroke: '#000000',
                  caption: "Shower/Tub",
                  type: "Shower/Tub",
                  geo: "F1 M0 0 L40 0 40 60 0 60 0 0 M35 15 L35 55 5 55 5 15 Q5 5 20 5 Q35 5 35 15 M22.5 20 A2.5 2.5 180 1 1 22.5 19.99",
                  width: 45,
                  height: 75,
                  notes: ""
              },
              {
                  key: "bed",
                  color: "#ffffff",
                  stroke: '#000000',
                  caption: "Bed",
                  type: "Bed",
                  geo: "F1 M0 0 L40 0 40 60 0 60 0 0 M 7.5 2.5 L32.5 2.5 32.5 17.5 7.5 17.5 7.5 2.5 M0 20 L40 20 M0 25 L40 25",
                  width: 76.2,
                  height: 101.6,
                  notes: ""
              },
              {
                  key: "staircase",
                  color: "#ffffff",
                  stroke: '#000000',
                  caption: "Staircase",
                  type: "Staircase",
                  geo: "F1 M0 0 L 0 100 250 100 250 0 0 0 M25 100 L 25 0 M 50 100 L 50 0 M 75 100 L 75 0 M 100 100 L 100 0 M 125 100 L 125 0 M 150 100 L 150 0 M 175 100 L 175 0 M 200 100 L 200 0 M 225 100 L 225 0",
                  width: 125,
                  height: 50,
                  notes: ""
              },
              {
                  key: "stove",
                  color: "#ffffff",
                  stroke: '#000000',
                  caption: "Stove",
                  type: "Stove",
                  geo: "F1 M 0 0 L 0 100 100 100 100 0 0 0 M 30 15 A 15 15 180 1 0 30.01 15 M 70 15 A 15 15 180 1 0 70.01 15"
                  + "M 30 55 A 15 15 180 1 0 30.01 55 M 70 55 A 15 15 180 1 0 70.01 55",
                  width: 75,
                  height: 75,
                  notes: ""
              },
              {
                  key: "diningTable",
                  color: "#ffffff",
                  stroke: '#000000',
                  caption: "Dining Table",
                  type: "Dining Table",
                  geo: "F1 M 0 0 L 0 100 200 100 200 0 0 0 M 25 0 L 25 -10 75 -10 75 0 M 125 0 L 125 -10 175 -10 175 0 M 200 25 L 210 25 210 75 200 75 M 125 100 L 125 110 L 175 110 L 175 100 M 25 100 L 25 110 75 110 75 100 M 0 75 -10 75 -10 25 0 25",
                  width: 125,
                  height: 62.5,
                  notes: ""
              }
];
 
var searchFurniture = function () {
    var str = document.getElementById("furnitureSearchBar").value;
    var items = furnitureNodeDataArray.slice();
    if (str !== null && str !== undefined && str !== "") {
        for (var i = 0; i < items.length; i += 0) {
            var item = items[i];
            if (!item.type.toLowerCase().includes(str.toLowerCase())) {
                items.splice(i, 1);
            }
            else i++;
        }
        myPalette.model.nodeDataArray = items;
    }
    else myPalette.model.nodeDataArray = furnitureNodeDataArray;
    myPalette.updateAllRelationshipsFromData()
}
 
// checks what units are being used, converts to cm then divides by 2, (1px = 2cm, change this if you want to use a different paradigm)
function convertPixelsToUnits(num) {
    var units = myDiagram.model.modelData.units;
    if (units === 'meters') return (num / 100) * 2;
    if (units === 'feet') return (num / 30.48) * 2;
    if (units === 'inches') return (num / 2.54) * 2;
    return num * 2;
}
 
// takes a number of units, converts to cm, then divides by 2, since 1px = 2cm (change this if you want to use a different paradigm)
function convertUnitsToPixels(num) {
    var units = myDiagram.model.modelData.units;
    if (units === 'meters') return (num * 100) / 2;
    if (units === 'feet') return (num * 30.48) / 2;
    if (units === 'inches') return (num * 2.54) / 2;
    return num / 2;
}
 
// adjust units based on the selected radio button in the Options Menu
function changeUnits() {
    myDiagram.startTransaction("set units");
    var prevUnits = myDiagram.model.modelData.units;
    var radios = document.forms["unitsForm"].elements["units"];
    for (var i = 0; i < radios.length; i++) {
        if (radios[i].checked) {
            myDiagram.model.setDataProperty(myDiagram.model.modelData, "units", radios[i].id);
        }
    }
    var units = myDiagram.model.modelData.units;
    switch (units) {
        case 'centimeters': myDiagram.model.setDataProperty(myDiagram.model.modelData, "unitsAbbreviation", 'cm'); break;
        case 'meters': myDiagram.model.setDataProperty(myDiagram.model.modelData, "unitsAbbreviation", 'm'); break;
        case 'feet': myDiagram.model.setDataProperty(myDiagram.model.modelData, "unitsAbbreviation", 'ft'); break;
        case 'inches': myDiagram.model.setDataProperty(myDiagram.model.modelData, "unitsAbbreviation", 'in'); break;
    }
    var unitsAbbreviation = myDiagram.model.modelData.unitsAbbreviation;
    // update all units boxes with new units
    var unitAbbrevInputs = document.getElementsByClassName('unitsBox');
    for (var i = 0; i < unitAbbrevInputs.length; i++) {
        unitAbbrevInputs[i].value = unitsAbbreviation;
    }
    var unitInputs = document.getElementsByClassName('unitsInput');
    for (var i = 0; i < unitInputs.length; i++) {
        var input = unitInputs[i];
        myDiagram.model.setDataProperty(myDiagram.model.modelData, "units", prevUnits);
        var value = convertUnitsToPixels(input.value);
        myDiagram.model.setDataProperty(myDiagram.model.modelData, "units", units)
        value = convertPixelsToUnits(value);
        input.value = value;
    }
    if (myDiagram.selection.count === 1) setSelectionInfo(myDiagram.selection.first()); // reload node info measurements according to new units
    myDiagram.commitTransaction("set units");
}
 
// set current tool (selecting/dragging or wallbuilding/reshaping)
function setBehavior(string) {
    var wallBuildingTool = myDiagram.toolManager.mouseDownTools.elt(0);
    var wallReshapingTool = myDiagram.toolManager.mouseDownTools.elt(3);
    // style the current tool HTML button accordingly
    var elements = document.getElementsByClassName('setBehavior');
    for (var i = 0; i < elements.length; i++) {
        var el = elements[i];
        if (el.id === string + "Button") el.style.backgroundColor = '#4b545f';
        else el.style.backgroundColor = '#bbbbbb';
    }
    if (string === 'wallBuilding') {
        wallBuildingTool.isEnabled = true;
        wallReshapingTool.isEnabled = false;
 
        myDiagram.skipsUndoManager = true;
        myDiagram.startTransaction("change wallWidth");
        // create walls with wallWidth in input box
        myDiagram.model.setDataProperty(myDiagram.model.modelData, 'wallWidth', parseFloat(document.getElementById('wallWidthInput').value));
        var wallWidth = myDiagram.model.modelData.wallWidth;
        if (isNaN(wallWidth)) myDiagram.model.setDataProperty(myDiagram.model.modelData, 'wallWidth', 5);
        else {
            var width = convertUnitsToPixels(wallWidth);
            myDiagram.model.setDataProperty(myDiagram.model.modelData, 'wallWidth', width);
        }
        myDiagram.commitTransaction("change wallWidth");
        myDiagram.skipsUndoManager = false;
        document.getElementById('wallWidthBox').style.visibility = 'visible';
        document.getElementById('wallWidthBox').style.display = 'inline-block';
        setDiagramHelper("Click and drag on the diagram to draw a wall (hold SHIFT for 45 degree angles)");
    }
    if (string === 'dragging') {
        wallBuildingTool.isEnabled = false;
        wallReshapingTool.isEnabled = true;
        document.getElementById('wallWidthBox').style.visibility = 'hidden';
        document.getElementById('wallWidthBox').style.display = 'none';
    }
    // clear resize adornments on walls/windows, if there are any
    myDiagram.nodes.iterator.each(function (n) { n.clearAdornments(); })
    myDiagram.clearSelection();
}
 
// returns inverted color (in hex) of a given hex code color; used to determine furniture node stroke color
function invertColor(hexnum) {
    if (hexnum.includes('#')) hexnum = hexnum.substring(1);
    if (hexnum.length != 6) {
        console.error("Hex color must be six hex numbers in length.");
        return false;
    }
 
    hexnum = hexnum.toUpperCase();
    var splitnum = hexnum.split("");
    var resultnum = "";
    var simplenum = "FEDCBA9876".split("");
    var complexnum = new Array();
    complexnum.A = "5";
    complexnum.B = "4";
    complexnum.C = "3";
    complexnum.D = "2";
    complexnum.E = "1";
    complexnum.F = "0";
 
    for (i = 0; i < 6; i++) {
        if (!isNaN(splitnum[i])) {
            resultnum += simplenum[splitnum[i]];
        } else if (complexnum[splitnum[i]]) {
            resultnum += complexnum[splitnum[i]];
        } else {
            console.error("Hex colors must only include hex numbers 0-9, and A-F");
            return false;
        }
    }
    return '#' + resultnum;
}
 
// returns a given color (in hex) lightened by a given percentage
var lightenColor = function (color, percent) {
    var num = parseInt(color, 16),
        amt = Math.round(2.55 * percent),
        R = (num >> 16) + amt,
        B = (num >> 8 & 0x00FF) + amt,
        G = (num & 0x0000FF) + amt;
    return '#' + (0x1000000 + (R < 255 ? R < 1 ? 0 : R : 255) * 0x10000 + (B < 255 ? B < 1 ? 0 : B : 255) * 0x100 + (G < 255 ? G < 1 ? 0 : G : 255)).toString(16).slice(1);
};
 
// find and return an array of the endpoints of a given wallpart (window or door)
function getWallPartEndpoints(wallPart) {
    var loc = wallPart.location;
    var partLength = wallPart.data.width;
    if (wallPart.containingGroup !== null) var angle = wallPart.containingGroup.rotateObject.angle;
    else var angle = 180;
    var point1 = new go.Point((loc.x + (partLength / 2)), loc.y);
    var point2 = new go.Point((loc.x - (partLength / 2)), loc.y);
    point1.offset(-loc.x, -loc.y).rotate(angle).offset(loc.x, loc.y);
    point2.offset(-loc.x, -loc.y).rotate(angle).offset(loc.x, loc.y);
    var arr = []; arr.push(point1); arr.push(point2);
    return arr;
}
 
// returns a "stretch" (2 Points) that constrains a wallPart (door or window)
// this stretch is comprised of either "part"'s containing wall endpoints or other wallPart endpoints
function getWallPartStretch(part) {
    var wall = part.containingGroup;
    var startpoint = wall.data.startpoint.copy();
    var endpoint = wall.data.endpoint.copy();
 
    // sort all possible endpoints into either left/above or right/below
    var leftOrAbove = new go.Set(go.Point); var rightOrBelow = new go.Set(go.Point);
    wall.memberParts.iterator.each(function (wallPart) {
        if (wallPart.data.key !== part.data.key) {
            var endpoints = getWallPartEndpoints(wallPart);
            for (var i = 0; i < endpoints.length; i++) {
                if (endpoints[i].x < part.location.x || (endpoints[i].y > part.location.y && endpoints[i].x === part.location.x)) leftOrAbove.add(endpoints[i]);
                else rightOrBelow.add(endpoints[i]);
            }
        }
    });
 
    // do the same with the startpoint and endpoint of the dragging part's wall
    if (parseFloat(startpoint.x.toFixed(2)) < parseFloat(part.location.x.toFixed(2)) || (startpoint.y > part.location.y && parseFloat(startpoint.x.toFixed(2)) === parseFloat(part.location.x.toFixed(2)))) leftOrAbove.add(startpoint);
    else rightOrBelow.add(startpoint);
    if (parseFloat(endpoint.x.toFixed(2)) < parseFloat(part.location.x.toFixed(2)) || (endpoint.y > part.location.y && parseFloat(endpoint.x.toFixed(2)) === parseFloat(part.location.x.toFixed(2)))) leftOrAbove.add(endpoint);
    else rightOrBelow.add(endpoint);
 
    // of each set, find the closest point to the dragging part
    var leftOrAbovePt; var closestDistLeftOrAbove = Number.MAX_VALUE;
    leftOrAbove.iterator.each(function (point) {
        var distance = Math.sqrt(point.distanceSquaredPoint(part.location));
        if (distance < closestDistLeftOrAbove) {
            closestDistLeftOrAbove = distance;
            leftOrAbovePt = point;
        }
    });
    var rightOrBelowPt; var closestDistRightOrBelow = Number.MAX_VALUE;
    rightOrBelow.iterator.each(function (point) {
        var distance = Math.sqrt(point.distanceSquaredPoint(part.location));
        if (distance < closestDistRightOrBelow) {
            closestDistRightOrBelow = distance;
            rightOrBelowPt = point;
        }
    });
 
    var stretch = { point1: leftOrAbovePt, point2: rightOrBelowPt };
    return stretch;
}
 
// update the geometry, angle, and location of a given wall
var updateWall = function (wall) {
    var shape = wall.findObject("SHAPE");
    var geo = new go.Geometry(go.Geometry.Line);
    var sPt = wall.data.startpoint;
    var ePt = wall.data.endpoint;
    var mPt = new go.Point((sPt.x + ePt.x) / 2, (sPt.y + ePt.y) / 2);
    // define a wall's geometry as a simple horizontal line, then rotate it
    geo.startX = 0;
    geo.startY = 0;
    geo.endX = Math.sqrt(sPt.distanceSquaredPoint(ePt));
    geo.endY = 0;
    shape.geometry = geo;
    wall.location = mPt; // a wall's location is the midpoint between it's startpoint and endpoint
    var angle = sPt.directionPoint(ePt);
    wall.rotateObject.angle = angle;
    updateWallDimensions();
}
 
function makePointNode() {
    var $ = go.GraphObject.make;
    return $(go.Node, "Position", new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify));
}
 
function makeDimensionLink() {
    var $ = go.GraphObject.make;
    return $(go.Link, { locationSpot: go.Spot.TopLeft },
        $(go.Shape, { stroke: "gray", strokeWidth: 2, name: 'SHAPE' }),
        $(go.Shape, { toArrow: "OpenTriangle", stroke: "gray", strokeWidth: 2 }),
        $(go.Shape, { fromArrow: "BackwardOpenTriangle", stroke: "gray", strokeWidth: 2 }),
        $(go.TextBlock, { text: 'sometext', segmentOffset: new go.Point(0, -10), font: "13px sans-serif" },
            new go.Binding("text", "", function (link) {
                var fromPtNode = null; var toPtNode = null;
                allPointNodes.iterator.each(function (node) {
                    if (node.data.key === link.data.from) fromPtNode = node;
                    if (node.data.key === link.data.to) toPtNode = node;
                });
                if (fromPtNode !== null) {
                    var fromPt = fromPtNode.location;
                    var toPt = toPtNode.location;
                    return convertPixelsToUnits(Math.sqrt(fromPt.distanceSquaredPoint(toPt))).toFixed(2) + myDiagram.model.modelData.unitsAbbreviation;
                } return null;
            }).ofObject(),
            new go.Binding("angle", "angle", function (angle, link) {
                if (angle > 90 && angle < 270) return (angle + 180) % 360;
                return angle;
            }),
            new go.Binding("segmentOffset", "angle", function (angle, textblock) {
                var wall = myDiagram.findPartForKey(textblock.part.data.wall);
                if (wall.rotateObject.angle > 135 && wall.rotateObject.angle < 315) return new go.Point(0, 10);
                return new go.Point(0, -10);
            }).ofObject(),
            // scale font size according to the length of the link
            new go.Binding("font", "", function (link) {
                var fromPtNode = null; var toPtNode = null;
                allPointNodes.iterator.each(function (node) {
                    if (node.data.key === link.data.from) fromPtNode = node;
                    if (node.data.key === link.data.to) toPtNode = node;
                });
                if (fromPtNode !== null) {
                    var fromPt = fromPtNode.location;
                    var toPt = toPtNode.location;
                    var distance = Math.sqrt(fromPt.distanceSquaredPoint(toPt));
                    if (distance > 40) return "13px sans-serif";
                    if (distance <= 40 && distance >= 20) return "11px sans-serif";
                    else return "9px sans-serif";
                } return "13px sans-serif";
            }).ofObject()
        )
    )
}
 
var allPointNodes = new go.Set(go.Node);
var allDimensionLinks = new go.Set(go.Link);
 
// update the Dimension Links shown along a wall, based on which wallParts are selected
var updateWallDimensions = function () {
    /* helper function to build dimension links
        Parameters:
        "wall": {WallGroup} the wall the Link runs along (either describing the wall itself or some wallPart on "wall")
        "index": {Number} number appended to PointNode keys; used for finding PointNodes of Dimension Links later on
        "point1": {Point} the first point of the wallPart being described by the Link
        "point2": {Point} the second point of the wallPart being described by the Link
        "angle": {Number} the angle of the wallPart
        "wallOffset": {Number} how far from the wall (in px) the Link should be
        "soloWallFlag": {Boolean} if this Link is the only Dimension Link for "wall" (no other wallParts on "wall" selected) this is true; else, false
    */
    function buildDimensionLink(wall, index, point1, point2, angle, wallOffset, soloWallFlag) {
        point1 = getAdjustedPoint(point1, wall, angle, wallOffset);
        point2 = getAdjustedPoint(point2, wall, angle, wallOffset);
        var data1 = { key: wall.data.key + "PointNode" + index, category: "PointNode", loc: go.Point.stringify(point1) };
        var data2 = { key: wall.data.key + "PointNode" + (index + 1), category: "PointNode", loc: go.Point.stringify(point2) };
        var data3 = { key: wall.data.key + "DimensionLink", category: 'DimensionLink', from: data1.key, to: data2.key, stroke: 'gray', angle: angle, wall: wall.data.key, soloWallFlag: soloWallFlag };
        var pointNode1 = makePointNode();
        var pointNode2 = makePointNode();
        var link = makeDimensionLink();
 
        allPointNodes.add(pointNode1);
        allPointNodes.add(pointNode2);
        allDimensionLinks.add(link);
        myDiagram.add(pointNode1);
        myDiagram.add(pointNode2);
        myDiagram.add(link);
 
        pointNode1.data = data1;
        pointNode2.data = data2;
        link.data = data3;
        link.fromNode = pointNode1;
        link.toNode = pointNode2;
    }
 
    // helper function: get a to/from point for a Dimension Link, based on wall/wallpart's endpoint angle, and a given wallOffset (dist from wall)
    function getAdjustedPoint(point, wall, angle, wallOffset) {
        var oldPoint = point.copy();
        point.offset(0, -(wall.data.strokeWidth * .5) - wallOffset);
        point.offset(-oldPoint.x, -oldPoint.y).rotate(angle).offset(oldPoint.x, oldPoint.y);
        return point;
    }
    myDiagram.skipsUndoManager = true;
    myDiagram.startTransaction("update wall dimensions");
    // if showWallLengths === false, remove all pointNodes (used to build wall dimensions)
    if (!myDiagram.model.modelData.preferences.showWallLengths) {
        allPointNodes.iterator.each(function (node) { myDiagram.remove(node); });
        allDimensionLinks.iterator.each(function (link) { myDiagram.remove(link); });
        allPointNodes.clear();
        allDimensionLinks.clear();
        myDiagram.commitTransaction("update wall dimensions");
        myDiagram.skipsUndoManager = false;
        return;
    }
    // make visible all dimension links (zero-length dimension links are set to invisible at the end of the function) 
    allDimensionLinks.iterator.each(function (link) { link.visible = true; });
 
    var selection = myDiagram.selection;
    // gather all selected walls, including walls of selected DoorNodes and WindowNodes
    var walls = new go.Set(go.Group);
    selection.iterator.each(function (part) {
        if ((part.category === 'WindowNode' || part.category === 'DoorNode') && part.containingGroup !== null) walls.add(part.containingGroup);
        if (part.category === 'WallGroup' && part.data !== null) {
            var soloWallLink = null;
            allDimensionLinks.iterator.each(function (link) { if (link.data.soloWallFlag && link.data.wall === part.data.key) soloWallLink = link; });
            // if there's 1 Dimension Link for this wall (link has soloWallFlag), adjust to/from pointNodes of link, rather than deleting / redrawing
            if (soloWallLink !== null) {
                // since this is the only Dimension Link for this wall, keys of its pointNodes will be (wall.data.key) + 1 / (wall.data.key) + 2
                var linkPoint1 = null; var linkPoint2 = null;
                allPointNodes.iterator.each(function (node) {
                    if (node.data.key === part.data.key + "PointNode1") linkPoint1 = node;
                    if (node.data.key === part.data.key + "PointNode2") linkPoint2 = node;
                });
 
                var startpoint = part.data.startpoint; var endpoint = part.data.endpoint;
                // adjust  left/top-most / right/bottom-most wall endpoints so link angle is correct (else text appears on wrong side of Link)
                var firstWallPt = ((startpoint.x + startpoint.y) <= (endpoint.x + endpoint.y)) ? startpoint : endpoint;
                var lastWallPt = ((startpoint.x + startpoint.y) > (endpoint.x + endpoint.y)) ? startpoint : endpoint;
                var newLoc1 = getAdjustedPoint(firstWallPt.copy(), part, part.rotateObject.angle, 10);
                var newLoc2 = getAdjustedPoint(lastWallPt.copy(), part, part.rotateObject.angle, 10);
                linkPoint1.data.loc = go.Point.stringify(newLoc1);
                linkPoint2.data.loc = go.Point.stringify(newLoc2);
                soloWallLink.data.angle = part.rotateObject.angle;
                linkPoint1.updateTargetBindings();
                linkPoint2.updateTargetBindings();
                soloWallLink.updateTargetBindings();
            }
            // else build a Dimension Link for this wall; this is removed / replaced if Dimension Links for wallParts this wall are built
            else {
                var startpoint = part.data.startpoint;
                var endpoint = part.data.endpoint;
                var firstWallPt = ((startpoint.x + startpoint.y) <= (endpoint.x + endpoint.y)) ? startpoint : endpoint;
                var lastWallPt = ((startpoint.x + startpoint.y) > (endpoint.x + endpoint.y)) ? startpoint : endpoint;
                buildDimensionLink(part, 1, firstWallPt.copy(), lastWallPt.copy(), part.rotateObject.angle, 10, true);
            }
        }
    });
    // create array of selected wall endpoints and selected wallPart endpoints along the wall that represent measured stretches
    walls.iterator.each(function (wall) {
        var startpoint = wall.data.startpoint;
        var endpoint = wall.data.endpoint;
        var firstWallPt = ((startpoint.x + startpoint.y) <= (endpoint.x + endpoint.y)) ? startpoint : endpoint;
        var lastWallPt = ((startpoint.x + startpoint.y) > (endpoint.x + endpoint.y)) ? startpoint : endpoint;
 
        // store all endpoints along with the part they correspond to (used later to either create DimensionLinks or simply adjust them)
        var wallPartEndpoints = [];
        wall.memberParts.iterator.each(function (wallPart) {
            if (wallPart.isSelected) {
                var endpoints = getWallPartEndpoints(wallPart);
                wallPartEndpoints.push(endpoints[0]);
                wallPartEndpoints.push(endpoints[1]);
            }
        });
        // sort all wallPartEndpoints by x coordinate left to right/ up to down
        wallPartEndpoints.sort(function (a, b) {
            if ((a.x + a.y) > (b.x + b.y)) return 1;
            if ((a.x + a.y) < (b.x + b.y)) return -1;
            else return 0;
        });
        wallPartEndpoints.unshift(firstWallPt);
        wallPartEndpoints.push(lastWallPt);
 
        var angle = wall.rotateObject.angle;
        var k = 1; // k is a counter for the indices of PointNodes
        // build / edit dimension links for each stretch, defined by pairs of points in wallPartEndpoints
        for (var j = 0; j < wallPartEndpoints.length - 1; j++) {
            var linkPoint1 = null; linkPoint2 = null;
            allPointNodes.iterator.each(function (node) {
                if (node.data.key === wall.data.key + "PointNode" + k) linkPoint1 = node;
                if (node.data.key === wall.data.key + "PointNode" + (k + 1)) linkPoint2 = node;
            });
            if (linkPoint1 !== null) {
                var newLoc1 = getAdjustedPoint(wallPartEndpoints[j].copy(), wall, angle, 5);
                var newLoc2 = getAdjustedPoint(wallPartEndpoints[j + 1].copy(), wall, angle, 5);
                linkPoint1.data.loc = go.Point.stringify(newLoc1);
                linkPoint2.data.loc = go.Point.stringify(newLoc2);
                linkPoint1.updateTargetBindings();
                linkPoint2.updateTargetBindings();
            }
                // only build new links if needed -- normally simply change pointNode locations
            else buildDimensionLink(wall, k, wallPartEndpoints[j].copy(), wallPartEndpoints[j + 1].copy(), angle, 5, false);
            k += 2;
        }
        // total wall Dimension Link would be constructed of a kth and k+1st pointNode
        var totalWallDimensionLink = null;
        allDimensionLinks.iterator.each(function (link) {
            if ((link.fromNode.data.key === wall.data.key + "PointNode" + k) &&
                (link.toNode.data.key === wall.data.key + "PointNode" + (k + 1))) totalWallDimensionLink = link;
        });
        // if a total wall Dimension Link already exists, adjust its constituent point nodes
        if (totalWallDimensionLink !== null) {
            var linkPoint1 = null; var linkPoint2 = null;
            allPointNodes.iterator.each(function (node) {
                if (node.data.key === wall.data.key + "PointNode" + k) linkPoint1 = node;
                if (node.data.key === wall.data.key + "PointNode" + (k + 1)) linkPoint2 = node;
            });
            var newLoc1 = getAdjustedPoint(wallPartEndpoints[0].copy(), wall, angle, 25);
            var newLoc2 = getAdjustedPoint(wallPartEndpoints[wallPartEndpoints.length - 1].copy(), wall, angle, 25);
            linkPoint1.data.loc = go.Point.stringify(newLoc1);
            linkPoint2.data.loc = go.Point.stringify(newLoc2);
            linkPoint1.updateTargetBindings();
            linkPoint2.updateTargetBindings();
        }
            // only build total wall Dimension Link (far out from wall to accomodate wallPart Dimension Links) if one does not already exist
        else buildDimensionLink(wall, k, wallPartEndpoints[0].copy(), wallPartEndpoints[wallPartEndpoints.length - 1].copy(), angle, 25, false);
    });
 
    // Cleanup: hide zero-length Dimension Links
    allDimensionLinks.iterator.each(function (link) {
        var length = Math.sqrt(link.toNode.location.distanceSquaredPoint(link.fromNode.location));
        if (length < 1 && !link.data.soloWallFlag) link.visible = false;
    });
 
    myDiagram.commitTransaction("update wall dimensions");
    myDiagram.skipsUndoManager = false;
}
 
// helper function for updateWallAngles(); returns the Point where two walls intersect; if they do not intersect, return null
var getWallsIntersection = function (wall1, wall2) {
    if (wall1 === null || wall2 === null) return null;
    // treat walls as lines; get lines in formula of ax + by = c
    var a1 = wall1.data.endpoint.y - wall1.data.startpoint.y;
    var b1 = wall1.data.startpoint.x - wall1.data.endpoint.x;
    var c1 = (a1 * wall1.data.startpoint.x) + (b1 * wall1.data.startpoint.y);
    var a2 = wall2.data.endpoint.y - wall2.data.startpoint.y;
    var b2 = wall2.data.startpoint.x - wall2.data.endpoint.x;
    var c2 = (a2 * wall2.data.startpoint.x) + (b2 * wall2.data.startpoint.y);
    // now solve the system of equations, finding where the lines (not segments) would intersect
    /** Algebra Explanation:
        Line 1: a1x + b1y = c1
        Line 2: a2x + b2y = c2
 
        Multiply Line1 equation by b2, Line2 equation by b1, get:
        a1b1x + b1b2y = b2c1
        a2b1x + b1b2y = b1c2
 
        Subtract bottom from top:
        a1b2x - a2b1x = b2c1 - b1c2
 
        Divide both sides by a1b2 - a2b1, get equation for x. Equation for y is analogous
    **/
    var det = a1 * b2 - a2 * b1;
    var x = null; var y = null;
    // Edge Case: Lines are paralell
    if (det === 0) {
        // Edge Case: wall1 and wall2 have an endpoint to endpoint intersection (the only instance in which paralell walls could intersect at a specific point)
        if (wall1.data.startpoint.equals(wall2.data.startpoint) || wall1.data.startpoint.equals(wall2.data.endpoint)) return wall1.data.startpoint;
        if (wall1.data.endpoint.equals(wall2.data.startpoint) || wall1.data.endpoint.equals(wall2.data.endpoint)) return wall1.data.endpoint;
        return null;
    }
    else {
        x = (b2 * c1 - b1 * c2) / det;
        y = (a1 * c2 - a2 * c1) / det;
    }
    // test that the proposed intersection is contained in both line segments (walls)
    var inWall1 = ((Math.min(wall1.data.startpoint.x, wall1.data.endpoint.x) <= x) && (Math.max(wall1.data.startpoint.x, wall1.data.endpoint.x) >= x)
        && (Math.min(wall1.data.startpoint.y, wall1.data.endpoint.y) <= y) && (Math.max(wall1.data.startpoint.y, wall1.data.endpoint.y) >= y));
    var inWall2 = ((Math.min(wall2.data.startpoint.x, wall2.data.endpoint.x) <= x) && (Math.max(wall2.data.startpoint.x, wall2.data.endpoint.x) >= x)
        && (Math.min(wall2.data.startpoint.y, wall2.data.endpoint.y) <= y) && (Math.max(wall2.data.startpoint.y, wall2.data.endpoint.y) >= y));
    if (inWall1 && inWall2) return new go.Point(x, y);
    else return null;
}
 
// determines arc geometry for angleNodes
function makeArc(node) {
    var ang = node.data.angle;
    var sweep = node.data.sweep;
    var rad = Math.min(30, node.data.maxRadius);
    if (typeof sweep === "number" && sweep > 0) {
        var start = new go.Point(rad, 0).rotate(ang);
        // this is much more efficient than calling go.GraphObject.make:
        return new go.Geometry()
              .add(new go.PathFigure(start.x + rad, start.y + rad)  // start point
                   .add(new go.PathSegment(go.PathSegment.Arc,
                                           ang, sweep,  // angles
                                           rad, rad,  // center
                                           rad, rad)  // radius
                        ))
              .add(new go.PathFigure(0, 0))
              .add(new go.PathFigure(2 * rad, 2 * rad));
    } else {  // make sure this arc always occupies the same circular area of RAD radius
        return new go.Geometry()
              .add(new go.PathFigure(0, 0))
              .add(new go.PathFigure(2 * rad, 2 * rad));
    }
}
 
function makeAngleNode() {
    var $ = go.GraphObject.make;
    return $(go.Node, "Spot", { locationSpot: go.Spot.Center, locationObjectName: "SHAPE", selectionAdorned: false },
        new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
        $(go.Shape, "Circle", // placed where walls intersect, is invisible
        { name: "SHAPE", fill: "red", height: 0, width: 0 }),
        $(go.Shape, { stroke: "green", strokeWidth: 1.5, fill: null }, // arc
        new go.Binding("geometry", "", makeArc).ofObject(),
        new go.Binding("stroke", "sweep", function (sweep) { return (sweep % 45 < 1 || sweep % 45 > 44) ? "dodgerblue" : "lightblue"; })),
        $(go.Panel, "Auto", { name: "ARCLABEL" },
        // position the label in the center of the arcv 
        new go.Binding("alignment", "sweep", function (sweep, panel) {
            var rad = Math.min(30, panel.part.data.maxRadius);
            var angle = panel.part.data.angle;
            var cntr = new go.Point(rad, 0).rotate(angle + sweep / 2);
            return new go.Spot(0.5, 0.5, cntr.x, cntr.y);
        }),
        $(go.Shape, { stroke: "black", fill: "white" },
        new go.Binding("stroke", "sweep", function (sweep) { return (sweep % 45 < 1 || sweep % 45 > 44) ? "dodgerblue" : "lightblue"; })),
        $(go.TextBlock, { font: "7pt sans-serif", margin: new go.Margin(2, 2, 2, 2) },
        new go.Binding("text", "sweep", function (sweep) { return sweep.toFixed(2) + String.fromCharCode(176); }),
        new go.Binding("stroke", "color"))
  ));
}
 
var allAngleNodes = new go.Set(go.Node);
 
// update the angle links shown along a wall, based on which wall(s) is/are selected
var updateWallAngles = function () {
    myDiagram.skipsUndoManager = true; // do not store displaying angles as a transaction
    myDiagram.startTransaction("display angles");
    if (myDiagram.model.modelData.preferences.showWallAngles) {
        allAngleNodes.iterator.each(function(node){node.visible = true;});
        var selectedWalls = [];
        myDiagram.selection.iterator.each(function (part) { if (part.category === "WallGroup") selectedWalls.push(part); });
        for (var i = 0; i < selectedWalls.length; i++) {
            var seen = new go.Set("string"); // Set of all walls "seen" thus far for "wall"
            var wall = selectedWalls[i];
            var possibleWalls = myDiagram.findNodesByExample({ category: "WallGroup" });
 
            // go through all other walls; if the other wall intersects this wall, make angles
            possibleWalls.iterator.each(function (otherWall) {
                if (otherWall.data === null || wall.data === null || seen.contains(otherWall.data.key)) return;
                if ((otherWall.data.key !== wall.data.key) && (getWallsIntersection(wall, otherWall) !== null) && (!seen.contains(otherWall.data.key))) {
 
                    seen.add(otherWall.data.key);
                    // "otherWall" intersects "wall"; make or update angle nodes
                    var intersectionPoint = getWallsIntersection(wall, otherWall);
                    var wallsInvolved = myDiagram.findObjectsNear(intersectionPoint,
                        1,
                        function (x) { if (x.part !== null) return x.part; },
                        function (p) { return p.category === "WallGroup"; },
                        false);
 
                    var endpoints = []; // store endpoints and their corresponding walls here
                    // gather endpoints of each wall in wallsInvolved; discard endpoints within a tolerance distance of intersectionPoint
                    wallsInvolved.iterator.each(function (w) {
                        var tolerance = (myDiagram.model.modelData.gridSize >= 10) ? myDiagram.model.modelData.gridSize : 10;
                        if (Math.sqrt(w.data.startpoint.distanceSquaredPoint(intersectionPoint)) > tolerance) endpoints.push({ point: w.data.startpoint, wall: w.data.key });
                        if (Math.sqrt(w.data.endpoint.distanceSquaredPoint(intersectionPoint)) > tolerance) endpoints.push({ point: w.data.endpoint, wall: w.data.key });
                    });
 
                    // find maxRadius (shortest distance from an involved wall's endpoint to intersectionPoint or 30, whichever is smaller)
                    var maxRadius = 30;
                    for (var i = 0; i < endpoints.length; i++) {
                        var distance = Math.sqrt(endpoints[i].point.distanceSquaredPoint(intersectionPoint));
                        if (distance < maxRadius) maxRadius = distance;
                    }
 
                    // sort endpoints in a clockwise fashion around the intersectionPoint
                    endpoints.sort(function (a, b) {
                        a = a.point; b = b.point;
                        if (a.x - intersectionPoint.x >= 0 && b.x - intersectionPoint.x < 0) return true;
                        if (a.x - intersectionPoint.x < 0 && b.x - intersectionPoint.x >= 0) return false;
                        if (a.x - intersectionPoint.x == 0 && b.x - intersectionPoint.x == 0) {
                            if (a.y - intersectionPoint.y >= 0 || b.y - intersectionPoint.y >= 0) return a.y > b.y;
                            return b.y > a.y;
                        }
 
                        // compute the cross product of vectors (center -> a) x (center -> b)
                        var det = (a.x - intersectionPoint.x) * (b.y - intersectionPoint.y) - (b.x - intersectionPoint.x) * (a.y - intersectionPoint.y);
                        if (det < 0) return true;
                        if (det > 0) return false;
 
                        // points a and b are on the same line from the center; check which point is closer to the center
                        var d1 = (a.x - intersectionPoint.x) * (a.x - intersectionPoint.x) + (a.y - intersectionPoint.y) * (a.y - intersectionPoint.y);
                        var d2 = (b.x - intersectionPoint.x) * (b.x - intersectionPoint.x) + (b.y - intersectionPoint.y) * (b.y - intersectionPoint.y);
                        return d1 > d2;
                    }); // end endpoints sort
 
                    // for each pair of endpoints, construct or modify an angleNode 
                    for (var i = 0; i < endpoints.length; i++) {
                        var p1 = endpoints[i];
                        if (endpoints[i + 1] != null) var p2 = endpoints[i + 1];
                        else var p2 = endpoints[0];
                        var a1 = intersectionPoint.directionPoint(p1.point);
                        var a2 = intersectionPoint.directionPoint(p2.point);
                        var sweep = Math.abs(a2 - a1 + 360) % 360;
                        var angle = a1;
 
                        /*
                            construct proper key for angleNode
                            proper angleNode key syntax is "wallWwallX...wallYangleNodeZ" such that W < Y < Y; angleNodes are sorted clockwise around the intersectionPoint by Z
                        */
                        var keyArray = []; // used to construct proper key
                        wallsInvolved.iterator.each(function (wall) { keyArray.push(wall); });
                        keyArray.sort(function (a, b) {
                            var aIndex = a.data.key.match(/\d+/g);
                            var bIndex = b.data.key.match(/\d+/g);
                            if (isNaN(aIndex)) return true;
                            if (isNaN(bIndex)) return false;
                            else return aIndex > bIndex;
                        });
 
                        var key = "";
                        for (var j = 0; j < keyArray.length; j++) key += keyArray[j].data.key;
                        key += "angle" + i;
 
                        // check if this angleNode already exists -- if it does, adjust data (instead of deleting/redrawing)
                        var angleNode = null;
                        allAngleNodes.iterator.each(function (aNode) { if (aNode.data.key === key) angleNode = aNode; });
                        if (angleNode !== null) {
                            angleNode.data.angle = angle;
                            angleNode.data.sweep = sweep;
                            angleNode.data.loc = go.Point.stringify(intersectionPoint);
                            angleNode.data.maxRadius = maxRadius;
                            angleNode.updateTargetBindings();
                        }
                        // if this angleNode does not already exist, create it and add it to the diagram 
                        else {
                            var data = { key: key, category: "AngleNode", loc: go.Point.stringify(intersectionPoint), stroke: "dodgerblue", angle: angle, sweep: sweep, maxRadius: maxRadius };
                            var newAngleNode = makeAngleNode();
                            newAngleNode.data = data;
                            myDiagram.add(newAngleNode);
                            newAngleNode.updateTargetBindings();
                            allAngleNodes.add(newAngleNode);
                        }
                    }
                }
            });
        }
        // garbage collection (angleNodes that should not exist any more)
        var garbage = [];
        allAngleNodes.iterator.each(function (node) {
            var keyNums = node.data.key.match(/\d+/g); // values X for all wall keys involved, given key "wallX"
            var numWalls = (node.data.key.match(/wall/g) || []).length; // # of walls involved in in "node"'s construction
            var wallsInvolved = [];
            // add all walls involved in angleNode's construction to wallsInvolved
            for (var i = 0; i < keyNums.length - 1; i++) wallsInvolved.push("wall" + keyNums[i]);
            // edge case: if the numWalls != keyNums.length, that means the wall with key "wall" (no number in key) is involved
            if (numWalls !== keyNums.length - 1) wallsInvolved.push("wall");
 
            // Case 1: if any wall pairs involved in this angleNode are no longer intersecting, add this angleNode to "garbage"
            for (var i = 0; i < wallsInvolved.length - 1; i++) {
                var wall1 = myDiagram.findPartForKey(wallsInvolved[i]);
                var wall2 = myDiagram.findPartForKey(wallsInvolved[i + 1]);
                var intersectionPoint = getWallsIntersection(wall1, wall2);
                if (intersectionPoint === null) garbage.push(node);
            }
            // Case 2: if there are angleNode clusters with the same walls in their keys as "node" but different locations, destroy and rebuild
            // collect all angleNodes with same walls in their construction as "node"
            var possibleAngleNodes = new go.Set(go.Node);
            var allWalls = node.data.key.slice(0, node.data.key.indexOf("angle"));
            allAngleNodes.iterator.each(function (other) { if (other.data.key.includes(allWalls)) possibleAngleNodes.add(other); });
            possibleAngleNodes.iterator.each(function (pNode) {
                if (pNode.data.loc !== node.data.loc) {
                    garbage.push(pNode);
                }
            });
 
            // Case 3: put any angleNodes with sweep === 0 in garbage
            if (node.data.sweep === 0) garbage.push(node);
        });
 
        for (var i = 0; i < garbage.length; i++) {
            myDiagram.remove(garbage[i]); // remove garbage
            allAngleNodes.remove(garbage[i]);
        }       
    }
    // hide all angles > 180 if show only acute angles is one
    if (myDiagram.model.modelData.preferences.showOnlySmallWallAngles) {
        allAngleNodes.iterator.each(function (node) { if (node.data.sweep >= 180) node.visible = false; });
    }
    myDiagram.commitTransaction("display angles");
    myDiagram.skipsUndoManager = false;
}
 
// update all statistics in Statistics Window - called when the model is changed
var updateStatistics = function () {
    var element = document.getElementById('statisticsWindowTextDiv');
    element.innerHTML = "<div class='row'><div class='col-2' style='height: 165px; overflow: auto;'> Item Types <table id='numsTable'></table></div><div class='col-2'> Totals <table id='totalsTable'></table></div></div>";
    // fill Item Types table with node type/count of all nodes in diagram
    numsTable = document.getElementById('numsTable');
    var allPaletteNodes = myPalette.model.nodeDataArray.concat(myPalette2.model.nodeDataArray);
    for (var i = 0; i < allPaletteNodes.length; i++) {
        var type = allPaletteNodes[i].type;
        var num = myDiagram.findNodesByExample({ type: type }).count;
        if (num > 0) // only display data for nodes that exist on the diagram
            numsTable.innerHTML += "<tr class='data'> <td style='float: left;'>" + type + "</td> <td style='float: right;'> " + num + "</td></tr>";
    }
    // fill Totals table with lengths of all walls
    totalsTable = document.getElementById('totalsTable');
    var walls = myDiagram.findNodesByExample({ category: "WallGroup" });
    var totalLength = 0;
    walls.iterator.each(function (wall) {
        var wallLength = Math.sqrt(wall.data.startpoint.distanceSquaredPoint(wall.data.endpoint));
        totalLength += wallLength;
    });
    totalLength = convertPixelsToUnits(totalLength).toFixed(2);
    var unitsAbbreviation = myDiagram.model.modelData.unitsAbbreviation;
    totalsTable.innerHTML += "<tr class='data'><td style='float: left;'>Wall Lengths</td><td style='float: right;'>" + totalLength + unitsAbbreviation + "</td></tr>";
}
 
//******************************* HTML Interaction code *******************************************************
// change the "checked" value of checkboxes in the Options Menu, and to have those changes reflected in app behavior
function checkboxChanged(id) {
    myDiagram.skipsUndoManager = true;
    myDiagram.startTransaction("change preference");
    var element = document.getElementById(id);
    switch (id) {
        case "showGridCheckbox": {
            myDiagram.grid.visible = element.checked;
            myDiagram.model.modelData.preferences.showGrid = element.checked;
            break;
        }
        case "gridSnapCheckbox": {
            myDiagram.toolManager.draggingTool.isGridSnapEnabled = element.checked;
            myDiagram.model.modelData.preferences.gridSnap = element.checked;
            break;
        }
        case "wallGuidelinesCheckbox": myDiagram.model.modelData.preferences.showWallGuidelines = element.checked; break;
        case "wallLengthsCheckbox": myDiagram.model.modelData.preferences.showWallLengths = element.checked; updateWallDimensions(); break;
        case "wallAnglesCheckbox": myDiagram.model.modelData.preferences.showWallAngles = element.checked; updateWallAngles(); break;
        case "smallWallAnglesCheckbox": myDiagram.model.modelData.preferences.showOnlySmallWallAngles = element.checked; updateWallAngles(); break;
    }
    myDiagram.commitTransaction("change preference");
    myDiagram.skipsUndoManager = false;
}
 
// changes the edge length of the grid
function changeGridSize() {
    myDiagram.skipsUndoManager = true;
    myDiagram.startTransaction("change grid size");
    var el = document.getElementById('gridSizeInput'); var input;
    if (!isNaN(el.value) && el.value != null && el.value != '' && el.value != undefined) input = parseFloat(el.value);
    else {
        el.value = convertPixelsToUnits(10); // if bad input given, revert to 20cm (10px) or unit equivalent
        input = parseFloat(el.value);
    }
    input = convertUnitsToPixels(input);
    myDiagram.grid.gridCellSize = new go.Size(input, input);
    myDiagram.toolManager.draggingTool.gridCellSize = new go.Size(input, input);
    myDiagram.model.setDataProperty(myDiagram.model.modelData, "gridSize", input);
    myDiagram.commitTransaction("change grid size");
    myDiagram.skipsUndoManager = false;
}
 
//sets text under Diagram to suggest the most likely function the user wants
function setDiagramHelper(str) { document.getElementById("diagramHelpTextDiv").innerHTML = '<p>' + str + '</p>'; }
 
// helper function for setSelectionInfo(); displays all nodes in a given set in a given 1 or 2 rows in a given HTML element
// parameter "iterator" may be an iterable collection or array
function fillRowsWithNodes(iterator, element, numRows, selectedKey) {
    var arr = [];
    if (iterator.constructor !== Array) iterator.each(function (p) { arr.push(p); });
    else arr = iterator;
    for (var i = 0; i < arr.length; i += numRows) {
        if (arr[i].data === null) { setSelectionInfo('Nothing selected'); return; }
        var key1 = arr[i].data.key; // keys used to locate the node if clicked on...
        var name1 = (arr[i].data.caption !== "MultiPurposeNode") ? arr[i].data.caption : arr[i].data.text; // ... names are editable, so users can distinguish between nodes
        // if there's two nodes for this row...
        if (arr[i + 1] != undefined && arr[i + 1] != null) {
            var key2 = arr[i + 1].data.key;
            var name2 = (arr[i + 1].data.caption !== null) ? arr[i + 1].data.caption : arr[i + 1].data.text;
            // if there's a non-null selectedKey, highlight the selected node in the list
            if (key1 === selectedKey) element.innerHTML += '<div class="row"><div class="col-' + numRows + '"><p class="data clickable selectedKey" onclick="setSelectionInfo(myDiagram.findPartForKey(' + "'" + key1 + "'" + '))">' + name1 + '</p></div><div class="col-' + numRows + '"><p class="data clickable" onclick="setSelectionInfo(myDiagram.findPartForKey(' + "'" + key2 + "'" + '))">' + name2 + '</p></div></div>';
            else if (key2 === selectedKey) element.innerHTML += '<div class="row"><div class="col-' + numRows + '"><p class="data clickable" onclick="setSelectionInfo(myDiagram.findPartForKey(' + "'" + key1 + "'" + '))">' + name1 + '</p></div><div class="col-' + numRows + '"><p class="data clickable selectedKey" onclick="setSelectionInfo(myDiagram.findPartForKey(' + "'" + key2 + "'" + '))">' + name2 + '</p></div></div>';
            else element.innerHTML += '<div class="row"><div class="col-' + numRows + '"><p class="data clickable" onclick="setSelectionInfo(myDiagram.findPartForKey(' + "'" + key1 + "'" + '))">' + name1 + '</p></div><div class="col-' + numRows + '"><p class="data clickable" onclick="setSelectionInfo(myDiagram.findPartForKey(' + "'" + key2 + "'" + '))">' + name2 + '</p></div></div>';
        } // if there's only one node for this row...
        else {
            if (key1 === selectedKey) element.innerHTML += '<div class="row"><div class="col-' + numRows + '"><p class="data clickable selectedKey" onclick="setSelectionInfo(myDiagram.findPartForKey(' + "'" + key1 + "'" + '))">' + name1 + '</p></div><div class="col-2"><p class="data clickable"></p></div></div>';
            else element.innerHTML += '<div class="row"><div class="col-' + numRows + '"><p class="data clickable" onclick="setSelectionInfo(myDiagram.findPartForKey(' + "'" + key1 + "'" + '))">' + name1 + '</p></div><div class="col-2"><p class="data clickable"></p></div></div>';
        }
    }
}
 
// displays editable info regarding a selection in the Selection Help window (height/length, width, name, group info)
function setSelectionInfo(node) {
    if (node instanceof go.GraphObject) node = node.part;
    var element = document.getElementById("selectionInfoTextDiv");
    var infoWindow = document.getElementById('selectionInfoWindow');
    if (element === null || infoWindow === null) return;
    if (node === 'Nothing selected' || node.layer === null || node === null) { element.innerHTML = '<p>' + node + '</p>'; return; }
 
    // if there are multiple nodes selected, show all their names, allowing user to click on the node they want
    if (node === 'Selection: ') {
        var selectionIterator = myDiagram.selection.iterator; var arr = [];
        element.innerHTML = '<p id="name"> Selection (' + selectionIterator.count + ' items selected): </p>';
        fillRowsWithNodes(selectionIterator, element, 2, null);
        infoWindow.style.height = document.getElementById('selectionInfoTextDiv').offsetHeight + document.getElementById('selectionInfoWindowHandle').offsetHeight + 5 + 'px';
        return;
    }
 
    // if we have one node selected, gather pertinent information for that node....
    myDiagram.select(node);
    var name = ''; var length; var width; var nodeGroupCount = 0; var notes = node.data.notes;
    // get node name
    if (node.category === 'MultiPurposeNode') name = node.data.text;
    else name = node.data.caption;
    // get node height / width (dependent on node category)
    if (node.category === 'WallGroup') {
        height = convertPixelsToUnits(Math.sqrt(node.data.startpoint.distanceSquared(node.data.endpoint.x, node.data.endpoint.y))).toFixed(2); // wall length
        width = convertPixelsToUnits(node.data.strokeWidth).toFixed(2);
    } else if (node.category === 'DoorNode') {
        height = convertPixelsToUnits(node.data.width).toFixed(2);
        width = convertPixelsToUnits(node.data.width).toFixed(2);
    } else if (node.data.isGroup && node.category !== "WallGroup") {
        height = convertPixelsToUnits(node.actualBounds.height).toFixed(2);
        width = convertPixelsToUnits(node.actualBounds.width).toFixed(2); 
    } else {
        height = convertPixelsToUnits(node.data.height).toFixed(2);
        width = convertPixelsToUnits(node.data.width).toFixed(2);
    }
    // get node group info
    if (node.containingGroup != null && node.containingGroup != undefined) {
        var nodeGroupParts = node.containingGroup.memberParts;
        nodeGroupCount = nodeGroupParts.count;
    }
    if (node.data.isGroup) {
        var nodeGroupParts = node.memberParts;
        nodeGroupCount = nodeGroupParts.count;
    }
    var unitsAbbreviation = myDiagram.model.modelData.unitsAbbreviation;
 
    //... then display that information in the selection info window
    element.innerHTML = '<p id="name" >Name: ' + '<input id="nameInput" class="nameNotesInput" value="' + name + '"/>' + '</p>';
    // display node notes in a textarea
    element.innerHTML += "<p>Notes: <textarea id='notesTextarea' class='nameNotesInput' >" + notes + "</textarea></p>";
    // display color as a color picker element (individual nodes only)
    if (!node.data.isGroup && node.data.category !== "DoorNode" && node.data.category !== "WindowNode") {
        element.innerHTML += '<p>Color: <input type="color" id="colorPicker" value="' + node.data.color + '" name="selectionColor"></input></p>';
        var colorPicker = document.getElementById('colorPicker');
    }
 
    // display "Door Length" input (Door Nodes only)
    if (node.category === "DoorNode") element.innerHTML += '<div class="row"><p id="heightLabel" class="data">Door Length: <br/><input id = "heightInput" class = "dimensionsInput" name = "height" value = "' + height + '"/>'
        + '<input id="heightUnits" class="unitsBox" value=' + unitsAbbreviation + ' disabled/></p>';
    // display the editable properties height and width (non-Door nodes)
    else element.innerHTML += '<div class="row"><div class="col-2"><p id="heightLabel" class="data">Height: <br/><input id = "heightInput" class = "dimensionsInput" name = "height" value = "' + height
        + '"/><input id="heightUnits" class="unitsBox" value=' + unitsAbbreviation + ' disabled/></p> ' + '</div><div class="col-2"><p class="data">Width: <br/><input id = "widthInput" class = "dimensionsInput" value = "'
        + width + '"/><input id="widthUnits" class="unitsBox" value="' + unitsAbbreviation + '" disabled/></p>' + '</p></div></div>';
 
    // for walls "height" is displayed as "length"
    if (node.category === 'WallGroup') document.getElementById("heightLabel").innerHTML = 'Length: <br/><input id = "heightInput" class = "dimensionsInput" name = "height" value = "' + height + '"/><input id="heightUnits" class="unitsBox" value=' + unitsAbbreviation + ' disabled/> ';
 
    // do not allow height or width adjustment for group info
    if (node.data.isGroup && node.category !== "WallGroup") {
        document.getElementById("heightInput").disabled = true;
        document.getElementById("widthInput").disabled = true;
    }
 
    // "Apply Changes" button
    element.innerHTML += '<div class="row"> <button id="applySelectionChanges" onClick="applySelectionChanges()">Apply Changes</button></div>';
 
    // display group info for standard groups, wallParts for walls
    var groupName = null; var groupKey = null; var selectedKey = "";
    if (node.data.isGroup === true) {
        groupName = node.data.caption;
        groupKey = node.data.key;
        selectedKey = "selectedKey"; // the 'group' node is selected; make it blue to show this
    }
    if (node.containingGroup !== null) {
        groupName = node.containingGroup.data.caption;
        groupKey = node.containingGroup.data.key;
    }
    if (groupName !== null) {
        groupKey = "'" + groupKey + "'";
        element.innerHTML += '<div class="row data" id="nodeGroupInfo"> <span class="clickable ' + selectedKey + '" onclick="setSelectionInfo(myDiagram.findPartForKey(' + groupKey + '))">' + groupName + '</span> Info (' + nodeGroupCount + ' member(s) in <span class="clickable ' + selectedKey + '" onclick="setSelectionInfo(myDiagram.findPartForKey(' + groupKey + '))">' + groupName + '</span>) </div>';
        if (nodeGroupCount != 0) fillRowsWithNodes(nodeGroupParts, document.getElementById('nodeGroupInfo'), 2, node.data.key);
    }
 
    // dynamically adjust the name of node based on user input
    var nameInput = document.getElementById('nameInput');
    if (!myDiagram.isReadOnly) {
        nameInput.addEventListener('input', function (e) {
            var value = nameInput.value;
            myDiagram.skipsUndoManager = true;
            myDiagram.startTransaction("rename node");
            if (value === null || value === "" || value === undefined) { myDiagram.commitTransaction("rename node"); return; }
            myDiagram.model.setDataProperty(node.data, "caption", value);
            myDiagram.model.setDataProperty(node.data, "text", value); // if node is a multi purpose node, update the text on it
            myDiagram.commitTransaction("rename node");
            myDiagram.skipsUndoManager = false;
        });
 
        // dynamically adjust the notes of the node based on user input
        var notesTextarea = document.getElementById('notesTextarea');
        notesTextarea.addEventListener('input', function (e) {
            var value = notesTextarea.value;
            myDiagram.skipsUndoManager = true;
            myDiagram.startTransaction("edit node notes");
            if (value === null || value === undefined) return;
            myDiagram.model.setDataProperty(node.data, "notes", value);
            myDiagram.commitTransaction("edit node notes");
            myDiagram.skipsUndoManager = false;
        });
        infoWindow.style.height = document.getElementById('selectionInfoTextDiv').offsetHeight + document.getElementById('selectionInfoWindowHandle').offsetHeight + 5 + 'px';
    }
}
 
// event for color input in Selection Info Window; set model data for fill color of the current selection
function setColor() {
    var node = myDiagram.selection.first();
    var colorPicker = document.getElementById("colorPicker");
    if (colorPicker !== null) {
        myDiagram.startTransaction("recolor node");
        myDiagram.model.setDataProperty(node.data, "color", colorPicker.value);
        myDiagram.model.setDataProperty(node.data, "stroke", invertColor(colorPicker.value))
        myDiagram.commitTransaction("recolor node");
    }
}
 
// event for height input in Selection Info Window; set model data for height of the currently selected node (also handles door length for doors, wall length for walls)
function setHeight() {
    var node = myDiagram.selection.first();
    var value = parseFloat(convertUnitsToPixels(heightInput.value));
    if (isNaN(value)) {
        alert("Please enter a number in the height input");
        setSelectionInfo(node);
        return;
    }
    myDiagram.skipsUndoManager = true;
    myDiagram.startTransaction("resize node");
    if (!myDiagram.isReadOnly) {
        // Case: Standard / Multi-Purpose Nodes; basic height adjustment
        if (node.category !== 'WallGroup' && node.category !== "WindowNode" && node.category !== 'DoorNode') {
            myDiagram.model.setDataProperty(node.data, "height", value);
        }
        // Case: Door Nodes / Window Nodes; "Door Length" is node height and width
        else if (node.category === 'DoorNode' || node.category === "WindowNode") {
            var wall = myDiagram.findPartForKey(node.data.group);
            var loc = node.location.copy();
            if (wall !== null) {
                var wallLength = Math.sqrt(wall.data.startpoint.distanceSquaredPoint(wall.data.endpoint));
                if (wallLength < value) {
                    value = wallLength;
                    loc = new go.Point((wall.data.startpoint.x + wall.data.endpoint.x) / 2, (wall.data.startpoint.y + wall.data.endpoint.y) / 2);
                }
            }
            if (node.category === "DoorNode") myDiagram.model.setDataProperty(node.data, "width", value); // for door nodes, width dictates height as well
            node.location = loc;
            updateWallDimensions();
        }
        // Case: Wall Groups; wall length adjustment; do not allow walls to be shorter than the distance between their fathest apart wallParts
        else {
            var sPt = node.data.startpoint.copy();
            var ePt = node.data.endpoint.copy();
            var angle = sPt.directionPoint(ePt);
 
            var midPoint = new go.Point(((sPt.x + ePt.x) / 2), ((sPt.y + ePt.y) / 2));
            var newEpt = new go.Point((midPoint.x + (value / 2)), midPoint.y);
            var newSpt = new go.Point((midPoint.x - (value / 2)), midPoint.y);
            newEpt.offset(-midPoint.x, -midPoint.y).rotate(angle).offset(midPoint.x, midPoint.y);
            newSpt.offset(-midPoint.x, -midPoint.y).rotate(angle).offset(midPoint.x, midPoint.y);
 
            // Edge Case 1: The user has input a length shorter than the edge wallPart's endpoints allow
            // find the endpoints of the wallparts closest to the endpoints of the wall
            var closestPtToSpt = null; var farthestPtFromSpt;
            var closestDistToSpt = Number.MAX_VALUE; var farthestDistFromSpt = 0;
            node.memberParts.iterator.each(function (wallPart) {
                var endpoints = getWallPartEndpoints(wallPart);
                var endpoint1 = endpoints[0];
                var endpoint2 = endpoints[1];
                var distance1 = Math.sqrt(endpoint1.distanceSquaredPoint(sPt));
                var distance2 = Math.sqrt(endpoint2.distanceSquaredPoint(sPt));
 
                if (distance1 < closestDistToSpt) {
                    closestDistToSpt = distance1;
                    closestPtToSpt = endpoint1;
                } if (distance1 > farthestDistFromSpt) {
                    farthestDistFromSpt = distance1;
                    farthestPtFromSpt = endpoint1;
                } if (distance2 < closestDistToSpt) {
                    closestDistToSpt = distance2;
                    closestPtToSpt = endpoint2;
                } if (distance2 > farthestDistFromSpt) {
                    farthestDistFromSpt = distance2;
                    farthestPtFromSpt = endpoint2;
                }
            });
 
            if (closestPtToSpt !== null) {
                // if the proposed length is smaller than the minDistance, set wall length to minDistance
                var proposedDistance = Math.sqrt(newSpt.distanceSquaredPoint(newEpt));
                var minDistance = Math.sqrt(closestPtToSpt.distanceSquaredPoint(farthestPtFromSpt));
                if (proposedDistance < minDistance) {
                    newSpt = closestPtToSpt;
                    newEpt = farthestPtFromSpt;
                }
            }
 
            // Edge Case 2: The new wall endpoints constructed based on user input do not generate a wall too short for the wall's edge wallPart's endpoints;
            // however, there is/are a/some wallPart(s) that do not fit along the new wall endpoints (due to midpoint construction)
            // if a wallPart endpoint is outside the line created by newSpt and newEpt, adjust the endpoints accordingly
            var farthestPtFromWallPt = null; var farthestFromWallPtDist = 0;
            node.memberParts.iterator.each(function (part) {
                var endpoints = getWallPartEndpoints(part);
                // check for endpoints of wallParts not along the line segment made by newSpt and newEpt
                for (var i = 0; i < endpoints.length; i++) {
                    var point = endpoints[i];
                    var distanceToStartPoint = parseFloat(Math.sqrt(point.distanceSquaredPoint(newSpt)).toFixed(2));
                    var distanceToEndPoint = parseFloat(Math.sqrt(point.distanceSquaredPoint(newEpt)).toFixed(2));
                    var wallLength = parseFloat(Math.sqrt(newSpt.distanceSquaredPoint(newEpt)).toFixed(2));
                    if ((distanceToStartPoint + distanceToEndPoint).toFixed(2) !== wallLength.toFixed(2)) {
                        var testDistance = Math.sqrt(point.distanceSquaredPoint(newSpt));
                        if (testDistance > farthestFromWallPtDist) {
                            farthestFromWallPtDist = testDistance;
                            farthestPtFromWallPt = point;
                        }
                    }
                }
            });
 
            // if a wallPart endpoint is outside the wall, adjust the endpoints of the wall to accomodate it
            if (farthestPtFromWallPt !== null) {
                var distance = Math.sqrt(newSpt.distanceSquaredPoint(newEpt));
                if (farthestPtFromWallPt.distanceSquaredPoint(newSpt) < farthestPtFromWallPt.distanceSquaredPoint(newEpt)) {
                    newSpt = farthestPtFromWallPt;
                    var totalLength = Math.sqrt(newSpt.distanceSquaredPoint(newEpt));
                    newEpt = new go.Point(newSpt.x + ((distance / totalLength) * (newEpt.x - newSpt.x)),
                newSpt.y + ((distance / totalLength) * (newEpt.y - newSpt.y)));
                } else {
                    newEpt = farthestPtFromWallPt;
                    var totalLength = Math.sqrt(newSpt.distanceSquaredPoint(newEpt));
                    newSpt = new go.Point(newEpt.x + ((distance / totalLength) * (newSpt.x - newEpt.x)),
                newEpt.y + ((distance / totalLength) * (newSpt.y - newEpt.y)));
                }
            }
 
            myDiagram.model.setDataProperty(node.data, "startpoint", newSpt);
            myDiagram.model.setDataProperty(node.data, "endpoint", newEpt);
            updateWall(node);
        }
    }
    myDiagram.commitTransaction("resize node");
    updateWallDimensions();
    myDiagram.skipsUndoManager = false;
}
 
// event for width input in Node Info Window; set model data for width of the currently selected node
function setWidth() {
    var node = myDiagram.selection.first();
    if (document.getElementById("widthInput") === null) return;
    var value = parseFloat(convertUnitsToPixels(widthInput.value));
    if (isNaN(value)) {
        alert("Please enter a number in the width input");
        setSelectionInfo(node);
        return;
    }
    myDiagram.skipsUndoManager = true;
    myDiagram.startTransaction("resize node");
    if (!myDiagram.isReadOnly) {
        // Case: Window nodes, keeps windows within wall boundaries
        if (node.category === 'WindowNode') {
            var wall = myDiagram.findPartForKey(node.data.group);
            var loc = node.location.copy();
            // constrain max width "value" by the free stretch on the wall "node" is in
            if (wall !== null) {
                var containingStretch = getWallPartStretch(node);
                var stretchLength = Math.sqrt(containingStretch.point1.distanceSquaredPoint(containingStretch.point2));
                if (stretchLength < value) {
                    value = stretchLength;
                    loc = new go.Point((containingStretch.point1.x + containingStretch.point2.x) / 2,
                        (containingStretch.point1.y + containingStretch.point2.y) / 2);
                }
            }
            myDiagram.model.setDataProperty(node.data, "width", value); 
            node.location = loc;
            updateWallDimensions();
        }
            // Case: Wall Groups; set wall's data.strokeWidth
        else if (node.category === 'WallGroup') {
            myDiagram.model.setDataProperty(node.data, "strokeWidth", value);
            node.memberParts.iterator.each(function (part) {
                if (part.category === 'DoorNode') myDiagram.model.setDataProperty(part.data, "doorOpeningHeight", value);
                if (part.category === 'WindowNode') myDiagram.model.setDataProperty(part.data, "height", value);
            });
        }
            // Case: Standard / Multi-Purpose Nodes; basic width ajustment
        else myDiagram.model.setDataProperty(node.data, "width", value);
    }
    myDiagram.commitTransaction("resize node");
    myDiagram.skipsUndoManager = false;
}
 
// set the height, width, and color of the selection based on user input in the Selection Info Window
function applySelectionChanges() {
    setHeight();
    setWidth();
    setColor();
    setSelectionInfo(myDiagram.selection.first());
}
 
// hide or show specific help/windows
function hideShow(div) {
    var diagramHelpDiv = document.getElementById(div); var str;
    switch (div) {
        case 'diagramHelpDiv': str = 'Diagram Help'; char = 'H'; break;
        case 'selectionInfoWindow': str = 'Selection Help'; char = 'I'; break;
        case 'myOverviewWindow': str = 'Overview'; char = 'E'; break;
        case 'optionsWindow': str = 'Options'; char = 'B'; break;
        case 'statisticsWindow': str = 'Statistics'; char = 'G'; break;
        case 'myPaletteWindow': str = 'Palettes'; char = 'P'; myPalette.layoutDiagram(true); break;
    }
    if (diagramHelpDiv.style.visibility === "visible") {
        diagramHelpDiv.style.visibility = "hidden";
        document.getElementById(div + 'Button').innerHTML = "Show " + str + "<p class='shortcut'> (Ctrl + " + char + " )</p>";
    } else {
        diagramHelpDiv.style.visibility = "visible";
        document.getElementById(div + 'Button').innerHTML = "Hide " + str + "<p class='shortcut'> (Ctrl + " + char + " )</p>";
    }
}
 
// increase or decrease the diagram scale to the nearest 10%
function adjustScale(sign) {
    var el = document.getElementById('scaleDisplay');
    myDiagram.startTransaction('Change Scale');
    switch (sign) {
        case '-': myDiagram.scale -= .1; break;
        case '+': myDiagram.scale += .1; break;
    }
    myDiagram.scale = parseFloat((Math.round(myDiagram.scale / .1) * .1).toFixed(2));
    var scale = (myDiagram.scale * 100).toFixed(2);
    el.innerHTML = 'Scale: ' + scale + '%';
    myDiagram.commitTransaction('Change Scale');
}
 
// called on document.onload()
function init() {
    if (!checkLocalStorage()) {
        var currentFile = document.getElementById("currentFile");
        currentFile.textContent = "Sorry! No web storage support. If you're using Internet Explorer / Microsoft Edge, you must load the page from a server for local storage to work.";
    }
 
    // add event listener to HTML body for hotkey use
    var body = document.getElementById('body');
    body.addEventListener("keydown", function (e) {
        var keynum = e.which;
        if (e.ctrlKey) {
            e.preventDefault();
            switch (keynum) {
                case 83: saveDocument(); break; // ctrl + s
                case 79: openDocument(); break; // ctrl + o
                case 68: e.preventDefault(); newDocument(); break; // ctrl + d
                case 82: removeDocument(); break; // ctrl + r
                case 49: setBehavior('wallBuilding'); break; // ctrl + 1
                case 50: setBehavior('dragging'); break; // ctrl + 2
                case 72: hideShow('diagramHelpDiv'); break; // ctrl + h
                case 73: hideShow('selectionInfoWindow'); break; // ctrl + i
                case 80: hideShow('myPaletteWindow'); break; // ctrl + p
                case 69: hideShow('myOverviewWindow'); break; // ctrl + e
                case 66: hideShow('optionsWindow'); break; // ctrl + b
                case 71: hideShow('statisticsWindow'); break; // ctrl + g
            }
        }
    });
 
    // ********************************************************* DIAGRAM CODE **************************************************************************************
    var $ = go.GraphObject.make;
 
    // menu if you right click a node
    var contextMenu =
        $(go.Adornment, "Vertical",
            $("ContextMenuButton",
                $(go.TextBlock, "Make Group"),
                { click: function (e, obj) { makeSelectionGroup(); } },
                // only allow grouping on non-wall / wallPart nodes
                new go.Binding("visible", "visible", function (v) {
                    if (myDiagram.selection.count <= 1) return false;
                    var flag = true;
                    myDiagram.selection.iterator.each(function (node) {
                        if (node.category === "WallGroup" || node.category === "WindowNode" || node.category === "DoorNode") flag = false;
                    });
                    return flag;
                }).ofObject()
            ),
            $("ContextMenuButton",
                $(go.TextBlock, "Ungroup"),
                { click: function (e, obj) { ungroupSelection(); } },
                new go.Binding("visible", "", function (v) {
                    var node = myDiagram.selection.first();
                    return ((node instanceof go.Node && node.containingGroup != null && node.containingGroup.category != 'WallGroup') ||
                        (node instanceof go.Group && node.category === ''));
                }).ofObject()
            ),
            $("ContextMenuButton",
                $(go.TextBlock, "Copy"),
                { click: function (e, obj) { myDiagram.commandHandler.copySelection() } },
                new go.Binding("visible", "", function (v) { return myDiagram.selection.count > 0; })
            ),
            $("ContextMenuButton",
                $(go.TextBlock, "Cut"),
                { click: function (e, obj) { myDiagram.commandHandler.cutSelection() } },
                new go.Binding("visible", "", function (v) { return myDiagram.selection.count > 0; })
            ),
            $("ContextMenuButton",
                $(go.TextBlock, "Delete"),
                { click: function (e, obj) { myDiagram.commandHandler.deleteSelection() } },
                new go.Binding("visible", "", function (v) { return myDiagram.selection.count > 0; })
            ),
            $("ContextMenuButton",
                $(go.TextBlock, "Paste"),
                { click: function (e, obj) { myDiagram.commandHandler.pasteSelection(myDiagram.lastInput.documentPoint) } }
            ),
            $("ContextMenuButton",
                $(go.TextBlock, "Show Selection Info"),
                {
                    click: function (e, obj) {
                        var selectionInfoWindow = document.getElementById('selectionInfoWindow');
                        if (selectionInfoWindow.style.visibility !== 'visible') hideShow('selectionInfoWindow');
                    }
                },
                new go.Binding("visible", "", function (v) { return myDiagram.selection.count > 0; })
            ),
            $("ContextMenuButton",
                $(go.TextBlock, "Flip Dimension Side"),
                {
                    click: function (e, obj) {
                        myDiagram.startTransaction("flip dimension link side");
                        var walls = [];
                        myDiagram.selection.iterator.each(function (part) {
                            if (part.category === "WallGroup") walls.push(part);
                        });
                        for (var i = 0; i < walls.length; i++) {
                            var wall = walls[i];
                            var sPt = wall.data.startpoint.copy();
                            var ePt = wall.data.endpoint.copy();
                            myDiagram.model.setDataProperty(wall.data, "startpoint", ePt);
                            myDiagram.model.setDataProperty(wall.data, "endpoint", sPt);
                            updateWall(wall);
                        }
                        myDiagram.commitTransaction("flip dimension link side");
                    }
                },
                new go.Binding("visible", "", function (v) {
                    var sel = myDiagram.selection;
                    if (sel.count === 0) return false;
                    var flag = false;
                    sel.iterator.each(function (part) {
                        if (part.category === "WallGroup") flag = true;
                    });
                    return flag;
                })
            )
       );
 
    // initialize diagram
    myDiagram = $(go.Diagram, "myDiagramDiv",
        {
            scale: 1,
            initialContentAlignment: go.Spot.Center,
            allowDrop: true,
            allowLink: false,
            resizingTool: new go.ResizingTool(),
            draggingTool: new go.DraggingTool(),
            "undoManager.isEnabled": true,
            "layout.isOngoing": false,
            "draggingTool.isGridSnapEnabled": true,
            "draggingTool.gridSnapCellSpot": go.Spot.TopLeft,
            "resizingTool.isGridSnapEnabled": true,
            "commandHandler.archetypeGroupData": { isGroup: true },
            "rotatingTool.snapAngleEpsilon": 10,
            grid: $(go.Panel, "Grid",
                { gridCellSize: new go.Size(5, 5), visible: true },
                $(go.Shape, "LineH", { stroke: "lightgray" }),
                $(go.Shape, "LineV", { stroke: "lightgray" })),
            contextMenu: contextMenu,
            model: $(go.GraphLinksModel, { modelData: DEFAULT_MODELDATA })
        });
 
    // when model is changed, update stats in Statistics Window
    myDiagram.addModelChangedListener(function (e) { if (e.isTransactionFinished) updateStatistics(); });
 
    // when diagram is modified, change document title to include a *
    myDiagram.addDiagramListener("Modified", function (e) {
        var currentFile = document.getElementById("currentFile");
        var idx = currentFile.textContent.indexOf("*");
        if (myDiagram.isModified) { if (idx < 0) currentFile.textContent = currentFile.textContent + "*"; }
        else { if (idx >= 0) currentFile.textContent = currentFile.textContent.substr(0, idx); }
    });
 
    // check if diagram scale has been changed -- if so, update the 'Scale' item in the View menu
    myDiagram.addDiagramListener("ViewportBoundsChanged", function (e) {
        var scaleEl = document.getElementById('scaleDisplay');
        scaleEl.innerHTML = "Scale: " + (myDiagram.scale * 100).toFixed(2) + "%";
    });
 
    // if a node has been dropped onto the Diagram from the Palette, update the help text
    myDiagram.addDiagramListener("ExternalObjectsDropped", function (e) {
        var node = myDiagram.selection.first();
        // Event 1: handle a drag / drop of a wall node from the Palette (as opposed to wall construction via WallBuildingTool)
        if (node.category === "PaletteWallNode") {
            var paletteWallNode = myDiagram.selection.first();
            var endpoints = getWallPartEndpoints(paletteWallNode);
            var data = { key: "wall", category: "WallGroup", caption: "Wall", startpoint: endpoints[0], endpoint: endpoints[1], strokeWidth: parseFloat(myDiagram.model.modelData.wallWidth), isGroup: true, notes: "" };
            myDiagram.model.addNodeData(data);
            var wall = myDiagram.findPartForKey(data.key);
            updateWall(wall);
            myDiagram.remove(paletteWallNode);
        }
        // Event 2: Update the text of the Diagram Helper
        if (node.category === "WindowNode" || node.category === "DoorNode") setDiagramHelper("Drag part so the cursor is over a wall to add this part to a wall");
        else setDiagramHelper("Drag, resize, or rotate your selection (hold SHIFT for no grid-snapping)");
        // Event 3: If the select tool is not active, make it active
        if (myDiagram.toolManager.mouseDownTools.elt(0).isEnabled) setBehavior('dragging');
    });
 
    // set node info window based on selection whenever the selection changes
    myDiagram.addDiagramListener("ChangedSelection", function (e) {
        myDiagram.skipsUndoManager = true;
        myDiagram.startTransaction("remove dimension links and angle nodes");
        allPointNodes.iterator.each(function (node) { myDiagram.remove(node) });
        allDimensionLinks.iterator.each(function (link) { myDiagram.remove(link) });
        allPointNodes.clear();
        allDimensionLinks.clear();
        allAngleNodes.iterator.each(function (node) { myDiagram.remove(node); });
        allAngleNodes.clear();
        updateWallDimensions();
        updateWallAngles();
        myDiagram.commitTransaction("remove dimension links and angle nodes");
        myDiagram.skipsUndoManager = false;
 
        var selection = myDiagram.selection;
        if (selection.count === 0) setSelectionInfo('Nothing selected');
        else if (selection.count === 1) setSelectionInfo(myDiagram.selection.first());
        else setSelectionInfo('Selection: ');
    });
 
    // when a wall is copied / pasted, update the wall geometry, angle, etc
    myDiagram.addDiagramListener("ClipboardPasted", function (e) {
        myDiagram.selection.iterator.each(function (node) { if (node.category === "WallGroup") updateWall(node); });
    });
 
    // define the overview
    myOverview = $(go.Overview, "myOverviewDiv", { observed: myDiagram, maxScale: 0.5 });
 
    //  ************************************************************** STANDARD GROUP FUNCTIONALITY ***************************************************************
    function makeSelectionGroup() {
        myDiagram.startTransaction("group selection");
        // ungroup all selected nodes; then group them; if one of the selected nodes is a group, ungroup all its nodes
        var sel = myDiagram.selection; var nodes = [];
        sel.iterator.each(function (n) {
            if (n instanceof go.Group) n.memberParts.iterator.each(function (part) { nodes.push(part); })
            else nodes.push(n);
        });
        for (var i = 0; i < nodes.length; i++) nodes[i].isSelected = true;
        ungroupSelection();
        myDiagram.commandHandler.groupSelection();
        var group = myDiagram.selection.first(); // after grouping, the new group will be the only thing selected
        myDiagram.model.setDataProperty(group.data, "caption", "Group");
        myDiagram.model.setDataProperty(group.data, "notes", "");
        clearEmptyGroups();
        // unselect / reselect group so data appears properly in Selection Info Window
        myDiagram.clearSelection();
        myDiagram.select(group);
        myDiagram.commitTransaction("group selection");
    }
 
    // ungroup selected nodes; if the selection is a group, ungroup all it's memberParts
    function ungroupSelection() {
        myDiagram.startTransaction('ungroup selection');
        // helper function to ungroup nodes
        function ungroupNode(node) {
            var group = node.containingGroup;
            node.containingGroup = null;
            if (group != null) {
                if (group.memberParts.count === 0) myDiagram.remove(group);
                else if (group.memberParts.count === 1) group.memberParts.first().containingGroup = null;
            }
        }
        // ungroup any selected nodes; remember groups that are selected
        var sel = myDiagram.selection; var groups = [];
        sel.iterator.each(function (n) {
            if (!(n instanceof go.Group)) ungroupNode(n);
            else groups.push(n);
        });
        // go through selected groups, and ungroup their memberparts too
        var nodes = [];
        for (var i = 0; i < groups.length; i++) groups[i].memberParts.iterator.each(function (n) { nodes.push(n); });
        for (var i = 0; i < nodes.length; i++) ungroupNode(nodes[i]);
        clearEmptyGroups();
        myDiagram.commitTransaction('ungroup selection');
    }
 
    // clear all the groups that have no nodes
    function clearEmptyGroups() {
        var nodes = myDiagram.nodes; var arr = [];
        nodes.iterator.each(function (node) { if (node instanceof go.Group && node.memberParts.count === 0 && node.category !== "WallGroup") { arr.push(node); } });
        for (i = 0; i < arr.length; i++) { myDiagram.remove(arr[i]); }
    }
 
    // ******************************************************************* DIAGRAM NODE/ADORNMENT TEMPLATES *****************************************************************
 
    // resize adornment for furniture nodes -- fill and stroke bound to furniture node data 
    var furnitureResizeAdornmentTemplate =
      $(go.Adornment, "Spot", { locationSpot: go.Spot.Center },
        $(go.Placeholder),
        $(go.Shape, { alignment: go.Spot.Top, cursor: "n-resize", figure: "Rectangle", desiredSize: new go.Size(5, 5), fill: "#ffffff", stroke: "#808080" },
        new go.Binding("fill", "", function (obj) { return (obj.adornedPart === null) ? "#ffffff" : obj.adornedPart.data.color; }).ofObject(),
        new go.Binding("stroke", "", function (obj) { return (obj.adornedPart === null) ? "#000000" : obj.adornedPart.data.stroke; }).ofObject()),
        $(go.Shape, { alignment: go.Spot.TopRight, cursor: "ne-resize", figure: "Rectangle", desiredSize: new go.Size(5, 5), fill: "#ffffff", stroke: "#808080" },
        new go.Binding("fill", "", function (obj) { return (obj.adornedPart === null) ? "#ffffff" : obj.adornedPart.data.color; }).ofObject(),
        new go.Binding("stroke", "", function (obj) { return (obj.adornedPart === null) ? "#000000" : obj.adornedPart.data.stroke; }).ofObject()),
        $(go.Shape, { alignment: go.Spot.Right, cursor: "e-resize", figure: "Rectangle", desiredSize: new go.Size(5, 5), fill: "#ffffff", stroke: "#808080" },
        new go.Binding("fill", "", function (obj) { return (obj.adornedPart === null) ? "#ffffff" : obj.adornedPart.data.color; }).ofObject(),
        new go.Binding("stroke", "", function (obj) { return (obj.adornedPart === null) ? "#000000" : obj.adornedPart.data.stroke; }).ofObject()),
        $(go.Shape, { alignment: go.Spot.BottomRight, cursor: "se-resize", figure: "Rectangle", desiredSize: new go.Size(5, 5), fill: "#ffffff", stroke: "#808080" },
        new go.Binding("fill", "", function (obj) { return (obj.adornedPart === null) ? "#ffffff" : obj.adornedPart.data.color; }).ofObject(),
        new go.Binding("stroke", "", function (obj) { return (obj.adornedPart === null) ? "#000000" : obj.adornedPart.data.stroke; }).ofObject()),
        $(go.Shape, { alignment: go.Spot.Bottom, cursor: "s-resize", figure: "Rectangle", desiredSize: new go.Size(5, 5), fill: "#ffffff", stroke: "#808080" },
        new go.Binding("fill", "", function (obj) { return (obj.adornedPart === null) ? "#ffffff" : obj.adornedPart.data.color; }).ofObject(),
        new go.Binding("stroke", "", function (obj) { return (obj.adornedPart === null) ? "#000000" : obj.adornedPart.data.stroke; }).ofObject()),
        $(go.Shape, { alignment: go.Spot.BottomLeft, cursor: "sw-resize", figure: "Rectangle", desiredSize: new go.Size(5, 5), fill: "#ffffff", stroke: "#808080" },
        new go.Binding("fill", "", function (obj) { return (obj.adornedPart === null) ? "#ffffff" : obj.adornedPart.data.color; }).ofObject(),
        new go.Binding("stroke", "", function (obj) { return (obj.adornedPart === null) ? "#000000" : obj.adornedPart.data.stroke; }).ofObject()),
        $(go.Shape, { alignment: go.Spot.Left, cursor: "w-resize", figure: "Rectangle", desiredSize: new go.Size(5, 5), fill: "#ffffff", stroke: "#808080" },
        new go.Binding("fill", "", function (obj) { return (obj.adornedPart === null) ? "#ffffff" : obj.adornedPart.data.color; }).ofObject(),
        new go.Binding("stroke", "", function (obj) { return (obj.adornedPart === null) ? "#000000" : obj.adornedPart.data.stroke; }).ofObject()),
        $(go.Shape, { alignment: go.Spot.TopLeft, cursor: "nw-resize", figure: "Rectangle", desiredSize: new go.Size(5, 5), fill: "#ffffff", stroke: "#808080" },
        new go.Binding("fill", "", function (obj) { return (obj.adornedPart === null) ? "#ffffff" : obj.adornedPart.data.color; }).ofObject(),
        new go.Binding("stroke", "", function (obj) { return (obj.adornedPart === null) ? "#000000" : obj.adornedPart.data.stroke; }).ofObject())
      );
 
    // rotate adornment for furniture nodes -- fill and stroke bound to furniture node data 
    var furnitureRotateAdornmentTemplate =
        $(go.Adornment, { locationSpot: go.Spot.Center, locationObjectName: "CIRCLE" },
        $(go.Shape, "Circle", { name: "CIRCLE", cursor: "pointer", desiredSize: new go.Size(7, 7), fill: "#ffffff", stroke: "#808080" },
        new go.Binding("fill", "", function (obj) { return (obj.adornedPart === null) ? "#ffffff" : obj.adornedPart.data.color; }).ofObject(),
        new go.Binding("stroke", "", function (obj) { return (obj.adornedPart === null) ? "#000000" : obj.adornedPart.data.stroke; }).ofObject())
        );
 
    var nodeToolTip =
        $(go.Adornment, "Auto",
            $(go.Shape, { fill: "#FFFFCC" }),
            $(go.TextBlock, { margin: 4 },
            new go.Binding("text", "", function (text, obj) {
                var data = obj.part.adornedObject.data;
                var name = (obj.part.adornedObject.category === "MultiPurposeNode") ? data.text : data.caption;
                return "Name: " + name + "\nNotes: " + data.notes;
            }).ofObject())
        );
 
    // define the default Node template (used for most furniture)
    myDiagram.nodeTemplateMap.add("",
        $(go.Node, "Spot",
        {
            resizable: true,
            rotatable: true,
            toolTip: nodeToolTip,
            resizeAdornmentTemplate: furnitureResizeAdornmentTemplate,
            rotateAdornmentTemplate: furnitureRotateAdornmentTemplate,
            contextMenu: contextMenu,
            locationObjectName: "SHAPE",
            resizeObjectName: "SHAPE",
            minSize: new go.Size(5, 5),
            locationSpot: go.Spot.Center,
            selectionAdorned: false,  // use a Binding on the Shape.stroke to show selection
            doubleClick: function () { hideShow('selectionInfoWindow'); }
        },
        // remember location of the Node
        new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
        // move a selected part into the Foreground layer so it's not obscuerd by non-selected Parts
        new go.Binding("layerName", "isSelected", function (s) { return s ? "Foreground" : ""; }).ofObject(),
        $(go.Shape,
        { strokeWidth: 1, name: "SHAPE", stroke: "#000000", geometryString: "F1 M0 0 L20 0 20 20 0 20 z", fill: "rgba(128, 128, 128, 0.5)" },
        new go.Binding("geometryString", "geo"),
        new go.Binding("angle", "angle").makeTwoWay(),
        new go.Binding("width", "width").makeTwoWay(),
        new go.Binding("height", "height").makeTwoWay(),
        // set Palette ID field properly when a node is selected
        new go.Binding("stroke", "isSelected", function (s, obj) { return s ? lightenColor(obj.stroke, 70) : invertColor(obj.part.data.color); }).ofObject(),
        new go.Binding("figure", "shape"),
        new go.Binding("fill", "color"))
      ));
 
    // define Node template for the multi purpose furniture node (rectangle with editable text)
    myDiagram.nodeTemplateMap.add("MultiPurposeNode",
      $(go.Node, "Spot",
        {
            contextMenu: contextMenu,
            toolTip: nodeToolTip,
            locationSpot: go.Spot.Center,
            resizeAdornmentTemplate: furnitureResizeAdornmentTemplate,
            rotateAdornmentTemplate: furnitureRotateAdornmentTemplate,
            locationObjectName: "SHAPE",
            resizable: true,
            rotatable: true,
            resizeObjectName: "SHAPE",
            minSize: new go.Size(5, 5),
            selectionAdorned: false,  // use a Binding on the Shape.stroke to show selection
            doubleClick: function () { hideShow('selectionInfoWindow'); }
        },
        // remember location, angle, height, and width of the node
        new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
        new go.Binding("angle", "angle").makeTwoWay(),
        new go.Binding("width", "width").makeTwoWay(),
        new go.Binding("height", "height").makeTwoWay(),
        // move a selected part into the Foreground layer so it's not obscuerd by non-selected Parts
        new go.Binding("layerName", "isSelected", function (s) { return s ? "Foreground" : ""; }).ofObject(),
        $(go.Shape, { strokeWidth: 1, name: "SHAPE", fill: "rgba(128, 128, 128, 0.5)", },
        // set Palette ID field properly when a node is selected
        new go.Binding("stroke", "isSelected", function (s, obj) { return s ? lightenColor(obj.stroke, 70) : invertColor(obj.part.data.color); }).ofObject(),
        new go.Binding("figure", "shape"),
        new go.Binding("width", "width").makeTwoWay(),
        new go.Binding("height", "height").makeTwoWay(),
        new go.Binding("fill", "color")),
        $(go.TextBlock,
        {
            margin: 5,
            wrap: go.TextBlock.WrapFit,
            textAlign: "center",
            editable: true,
            isMultiline: false,
            stroke: '#454545',
            font: "10pt sans-serif"
        },
        new go.Binding("text").makeTwoWay(),
        new go.Binding("font", "height", function (height) {
            if (height > 25) return "10pt sans-serif";
            if (height < 25 && height > 15) return "8pt sans-serif";
            else return "6pt sans-serif";
        }),
        new go.Binding("stroke", "color", function (color) { return invertColor(color); })
        )
      ));
 
    // drag computation function for WindowNodes and DoorNodes; ensure wall parts stay in walls when dragged
    var dragWallParts = function (part, pt, gridPt) {
        if (part.containingGroup !== null && part.containingGroup.category === 'WallGroup') {
            // Edge Case: if part is not on its wall (due to incorrect load) snap part.loc onto its wall immediately hopefully this is never called
            var wall = part.containingGroup;
            var wStart = wall.data.startpoint;
            var wEnd = wall.data.endpoint;
            var dist1 = Math.sqrt(wStart.distanceSquaredPoint(part.location));
            var dist2 = Math.sqrt(part.location.distanceSquaredPoint(wEnd));
            var totalDist = Math.sqrt(wStart.distanceSquaredPoint(wEnd));
            if (dist1 + dist2 !== totalDist) part.location = part.location.copy().projectOntoLineSegmentPoint(wStart, wEnd);
 
            // main behavior
            var stretch = getWallPartStretch(part);
            var leftOrAbovePt = stretch.point1;
            var rightOrBelowPt = stretch.point2;
 
            // calc points along line created by the endpoints that are half the width of the moving window/door
            var totalLength = Math.sqrt(leftOrAbovePt.distanceSquaredPoint(rightOrBelowPt));
            var distance = (part.data.width / 2);
            var point1 = new go.Point(leftOrAbovePt.x + ((distance / totalLength) * (rightOrBelowPt.x - leftOrAbovePt.x)),
            leftOrAbovePt.y + ((distance / totalLength) * (rightOrBelowPt.y - leftOrAbovePt.y)));
            var point2 = new go.Point(rightOrBelowPt.x + ((distance / totalLength) * (leftOrAbovePt.x - rightOrBelowPt.x)),
            rightOrBelowPt.y + ((distance / totalLength) * (leftOrAbovePt.y - rightOrBelowPt.y)));
 
            // calc distance from pt to line (part's wall) - use point to 2pt line segment distance formula
            var distFromWall = Math.abs(((wEnd.y - wStart.y) * pt.x) - ((wEnd.x - wStart.x) * pt.y) + (wEnd.x * wStart.y) - (wEnd.y * wStart.x)) /
                Math.sqrt(Math.pow((wEnd.y - wStart.y), 2) + Math.pow((wEnd.x - wStart.x), 2));
            var tolerance = (20 * wall.data.strokeWidth < 100) ? (20 * wall.data.strokeWidth) : 100;
 
            // if distance from pt to line > some tolerance, detach the wallPart from the wall
            if (distFromWall > tolerance) {
                part.containingGroup = null;
                part.angle = 0;
                allPointNodes.iterator.each(function (node) { myDiagram.remove(node) });
                allDimensionLinks.iterator.each(function (link) { myDiagram.remove(link) });
                allPointNodes.clear();
                allDimensionLinks.clear();
                updateWallDimensions();
            }
 
 
            // project the proposed location onto the line segment created by the new points (ensures wall parts are constrained properly when dragged)
            pt = pt.copy().projectOntoLineSegmentPoint(point1, point2);
            myDiagram.skipsUndoManager = true;
            myDiagram.startTransaction("set loc");
            myDiagram.model.setDataProperty(part.data, "loc", go.Point.stringify(pt));
            myDiagram.commitTransaction("set loc");
            myDiagram.skipsUndoManager = false;
 
            updateWallDimensions(); // update the dimension links created by having this wall part selected
        } return pt;
    }
 
    // resize adornment for windows and doors
    var wallPartResizeAdornment =
      $(go.Adornment, "Spot",
        { name: "WallPartResizeAdornment", locationSpot: go.Spot.Center },
        $(go.Placeholder),
        $(go.Shape, { alignment: go.Spot.Left, cursor: "w-resize", figure: "Diamond", desiredSize: new go.Size(7, 7), fill: "#ffffff", stroke: "#808080" }),
        $(go.Shape, { alignment: go.Spot.Right, cursor: "e-resize", figure: "Diamond", desiredSize: new go.Size(7, 7), fill: "#ffffff", stroke: "#808080" })
      );
 
    // define Node template for the window nodes
    myDiagram.nodeTemplateMap.add("WindowNode",
      $(go.Node, "Spot",
        {
            contextMenu: contextMenu,
            selectionObjectName: "SHAPE",
            selectionAdorned: false,
            locationSpot: go.Spot.Center,
            name: "NODE",
            toolTip: nodeToolTip,
            minSize: new go.Size(5, 5),
            resizable: true,
            resizeAdornmentTemplate: wallPartResizeAdornment,
            rotatable: false,
            doubleClick: function () { hideShow('selectionInfoWindow'); },
            dragComputation: dragWallParts,
            layerName: 'Foreground' // make sure windows are always in front of walls
        },
        new go.Binding("width", "width").makeTwoWay(),
        new go.Binding("height", "height").makeTwoWay(),
        new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
        new go.Binding("angle", "angle").makeTwoWay(),
        $(go.Shape,
        { name: "SHAPE", fill: "white", strokeWidth: 0 },
        new go.Binding("width", "width"),
        new go.Binding("height", "height"),
        new go.Binding("stroke", "isSelected", function (s, obj) { return s ? "dodgerblue" : "black"; }).ofObject(),
        new go.Binding("fill", "isSelected", function (s, obj) { return s ? "lightgray" : "white"; }).ofObject(),
        new go.Binding("figure", "shape")
        ),
        $(go.Shape,
        { name: "LINESHAPE", fill: "darkgray", strokeWidth: 0, height: 10 },
        new go.Binding("width", "width", function (width, obj) { return width - 10; }), // 5px padding each side
        new go.Binding("height", "height", function (height, obj) { return (height / 5); }),
        new go.Binding("stroke", "isSelected", function (s, obj) { return s ? "dodgerblue" : "black"; }).ofObject()
        )
      ));
 
    // define Node template for the palette Wall Node (becomes WallGroup when dropped onto diagram)
    myDiagram.nodeTemplateMap.add("PaletteWallNode",
      $(go.Node, "Spot", { selectionAdorned: false, locationSpot: go.Spot.Center },
        new go.Binding("width", "width").makeTwoWay(),
        new go.Binding("height", "height").makeTwoWay(),
        $(go.Shape, { name: "SHAPE", fill: "black", strokeWidth: 0, height: 10, figure: "Rectangle" },
        new go.Binding("width", "width").makeTwoWay(),
        new go.Binding("height", "height").makeTwoWay(),
        new go.Binding("fill", "isSelected", function (s, obj) { return s ? "dodgerblue" : "black"; }).ofObject(),
        new go.Binding("stroke", "isSelected", function (s, obj) { return s ? "dodgerblue" : "black"; }).ofObject())
      ));
 
    // selection adornment for door nodes 
    var doorSelectionAdornment =
        $(go.Adornment, "Vertical",
        { name: "DoorSelectionAdornment" },
        $(go.Panel, "Auto",
        $(go.Shape, { fill: null, stroke: null }),
        $(go.Placeholder)),
        $(go.Panel, "Horizontal", { defaultStretch: go.GraphObject.Vertical },
            $("Button",
                $(go.Picture, { source: "icons/flipDoorOpeningLeft.png", column: 0, desiredSize: new go.Size(12, 12) },
                    new go.Binding("source", "", function (obj) {
                        if (obj.adornedPart === null) return "icons/flipDoorOpeningRight.png";
                        else if (obj.adornedPart.data.swing === "left") return "icons/flipDoorOpeningRight.png";
                        else return "icons/flipDoorOpeningLeft.png";
                    }).ofObject()
                ),
                {
                    click: function (e, obj) {
                        myDiagram.startTransaction("flip door");
                        var door = obj.part.adornedPart;
                        if (door.data.swing === "left") myDiagram.model.setDataProperty(door.data, "swing", "right");
                        else myDiagram.model.setDataProperty(door.data, "swing", "left");
                        myDiagram.commitTransaction("flip door");
                    },
                    toolTip: $(go.Adornment, "Auto",
                        $(go.Shape, { fill: "#FFFFCC" }),
                        $(go.TextBlock, { margin: 4, text: "Flip Door Opening" }
                    ))
                },
                new go.Binding("visible", "", function (obj) { return (obj.adornedPart === null) ? false : (obj.adornedPart.containingGroup !== null); }).ofObject()
             ),
             $("Button",
                $(go.Picture, { source: "icons/flipDoorSide.png", column: 0, desiredSize: new go.Size(12, 12) }),
                {
                    click: function (e, obj) {
                        myDiagram.startTransaction("rotate door");
                        var door = obj.part.adornedPart;
                        door.angle = (door.angle + 180) % 360;
                        myDiagram.commitTransaction("rotate door");
                    },
                    toolTip: $(go.Adornment, "Auto",
                        $(go.Shape, { fill: "#FFFFCC" }),
                        $(go.TextBlock, { margin: 4, text: "Flip Door Side" }
                    ))
                }
             ),
             new go.Binding("visible", "", function (obj) { return (obj.adornedPart === null) ? false : (obj.adornedPart.containingGroup !== null); }).ofObject()
        )
      );
 
    // define Node template for the door nodes
    myDiagram.nodeTemplateMap.add("DoorNode",
      $(go.Node, "Spot",
        {
            contextMenu: contextMenu,
            selectionObjectName: "SHAPE",
            selectionAdornmentTemplate: doorSelectionAdornment,
            locationSpot: go.Spot.BottomCenter,
            resizable: true,
            resizeObjectName: "OPENING_SHAPE",
            rotatable: false,
            toolTip: nodeToolTip,
            minSize: new go.Size(10, 10),
            doubleClick: function () { hideShow('selectionInfoWindow'); },
            dragComputation: dragWallParts,
            resizeAdornmentTemplate: wallPartResizeAdornment,
            layerName: 'Foreground' // make sure windows are always in front of walls
        },
        // remember location of the Node
        new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
        new go.Binding("angle", "angle").makeTwoWay(),
        // the door's locationSpot is affected by it's openingHeight, which is affected by the thickness of its containing wall
        new go.Binding("locationSpot", "doorOpeningHeight", function (doh, obj) { return new go.Spot(0.5, 1, 0, -(doh / 2)); }),
        // this is the shape that reprents the door itself and its swing
        $(go.Shape, { name: "SHAPE", strokeWidth: 1 },
        new go.Binding("width", "width"),
        new go.Binding("height", "width").makeTwoWay(),
        new go.Binding("stroke", "isSelected", function (s, obj) { return s ? "dodgerblue" : "black"; }).ofObject(),
        new go.Binding("fill", "color"),
        new go.Binding("geometryString", "swing", function (swing) {
            if (swing === "left") return "F1 M0,0 v-150 a150,150 0 0,1 150,150 ";
            else return "F1 M275,175 v-150 a150,150 0 0,0 -150,150 ";
        })
        ),
        // this is the Shape that represents the door opening
        $(go.Shape,
        {
            name: "OPENING_SHAPE", fill: "white",
            strokeWidth: 0, height: 5, width: 40,
            alignment: go.Spot.BottomCenter, alignmentFocus: go.Spot.Center
        },
        new go.Binding("height", "doorOpeningHeight").makeTwoWay(),
        new go.Binding("stroke", "isSelected", function (s, obj) { return s ? "dodgerblue" : "black"; }).ofObject(),
        new go.Binding("fill", "isSelected", function (s, obj) { return s ? "lightgray" : "white"; }).ofObject(),
        new go.Binding("width", "width").makeTwoWay()
        )
      ));
 
    // used to construct angles created by walls
    myDiagram.nodeTemplateMap.add("AngleNode", $(go.Node, "Spot",
        new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
        { locationSpot: go.Spot.Center, locationObjectName: "SHAPE", selectionAdorned: false },
        $(go.Shape, "Circle", // placed where walls intersect, is invisible
        { name: "SHAPE", fill: "red", height: 0, width: 0 }),
        $(go.Shape, { stroke: "green", strokeWidth: 1.5, fill: null }, // arc
        new go.Binding("geometry", "", makeArc).ofObject(),
        new go.Binding("stroke", "stroke")),
        $(go.Panel, "Auto", { name: "ARCLABEL" },
        // position the label in the center of the arc
        new go.Binding("alignment", "sweep", function (sweep, panel) {
            var rad = Math.min(30, panel.part.data.maxRadius);
            var angle = panel.part.data.angle;
            var cntr = new go.Point(rad, 0).rotate(angle + sweep / 2);
            return new go.Spot(0.5, 0.5, cntr.x, cntr.y);
        }),
        $(go.Shape, { stroke: "black", fill: "white" },
        new go.Binding("stroke", "stroke")),
        $(go.TextBlock, { font: "7pt sans-serif", margin: new go.Margin(2, 2, 2, 2) },
        new go.Binding("text", "sweep", function (sweep) { return sweep.toFixed(2) + String.fromCharCode(176); }),
        new go.Binding("stroke", "color"))
      ))
      );
 
    // ********************************************************** DIAGRAM GROUP TEMPLATES ***********************************************************
    // standard group
    myDiagram.groupTemplateMap.add("",
        $(go.Group, "Vertical",
        {
            contextMenu: contextMenu, doubleClick: function () { hideShow('selectionInfoWindow'); },
            toolTip:
                $(go.Adornment, "Auto",
                    $(go.Shape, { fill: "#FFFFCC" }),
                    $(go.TextBlock, { margin: 4, text: "" },
                        new go.Binding("text", "", function (text, obj) {
                            var data = obj.part.adornedObject.data;
                            return "Name: " + data.caption + "\nNotes: " + data.notes;
                        }).ofObject())
                    )
        },
        new go.Binding("location", "loc"),
          $(go.Panel, "Auto",
            $(go.Shape, "RoundedRectangle",  { fill: "rgba(128,128,128,0.15)", stroke: 'rgba(128, 128, 128, .05)', name: 'SHAPE', strokeCap: 'square' },
              new go.Binding("fill", "isSelected", function (s, obj) {
                  return s ? "rgba(128, 128, 128, .15)" : "rgba(128, 128, 128, 0.10)";
              }).ofObject()
              ),
            $(go.Placeholder, { padding: 5 })  // extra padding around members
          )
        ));
 
    // drag computation function to snap walls to the grid properly while dragging
    var snapWalls = function (part, pt, gridPt) {
        updateWallDimensions();
        updateWallAngles();
        var grid = part.diagram.grid;
        var sPt = part.data.startpoint.copy();
        var ePt = part.data.endpoint.copy();
        var dx = pt.x - part.location.x;
        var dy = pt.y - part.location.y;
        var newSpt = sPt.offset(dx, dy);
        var newEpt = ePt.offset(dx, dy);
        if (myDiagram.toolManager.draggingTool.isGridSnapEnabled) {
            newSpt = newSpt.snapToGridPoint(grid.gridOrigin, grid.gridCellSize);
            newEpt = newEpt.snapToGridPoint(grid.gridOrigin, grid.gridCellSize);
        }
        myDiagram.model.setDataProperty(part.data, "startpoint", newSpt);
        myDiagram.model.setDataProperty(part.data, "endpoint", newEpt);
        return new go.Point((newSpt.x + newEpt.x) / 2, (newSpt.y + newEpt.y) / 2);
    }
 
    // used in addWallPart; find closest loc (to mousept) on wall a wallPart can be dropped onto without extending beyond wall endpoints or intruding into another wallPart
    function findClosestLocOnWall(wall, part) {
        var orderedConstrainingPts = []; // wall endpoints and wallPart endpoints
        var startpoint = wall.data.startpoint.copy();
        var endpoint = wall.data.endpoint.copy();
        // store all possible constraining endpoints (wall endpoints and wallPart endpoints) in the order in which they appear (left/top to right/bottom)
        var firstWallPt = ((startpoint.x + startpoint.y) <= (endpoint.x + endpoint.y)) ? startpoint : endpoint;
        var lastWallPt = ((startpoint.x + startpoint.y) > (endpoint.x + endpoint.y)) ? startpoint : endpoint;
        var wallPartEndpoints = [];
        wall.memberParts.iterator.each(function (wallPart) {
            var endpoints = getWallPartEndpoints(wallPart);
            wallPartEndpoints.push(endpoints[0]);
            wallPartEndpoints.push(endpoints[1]);
        });
        // sort all wallPartEndpoints by x coordinate left to right
        wallPartEndpoints.sort(function (a, b) {
            if ((a.x + a.y) > (b.x + b.y)) return 1;
            if ((a.x + a.y) < (b.x + b.y)) return -1;
            else return 0;
        });
        orderedConstrainingPts.push(firstWallPt);
        orderedConstrainingPts = orderedConstrainingPts.concat(wallPartEndpoints);
        orderedConstrainingPts.push(lastWallPt);
 
        // go through all constraining points; if there's a free stretch along the wall "part" could fit in, remember it
        var possibleStretches = [];
        for (var i = 0; i < orderedConstrainingPts.length; i += 2) {
            var point1 = orderedConstrainingPts[i];
            var point2 = orderedConstrainingPts[i + 1];
            var distanceBetween = Math.sqrt(point1.distanceSquaredPoint(point2));
            if (distanceBetween >= part.data.width) possibleStretches.push({ pt1: point1, pt2: point2 });
        }
 
        // go through all possible stretches along the wall the part *could* fit in; find the one closest to the part's current location
        var closestDist = Number.MAX_VALUE; var closestStretch = null;
        for (var i = 0; i < possibleStretches.length; i++) {
            var testStretch = possibleStretches[i];
            var testPoint1 = testStretch.pt1;
            var testPoint2 = testStretch.pt2;
            var testDistance1 = Math.sqrt(testPoint1.distanceSquaredPoint(part.location));
            var testDistance2 = Math.sqrt(testPoint2.distanceSquaredPoint(part.location));
            if (testDistance1 < closestDist) {
                closestDist = testDistance1;
                closestStretch = testStretch;
            }
            if (testDistance2 < closestDist) {
                closestDist = testDistance2;
                closestStretch = testStretch;
            }
        }
 
        // Edge Case: If there's no space for the wallPart, return null
        if (closestStretch === null) return null;
 
        // using the closest free stretch along the wall, calculate endpoints that make the stretch's line segment, then project part.location onto the segment
        var closestStretchLength = Math.sqrt(closestStretch.pt1.distanceSquaredPoint(closestStretch.pt2));
        var offset = part.data.width / 2;
        var point1 = new go.Point(closestStretch.pt1.x + ((offset / closestStretchLength) * (closestStretch.pt2.x - closestStretch.pt1.x)),
            closestStretch.pt1.y + ((offset / closestStretchLength) * (closestStretch.pt2.y - closestStretch.pt1.y)));
        var point2 = new go.Point(closestStretch.pt2.x + ((offset / closestStretchLength) * (closestStretch.pt1.x - closestStretch.pt2.x)),
        closestStretch.pt2.y + ((offset / closestStretchLength) * (closestStretch.pt1.y - closestStretch.pt2.y)));
        var newLoc = part.location.copy().projectOntoLineSegmentPoint(point1, point2);
        return newLoc;
    }
 
    // mouseDrop event for walls; if a door or window is dropped on a wall, add it to the wall group
    // do not allow dropping wallParts that would extend beyond wall endpoints or intrude into another wallPart
    var addWallPart = function (e, wall) {
        var wallPart = myDiagram.selection.first();
        if ((wallPart.category === "WindowNode" || wallPart.category === "DoorNode") && wallPart.containingGroup === null) {
            var newLoc = findClosestLocOnWall(wall, wallPart);
            if (newLoc !== null) {
                wall.findObject("SHAPE").stroke = "black";
                myDiagram.model.setDataProperty(wallPart.data, "group", wall.data.key);
                wallPart.location = newLoc.projectOntoLineSegmentPoint(wall.data.startpoint, wall.data.endpoint);
                wallPart.angle = wall.rotateObject.angle;
                if (wallPart.category === "WindowNode") myDiagram.model.setDataProperty(wallPart.data, "height", wall.data.strokeWidth);
                if (wallPart.category === "DoorNode") myDiagram.model.setDataProperty(wallPart.data, "doorOpeningHeight", wall.data.strokeWidth);
            } else {
                myDiagram.remove(wallPart);
                alert("There's not enough room on the wall!");
                return;
            }
        }
        setSelectionInfo(myDiagram.selection.first());
        updateWallDimensions();
    }
 
    // mouseDragEnter evemt for walls; if a door or window is dragged over a wall, highlight the wall and change its angle
    var wallPartDragOver = function (e, wall) {
        var parts = myDiagram.toolManager.draggingTool.draggingParts;
        parts.iterator.each(function (part) {
            if ((part.category === "WindowNode" || part.category === "DoorNode") && part.containingGroup === null) {
                wall.findObject("SHAPE").stroke = "lightblue";
                part.angle = wall.rotateObject.angle;
            }
        });
    }
 
    // mouseDragLeave event for walls; if a wall part is dragged past a wall, unhighlight the wall and change back the wall part's angle to 0
    var wallPartDragAway = function (e, wall) {
        wall.findObject("SHAPE").stroke = "black";
        var parts = myDiagram.toolManager.draggingTool.draggingParts;
        parts.iterator.each(function (part) {
            if ((part.category === "WindowNode" || part.category === "DoorNode") && part.containingGroup === null) part.angle = 0
        });
    }
 
    // wall group (has custom layout for handling window / door placement)
    myDiagram.groupTemplateMap.add("WallGroup", $(go.Group, "Spot",
        {
            contextMenu: contextMenu,
            toolTip: nodeToolTip,
            selectionObjectName: "SHAPE",
            rotateObjectName: "SHAPE",
            locationSpot: go.Spot.Center,
            reshapable: true,
            minSize: new go.Size(1, 1),
            dragComputation: snapWalls,
            selectionAdorned: false,
            mouseDrop: addWallPart,
            mouseDragEnter: wallPartDragOver,
            mouseDragLeave: wallPartDragAway,
            doubleClick: function () { hideShow('selectionInfoWindow'); }
        },
        $(go.Shape,
        {
            strokeWidth: 1,
            name: "SHAPE",
            fill: "black",
            stroke: "red",
            geometry: new go.Geometry(go.Geometry.Line),
            isGeometryPositioned: true
        },
        new go.Binding("strokeWidth", "strokeWidth"),
        new go.Binding("stroke", "isSelected", function (s, obj) {
            if (obj.part.containingGroup != null) {
                var group = obj.part.containingGroup;
                if (s) { group.data.isSelected = true; }
            }
            return s ? "dodgerblue" : "black";
        }).ofObject()
      )
      ));
 
    // ************************************************************************* PALETTE *****************************************************
 
    paletteModel = $(go.GraphLinksModel, { nodeDataArray: furnitureNodeDataArray });
 
    palette2Model = $(go.GraphLinksModel,
        {
            nodeDataArray: [
                {
                    category: "PaletteWallNode",
                    key: "wall",
                    caption: "Wall",
                    type: "Wall",
                    color: "#000000",
                    shape: "Rectangle",
                    height: 10,
                    width: 60,
                    notes: "",
                },
                {
                    category: "WindowNode",
                    key: "window",
                    color: "white",
                    caption: "Window",
                    type: "Window",
                    shape: "Rectangle",
                    height: 10,
                    width: 60,
                    notes: ""
                },
                {
                    key: "door",
                    category: "DoorNode",
                    color: "rgba(0, 0, 0, 0)",
                    caption: "Door",
                    type: "Door",
                    width: 40,
                    doorOpeningHeight: 5,
                    swing: "left",
                    notes: ""
                }
            ]
        });
 
    // Furniture Palette
    myPalette = $(go.Palette, "myPaletteDiv",
        {
            contentAlignment: go.Spot.Center,
            nodeTemplateMap: myDiagram.nodeTemplateMap, // shared node template with main diagram
            "contextMenuTool.isEnabled": false,
            model: paletteModel,
            scale: 1
        });
 
    // Wall Parts Palette
    myPalette2 = $(go.Palette, "myPalette2Div",
        {
            contentAlignment: go.Spot.Center,
            nodeTemplateMap: myDiagram.nodeTemplateMap, // shared node template with main diagram
            "contextMenuTool.isEnabled": false,
            model: palette2Model,
            scale: 1
        });
 
    // display different help depending on selection context
    myDiagram.addDiagramListener("ChangedSelection", function (e) {
        var selection = myDiagram.selection;
        var node = myDiagram.selection.first(); // only used if selection.count === 1
        if (selection.count === 0) setDiagramHelper("Click to select a part, drag one from a Palette, or draw a wall with the Wall Tool (Ctr + 1)");
        else if (selection.count > 1) {
            var ungroupable = false;
            selection.iterator.each(function (node) { if (node.category === "WindowNode" || node.category === "DoorNode" || node.category === "WallGroup") ungroupable = true; });
            if (!ungroupable) setDiagramHelper("You may group your selection with the context menu (Right Click anywhere)");
        }
        else if (node.category === "WallGroup") setDiagramHelper("Drag wall endpoints or add doors and windows to the wall from the Wall Parts Palette");
        else if (selection.first().category === "WindowNode" || selection.first().category === "DoorNode") {
            if (node.containingGroup !== null) setDiagramHelper("Drag and resize wall part along the wall; drag away from wall to detach");
            else setDiagramHelper("Drag part so the cursor is over a wall to add this part to a wall");
        }
        else if (selection.first().category === "MultiPurposeNode") setDiagramHelper("Double click on part text to revise it");
        else setDiagramHelper("Drag, resize, or rotate (hold SHIFT for no snap) your selection");
    });
 
    // ****************************************************************** OTHER TOOL OVERRIDES *****************************************************************
 
    // if a wall was dragged to intersect another wall, update angle displays
    myDiagram.toolManager.draggingTool.doMouseUp = function () {
        go.DraggingTool.prototype.doMouseUp.call(this);
        updateWallAngles();
        this.isGridSnapEnabled = myDiagram.model.modelData.preferences.gridSnap;
    }
 
    // if user is holding shift while dragging, do not use grid snap
    myDiagram.toolManager.draggingTool.doMouseMove = function () {
        if (myDiagram.lastInput.shift) {
            this.isGridSnapEnabled = false;
        } else this.isGridSnapEnabled = myDiagram.model.modelData.preferences.gridSnap;
        go.DraggingTool.prototype.doMouseMove.call(this);
    }
 
    // when resizing, constantly update the node info box with updated size info; constantly update dimension links
    myDiagram.toolManager.resizingTool.doMouseMove = function () {
        var node = this.adornedObject;
        // if node is the only thing selected, display its info as its resized
        if (this.diagram.selection.count === 1) setSelectionInfo(node);
        updateWallDimensions();
        go.ResizingTool.prototype.doMouseMove.call(this);
    }
 
    // when resizing a wallPart, do not allow it to be resized past the nearest wallPart / wall endpoints
    myDiagram.toolManager.resizingTool.computeMaxSize = function () {
        var tool = this;
        var obj = tool.adornedObject.part;
        var wall = myDiagram.findPartForKey(obj.data.group);
        if ((obj.category === 'DoorNode' || obj.category === 'WindowNode') && wall !== null) {
            var stationaryPt; var movingPt;
            var resizeAdornment = null;
            obj.adornments.iterator.each(function (adorn) { if (adorn.name === "WallPartResizeAdornment") resizeAdornment = adorn; });
            resizeAdornment.elements.iterator.each(function (el) {
                if (el instanceof go.Shape && el.alignment === tool.handle.alignment) movingPt = el.getDocumentPoint(go.Spot.Center);
                if (el instanceof go.Shape && el.alignment !== tool.handle.alignment) stationaryPt = el.getDocumentPoint(go.Spot.Center);
            });
            // find the constrainingPt; that is, the endpoint (wallPart endpoint or wall endpoint) that is the one closest to movingPt but still farther from stationaryPt than movingPt
            // this loop checks all other wallPart endpoints of the wall that the resizing wallPart is a part of
            var constrainingPt; var closestDist = Number.MAX_VALUE;
            wall.memberParts.iterator.each(function (part) {
                if (part.data.key !== obj.data.key) {
                    var endpoints = getWallPartEndpoints(part);
                    for (var i = 0; i < endpoints.length; i++) {
                        var point = endpoints[i];
                        var distanceToMovingPt = Math.sqrt(point.distanceSquaredPoint(movingPt));
                        if (distanceToMovingPt < closestDist) {
                            var distanceToStationaryPt = Math.sqrt(point.distanceSquaredPoint(stationaryPt));
                            if (distanceToStationaryPt > distanceToMovingPt) {
                                closestDist = distanceToMovingPt;
                                constrainingPt = point;
                            }
                        }
                    }
                }
            });
            // if we're not constrained by a wallPart endpoint, the constraint will come from a wall endpoint; figure out which one
            if (constrainingPt === undefined || constrainingPt === null) {
                if (wall.data.startpoint.distanceSquaredPoint(movingPt) > wall.data.startpoint.distanceSquaredPoint(stationaryPt)) constrainingPt = wall.data.endpoint;
                else constrainingPt = wall.data.startpoint;
            }
            // set the new max size of the wallPart according to the constrainingPt
            var maxLength = Math.sqrt(stationaryPt.distanceSquaredPoint(constrainingPt));
            return new go.Size(maxLength, wall.data.strokeWidth);
        }
        return go.ResizingTool.prototype.computeMaxSize.call(tool);
    }
 
    // ---------------------------------------------- INSTALL CUSTOM TOOLS --------------------------------------------------------------
    var wallBuildingTool = new WallBuildingTool();
    myDiagram.toolManager.mouseDownTools.insertAt(0, wallBuildingTool);
 
    var wallReshapingTool = new WallReshapingTool();
    myDiagram.toolManager.mouseDownTools.insertAt(3, wallReshapingTool);
 
    // --------------------------------------------- INITIALIZE VARIABLES AND UI ----------------------------------------------------------
    setBehavior('dragging'); // active tool is Move / Select (Ctrl + 2)
    // set grid size initially to 20cm boxes (10px by 10px, since 1px = 2cm)
    myDiagram.toolManager.draggingTool.gridCellSize = new go.Size(myDiagram.model.modelData.gridSize, myDiagram.model.modelData.gridSize);
    myDiagram.grid = $(go.Panel, "Grid",
                { gridCellSize: new go.Size(myDiagram.model.modelData.gridSize, myDiagram.model.modelData.gridSize), visible: true },
                $(go.Shape, "LineH", { stroke: "lightgray" }),
                $(go.Shape, "LineV", { stroke: "lightgray" }));
    setDiagramHelper("Drag a part to the Diagram or select the Wall Tool (Ctrl + 1) to begin");
    document.getElementById('gridSizeInput').value = convertPixelsToUnits(myDiagram.model.modelData.gridSize).toFixed(2);
    document.getElementById('wallWidthInput').value = convertPixelsToUnits(myDiagram.model.modelData.wallWidth).toFixed(2);
    loadFileToModel(document.getElementById("initialModel").value);
    myDiagram.isModified = false;
    updateStatistics();
 
} // end init
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/FreehandDrawingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/FreehandDrawingTool.js

Statements: 2.04% (2 / 98)      Branches: 0% (0 / 41)      Functions: 0% (0 / 14)      Lines: 2.22% (2 / 90)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225                                            1                     2                                                                                                                                                                                                                                                                                                                                                                                              
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom Tool for freehand drawing
 
/**
* @constructor
* @extends Tool
* @class
* This tool allows the user to draw a shape using the mouse.
* It collects all of the points from a mouse-down, all mouse-moves, until a mouse-up,
* and puts all of those points in a {@link Geometry} used by a {@link Shape}.
* It then adds a node data object to the diagram's model.
* <p/>
* This tool may be installed as the first mouse down tool:
* <code>myDiagram.toolManager.mouseDownTools.insertAt(0, new FreehandDrawingTool());</code>
* <p/>
* The Shape used during the drawing operation can be customized by setting {@link #temporaryShape}.
* The node data added to the model can be customized by setting {@link #archetypePartData}.
*/
function FreehandDrawingTool() {
  go.Tool.call(this);
  this.name = "FreehandDrawing";
  this._archetypePartData = {}; // the data to copy for a new polyline Part
  this._isBackgroundOnly = true; // affects canStart()
 
  // this is the Shape that is shown during a drawing operation
  this._temporaryShape = go.GraphObject.make(go.Shape, { name: "SHAPE", fill: null, strokeWidth: 1.5 });
  // the Shape has to be inside a temporary Part that is used during the drawing operation
  go.GraphObject.make(go.Part, { layerName: "Tool" }, this._temporaryShape);
}
go.Diagram.inherit(FreehandDrawingTool, go.Tool);
 
/**
* Only start if the diagram is modifiable and allows insertions.
* OPTIONAL: if the user is starting in the diagram's background, not over an existing Part.
* @this {FreehandDrawingTool}
*/
FreehandDrawingTool.prototype.canStart = function() {
  if (!this.isEnabled) return false;
  var diagram = this.diagram;
  if (diagram === null || diagram.isReadOnly || diagram.isModelReadOnly) return false;
  if (!diagram.allowInsert) return false;
  // don't include the following check when this tool is running modally
  if (diagram.currentTool !== this && this.isBackgroundOnly) {
    // only operates in the background, not on some Part
    var part = diagram.findPartAt(diagram.lastInput.documentPoint, true);
    if (part !== null) return false;
  }
  return true;
};
 
/**
* Capture the mouse and use a "crosshair" cursor.
* @this {FreehandDrawingTool}
*/
FreehandDrawingTool.prototype.doActivate = function() {
  go.Tool.prototype.doActivate.call(this);
  this.diagram.isMouseCaptured = true;
  this.diagram.currentCursor = "crosshair";
};
 
/**
* Cleanup.
* @this {FreehandDrawingTool}
*/
FreehandDrawingTool.prototype.doDeactivate = function() {
  go.Tool.prototype.doDeactivate.call(this);
  if (this.temporaryShape !== null) {
    this.diagram.remove(this.temporaryShape.part);
  }
  this.diagram.currentCursor = "";
  this.diagram.isMouseCaptured = false;
};
 
/**
* This adds a Point to the {@link #temporaryShape}'s geometry.
* <p/>
* If the Shape is not yet in the Diagram, its geometry is initialized and
* its parent Part is added to the Diagram.
* <p/>
* If the point is less than half a pixel away from the previous point, it is ignored.
* @this {FreehandDrawingTool}
* @param {Point} p
*/
FreehandDrawingTool.prototype.addPoint = function(p) {
  var shape = this.temporaryShape;
  if (shape === null) return;
 
  // for the temporary Shape, normalize the geometry to be in the viewport
  var viewpt = this.diagram.viewportBounds.position;
  var q = new go.Point(p.x-viewpt.x, p.y-viewpt.y);
 
  var part = shape.part;
  if (part.diagram === null) {
    var fig = new go.PathFigure(q.x, q.y, true);  // possibly filled, depending on Shape.fill
    var geo = new go.Geometry().add(fig);  // the Shape.geometry consists of a single PathFigure
    this.temporaryShape.geometry = geo;
    part.position = viewpt;  // position the Shape's Part
    this.diagram.add(part);
  }
 
  // only add a point if it isn't too close to the last one
  var segs = shape.geometry.figures.first().segments;
  var idx = segs.count-1;
  if (idx >= 0) {
    var last = segs.elt(idx);
    if (Math.abs(q.x - last.endX) < 0.5 && Math.abs(q.y - last.endY) < 0.5) return;
  }
 
  // must copy whole Geometry in order to add a PathSegment
  var geo = shape.geometry.copy();
  var fig = geo.figures.first();
  var seg = new go.PathSegment(go.PathSegment.Line, q.x, q.y);
  fig.add(seg);
  shape.geometry = geo;
};
 
/**
* Start drawing the line by starting to accumulate points in the {@link #temporaryShape}'s geometry.
* @this {FreehandDrawingTool}
*/
FreehandDrawingTool.prototype.doMouseDown = function() {
  if (!this.isActive) {
    this.doActivate();
    // the first point
    this.addPoint(this.diagram.lastInput.documentPoint);
  }
};
 
/**
* Keep accumulating points in the {@link #temporaryShape}'s geometry.
* @this {FreehandDrawingTool}
*/
FreehandDrawingTool.prototype.doMouseMove = function() {
  if (this.isActive) {
    this.addPoint(this.diagram.lastInput.documentPoint);
  }
};
 
/**
* Finish drawing the line by adding a node data object holding the
* geometry string and the node position that the node template can bind to.
* This copies the {@link #archetypePartData} and adds it to the model.
* @this {FreehandDrawingTool}
*/
FreehandDrawingTool.prototype.doMouseUp = function() {
  var started = false;
  if (this.isActive) {
    started = true;
    var diagram = this.diagram;
    // the last point
    this.addPoint(diagram.lastInput.documentPoint);
    // normalize geometry and node position
    var viewpt = diagram.viewportBounds.position;
    var geo = this.temporaryShape.geometry.copy();
    var pos = geo.normalize();
    pos.x = viewpt.x - pos.x;
    pos.y = viewpt.y - pos.y;
 
    diagram.startTransaction(this.name);
    // create the node data for the model
    var d = diagram.model.copyNodeData(this.archetypePartData);
    // adding data to model creates the actual Part
    diagram.model.addNodeData(d);
    var part = diagram.findPartForData(d);
    // assign the location
    part.location = new go.Point(pos.x + geo.bounds.width/2, pos.y + geo.bounds.height/2);
    // assign the Shape.geometry
    var shape = part.findObject("SHAPE");
    if (shape !== null) shape.geometry = geo;
  }
  this.stopTool();
  if (started) diagram.commitTransaction(this.name);
};
 
// Public properties
 
/**
* Gets or sets the Shape that is used to hold the line as it is being drawn.
* The default value is a simple Shape drawing an unfilled open thin black line.
* @name FreehandDrawingTool#temporaryShape
* @function.
* @return {Shape}
*/
Object.defineProperty(FreehandDrawingTool.prototype, "temporaryShape", {
  get: function() { return this._temporaryShape; },
  set: function(val) {
    if (this._temporaryShape !== val && val !== null) {
      val.name = "SHAPE";
      var panel = this._temporaryShape.panel;
      panel.remove(this._temporaryShape);
      this._temporaryShape = val;
      panel.add(this._temporaryShape);
    }
  }
});
 
/**
* Gets or sets the node data object that is copied and added to the model
* when the freehand drawing operation completes.
* @name FreehandDrawingTool#archetypePartData
* @function.
* @return {Object}
*/
Object.defineProperty(FreehandDrawingTool.prototype, "archetypePartData", {
  get: function() { return this._archetypePartData; },
  set: function(val) { this._archetypePartData = val; }
});
 
/**
* Gets or sets whether this tool can only run if the user starts in the diagram's background
* rather than on top of an existing Part.
* The default value is true.
* @name FreehandDrawingTool#isBackgroundOnly
* @function.
* @return {Object}
*/
Object.defineProperty(FreehandDrawingTool.prototype, "isBackgroundOnly", {
  get: function() { return this._isBackgroundOnly; },
  set: function(val) { this._isBackgroundOnly = val; }
});
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/GeometryReshapingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/GeometryReshapingTool.js

Statements: 0.96% (2 / 208)      Branches: 0% (0 / 85)      Functions: 0% (0 / 20)      Lines: 1.12% (2 / 178)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353                                    1                                                 2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
/**
* @constructor
* @extends Tool
* @class
* This GeometryReshapingTool class allows for a Shape's Geometry to be modified by the user
* via the dragging of tool handles. 
* This does not handle Links, whose routes should be reshaped by the LinkReshapingTool.
* The {@link #reshapeObjectName} needs to identify the named {@link Shape} within the
* selected {@link Part}.
* If the shape cannot be found or if its {@link Shape#geometry} is not of type {@link Geometry#Path},
* this will not show any GeometryReshaping {@link Adornment}.
* At the current time this tool does not support adding or removing {@link PathSegment}s to the Geometry.
*/
function GeometryReshapingTool() {
	go.Tool.call(this);
	this.name = "GeometryReshaping";
 
	var h = new go.Shape();
  h.figure = "Diamond";
  h.desiredSize = new go.Size(7, 7);
  h.fill = "lightblue";
  h.stroke = "dodgerblue";
  h.cursor = "move";
  /** @type {GraphObject} */
	this._handleArchetype = h;
 
  /** @type {string} */
	this._reshapeObjectName = 'SHAPE';  //??? can't add Part.reshapeObjectName property
  // there's no Part.reshapeAdornmentTemplate either
 
  // internal state
  /** @type {GraphObject} */
	this._handle = null;
  /** @type {Shape} */
	this._adornedShape = null;
  /** @type {Geometry} */
	this._originalGeometry = null;  // in case the tool is cancelled and the UndoManager is not enabled
}
go.Diagram.inherit(GeometryReshapingTool, go.Tool);
 
 
/*
* A small GraphObject used as a reshape handle for each segment.
* The default GraphObject is a small blue diamond.
* @name GeometryReshapingTool#handleArchetype 
* @function.
* @return {GraphObject}
*/
Object.defineProperty(GeometryReshapingTool.prototype, "handleArchetype", {
  get: function() { return this._handleArchetype; },
  set: function(val) { this._handleArchetype = value; }
});
 
/*
* The name of the GraphObject to be reshaped.
* @name GeometryReshapingTool#reshapeObjectName
* @function.
* @return {string}
*/
Object.defineProperty(GeometryReshapingTool.prototype, "reshapeObjectName", {
  get: function() { return this._reshapeObjectName; },
  set: function(val) { this._reshapeObjectName = value; }
});
 
/*
* This read-only property returns the {@link GraphObject} that is the tool handle being dragged by the user.
* This will be contained by an {@link Adornment} whose category is "GeometryReshaping".
* Its {@link Adornment#adornedObject} is the same as the {@link #adornedShape}.
* @name GeometryReshapingTool#handle
* @function.
* @return {GraphObject}
*/
Object.defineProperty(GeometryReshapingTool.prototype, "handle", {
  get: function() { return this._handle; }
});
 
/*
* Gets the {@link Shape} that is being reshaped.
* This must be contained within the selected Part.
* @name GeometryReshapingTool#adornedShape
* @function.
* @return {Shape}
*/
Object.defineProperty(GeometryReshapingTool.prototype, "adornedShape", {
  get: function() { return this._adornedShape; }
});
 
/*
* This read-only property remembers the original value for {@link Shape#geometry},
* so that it can be restored if this tool is cancelled.
* @name GeometryReshapingTool#originalGeometry
* @function.
* @return {Geometry}
*/
Object.defineProperty(GeometryReshapingTool.prototype, "originalGeometry", {
  get: function() { return this._originalGeometry; }
});
 
 
/**
* Show an {@link Adornment} with a reshape handle at each point of the geometry.
* Don't show anything if {@link #reshapeObjectName} doesn't identify a {@link Shape}
* that has a {@link Shape#geometry} of type {@link Geometry#Path}.
* @this {GeometryReshapingTool}
* @param {Part} part the part.
*/
GeometryReshapingTool.prototype.updateAdornments = function(part) {
  if (part === null || part instanceof go.Link) return;  // this tool never applies to Links
  if (part.isSelected && !this.diagram.isReadOnly) {
    var selelt = part.findObject(this.reshapeObjectName);
    if (selelt instanceof go.Shape && selelt.actualBounds.isReal() && selelt.isVisibleObject() &&
        part.canReshape() && part.actualBounds.isReal() && part.isVisible() &&
        selelt.geometry.type === go.Geometry.Path) {
      var adornment = part.findAdornment(this.name);
      if (adornment === null) {
        adornment = this.makeAdornment(selelt);
      }
      if (adornment !== null) {
        // update the position/alignment of each handle
        var geo = selelt.geometry;
        var b = geo.bounds;
        // update the size of the adornment
        adornment.findObject("BODY").desiredSize = b.size;
        adornment.elements.each(function(h) {
          if (h._typ === undefined) return;
          var fig = geo.figures.elt(h._fig);
          var seg = fig.segments.elt(h._seg);
          var x = 0;
          var y = 0;
          switch (h._typ) {
            case 0: x = fig.startX; y = fig.startY; break;
            case 1: x = seg.endX; y = seg.endY; break;
            case 2: x = seg.point1X; y = seg.point1Y; break;
            case 3: x = seg.point2X; y = seg.point2Y; break;
          }
          var bw = b.width;
          if (bw === 0) bw = 0.001;
          var bh = b.height;
          if (bh === 0) bh = 0.001;
          h.alignment = new go.Spot(Math.max(0, Math.min((x - b.x) / bw, 1)),
                                    Math.max(0, Math.min((y - b.y) / bh, 1)));
        });
 
        part.addAdornment(this.name, adornment);
        adornment.location = selelt.getDocumentPoint(go.Spot.TopLeft);
        adornment.angle = selelt.getDocumentAngle();
        return;
      }
    }
  }
  part.removeAdornment(this.name);
};
 
/*
* @this {GeometryReshapingTool}
*/
GeometryReshapingTool.prototype.makeAdornment = function(selelt) {
  var adornment = new go.Adornment();
  adornment.type = go.Panel.Spot;
  adornment.locationObjectName = "BODY";
  adornment.locationSpot = new go.Spot(0, 0, -selelt.strokeWidth / 2, -selelt.strokeWidth / 2);
  var h = new go.Shape();
  h.name = "BODY";
  h.fill = null;
  h.stroke = null;
  h.strokeWidth = 0;
  adornment.add(h);
 
  var geo = selelt.geometry;
  // requires Path Geometry, checked above in updateAdornments
  for (var f = 0; f < geo.figures.count; f++) {
    var fig = geo.figures.elt(f);
    for (var g = 0; g < fig.segments.count; g++) {
      var seg = fig.segments.elt(g);
      var h;
      if (g === 0) {
        h = this.makeHandle(selelt, fig, seg);
        if (h !== null) {
          h._typ = 0;
          h._fig = f;
          h._seg = g;
          adornment.add(h);
        }
      }
      h = this.makeHandle(selelt, fig, seg);
      if (h !== null) {
        h._typ = 1;
        h._fig = f;
        h._seg = g;
        adornment.add(h);
      }
      if (seg.type === go.PathSegment.QuadraticBezier || seg.type === go.PathSegment.Bezier) {
        h = this.makeHandle(selelt, fig, seg);
        if (h !== null) {
          h._typ = 2;
          h._fig = f;
          h._seg = g;
          adornment.add(h);
        }
        if (seg.type === go.PathSegment.Bezier) {
          h = this.makeHandle(selelt, fig, seg);
          if (h !== null) {
            h._typ = 3;
            h._fig = f;
            h._seg = g;
            adornment.add(h);
          }
        }
      }
    }
  }
  adornment.category = this.name;
  adornment.adornedObject = selelt;
  return adornment;
};
 
/*
* @this {GeometryReshapingTool}
*/
GeometryReshapingTool.prototype.makeHandle = function(selelt, fig, seg) {
  var h = this.handleArchetype;
  if (h === null) return null;
  return h.copy();
};
 
 
/*
* @this {GeometryReshapingTool}
*/
GeometryReshapingTool.prototype.canStart = function() {
  if (!this.isEnabled) return false;
 
  var diagram = this.diagram;
  if (diagram === null || diagram.isReadOnly) return false;
  if (!diagram.allowReshape) return false;
  if (!diagram.lastInput.left) return false;
  var h = this.findToolHandleAt(diagram.firstInput.documentPoint, this.name);
  return (h !== null);
};
 
/**
* @this {GeometryReshapingTool}
*/
GeometryReshapingTool.prototype.doActivate = function() {
  var diagram = this.diagram;
  if (diagram === null) return;
  this._handle = this.findToolHandleAt(diagram.firstInput.documentPoint, this.name);
  if (this._handle === null) return;
  var shape = this._handle.part.adornedObject;
  if (!shape) return;
  this._adornedShape = shape;
  diagram.isMouseCaptured = true;
  this.startTransaction(this.name);
  this._originalGeometry = shape.geometry;
  this.isActive = true;
};
 
/**
* @this {GeometryReshapingTool}
*/
GeometryReshapingTool.prototype.doDeactivate = function() {
  this.stopTransaction();
 
  this._handle = null;
  this._adornedShape = null;
  var diagram = this.diagram;
  if (diagram !== null) diagram.isMouseCaptured = false;
  this.isActive = false;
};
 
/**
* @this {GeometryReshapingTool}
*/
GeometryReshapingTool.prototype.doCancel = function() {
  var shape = this._adornedShape;
  if (shape !== null) {
    // explicitly restore the original route, in case !UndoManager.isEnabled
    shape.geometry = this._originalGeometry;
  }
  this.stopTool();
};
 
/**
* @this {GeometryReshapingTool}
*/
GeometryReshapingTool.prototype.doMouseMove = function() {
  var diagram = this.diagram;
  if (this.isActive && diagram !== null) {
    var newpt = this.computeReshape(diagram.lastInput.documentPoint);
    this.reshape(newpt);
  }
};
 
/**
* @this {GeometryReshapingTool}
*/
GeometryReshapingTool.prototype.doMouseUp = function() {
  var diagram = this.diagram;
  if (this.isActive && diagram !== null) {
    var newpt = this.computeReshape(diagram.lastInput.documentPoint);
    this.reshape(newpt);
    this.transactionResult = this.name;  // success
  }
  this.stopTool();
};
 
/**
* @expose
* @this {GeometryReshapingTool}
* @param {Point} newPoint the value of the call to {@link #computeReshape}.
*/
GeometryReshapingTool.prototype.reshape = function(newPoint) {
  var shape = this.adornedShape;
  var locpt = shape.getLocalPoint(newPoint);
  var geo = shape.geometry.copy();
  shape.desiredSize = new go.Size(NaN, NaN); // set the desiredSize once we've gotten our Geometry so we don't clobber
  var type = this.handle._typ;
  if (type === undefined) return;
  var fig = geo.figures.elt(this.handle._fig);
  var seg = fig.segments.elt(this.handle._seg);
  switch (type) {
    case 0: fig.startX = locpt.x; fig.startY = locpt.y; break;
    case 1: seg.endX = locpt.x; seg.endY = locpt.y; break;
    case 2: seg.point1X = locpt.x; seg.point1Y = locpt.y; break;
    case 3: seg.point2X = locpt.x; seg.point2Y = locpt.y; break;
  }
  var offset = geo.normalize();  // avoid any negative coordinates in the geometry
  shape.geometry = geo;  // modify the Shape
  var part = shape.part;  // move the Part holding the Shape
  if (!part.locationSpot.equals(go.Spot.Center)) {  // but only if the locationSpot isn't Center
    part.move(part.position.copy().subtract(offset));
  }
  this.updateAdornments(part);  // update any Adornments of the Part
  this.diagram.maybeUpdate();  // force more frequent drawing for smoother looking behavior
};
 
 
/**
* @expose
* @this {GeometryReshapingTool}
* @param {Point} p the point where the handle is being dragged.
* @return {Point}
*/
GeometryReshapingTool.prototype.computeReshape = function(p) {
  return p;  // no constraints on the points
};
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/GuidedDraggingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/GuidedDraggingTool.js

Statements: 0.78% (2 / 256)      Branches: 0% (0 / 115)      Functions: 0% (0 / 30)      Lines: 0.96% (2 / 208)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464                        1                                                                                                     2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
/**
* @constructor
* @extends DraggingTool
* @class
* This draggingTool class makes guidelines visible as the parts are dragged around a diagram
* when the selected part is nearly aligned with another part.
*/
function GuidedDraggingTool() {
  go.DraggingTool.call(this);
 
  // temporary parts for horizonal guidelines
  var $ = go.GraphObject.make;
  var partProperties = { layerName: "Tool", isInDocumentBounds: false };
  var shapeProperties = { stroke: "gray", isGeometryPositioned: true };
  /** @ignore */
  this.guidelineHtop =
      $(go.Part, partProperties,
          $(go.Shape, shapeProperties, { geometryString: "M0 0 100 0" }));
  /** @ignore */
  this.guidelineHbottom =
      $(go.Part, partProperties,
          $(go.Shape, shapeProperties, { geometryString: "M0 0 100 0" }));
  /** @ignore */
  this.guidelineHcenter =
      $(go.Part, partProperties,
          $(go.Shape, shapeProperties, { geometryString: "M0 0 100 0" }));
  // temporary parts for vertical guidelines
  /** @ignore */
  this.guidelineVleft =
      $(go.Part, partProperties,
          $(go.Shape, shapeProperties, { geometryString: "M0 0 0 100" }));
  /** @ignore */
  this.guidelineVright =
      $(go.Part, partProperties,
          $(go.Shape, shapeProperties, { geometryString: "M0 0 0 100" }));
  /** @ignore */
  this.guidelineVcenter =
      $(go.Part, partProperties,
          $(go.Shape, shapeProperties, { geometryString: "M0 0 0 100" }));
 
  // properties that the programmer can modify
  /** @type {number} */
  this._guidelineSnapDistance = 6;
  /** @type {boolean} */
  this._isGuidelineEnabled = true;
  /** @type {string} */
  this._horizontalGuidelineColor = "gray";
  /** @type {string} */
  this._verticalGuidelineColor = "gray";
  /** @type {string} */
  this._centerGuidelineColor = "gray";
  /** @type {number} */
  this._guidelineWidth = 1;
  /** @type {number} */
  this._searchDistance = 1000;
  /** @type {boolean} */
  this._isGuidelineSnapEnabled = true;
}
go.Diagram.inherit(GuidedDraggingTool, go.DraggingTool);
 
/**
* Removes all of the guidelines from the grid.
* @this {GuidedDraggingTool}
*/
GuidedDraggingTool.prototype.clearGuidelines = function() {
  this.diagram.remove(this.guidelineHbottom);
  this.diagram.remove(this.guidelineHcenter);
  this.diagram.remove(this.guidelineHtop);
  this.diagram.remove(this.guidelineVleft);
  this.diagram.remove(this.guidelineVright);
  this.diagram.remove(this.guidelineVcenter);
}
 
/**
* Calls the base method from {@link DraggingTool#doDeactivate}
* and removes the guidelines from the graph.
* @this {GuidedDraggingTool}
*/
GuidedDraggingTool.prototype.doDeactivate = function() {
  go.DraggingTool.prototype.doDeactivate.call(this);
  // clear any guidelines when dragging is done
  this.clearGuidelines();
};
 
GuidedDraggingTool.prototype.doDragOver = function(pt, obj) {
  // clear all existing guidelines in case either show... method decides to show a guideline
  this.clearGuidelines();
 
  // gets the selected part
  var partItr = (this.copiedParts || this.draggedParts).iterator;
  partItr.next();
  var part = partItr.key;
 
  this.showHorizontalMatches(part, this.isGuidelineEnabled, false);
  this.showVerticalMatches(part, this.isGuidelineEnabled, false);
}
 
/**
* On a mouse-up, snaps the selected part to the nearest guideline.
* If no guidelines are showing, the part remains at its position.
* This calls {@link #guidelineSnap}.
* @this {GuidedDraggingTool}
*/
GuidedDraggingTool.prototype.doDropOnto = function(pt, obj) {
  // gets the selected (perhaps copied) Part
  var partItr = (this.copiedParts || this.draggedParts).iterator;
  partItr.next();
  var part = partItr.key;
 
  // snaps only when the mouse is released without shift modifier
  var e = this.diagram.lastInput;
  var snap = this.isGuidelineSnapEnabled && !e.shift;
 
  this.showHorizontalMatches(part, this.isGuidelineEnabled, snap);
  this.showVerticalMatches(part, this.isGuidelineEnabled, snap);
}
 
/**
* When nodes are shifted due to being guided upon a drop, make sure all connected link routes are invalidated,
* since the node is likely to have moved a different amount than all its connected links in the regular
* operation of the DraggingTool.
* @this {GuidedDraggingTool}
*/
GuidedDraggingTool.prototype.invalidateLinks = function(node) {
  if (node instanceof go.Node) node.invalidateConnectedLinks();
}
 
/**
* This finds parts that are aligned near the selected part along horizontal lines. It compares the selected
* part to all parts within a rectangle approximately twice the {@link #searchDistance} wide.
* The guidelines appear when a part is aligned within a margin-of-error equal to {@link #guidelineSnapDistance}.
* The parameters used for {@link #guidelineSnap} are also set here.
* @this {GuidedDraggingTool}
* @param {Part} part
* @param {boolean} guideline if true, show guideline
* @param {boolean} snap if true, snap the part to where the guideline would be
*/
GuidedDraggingTool.prototype.showHorizontalMatches = function(part, guideline, snap) {
  var partBounds = part.actualBounds;
  var p0 = partBounds.y;
  var p1 = partBounds.y + partBounds.height/2;
  var p2 = partBounds.y + partBounds.height;
 
  var marginOfError = this.guidelineSnapDistance;
  var distance = this.searchDistance;
  // compares with parts within narrow vertical area
  var area = partBounds.copy();
  area.inflate(distance, marginOfError + 1);
  var otherParts = this.diagram.findObjectsIn(area,
      function(obj) { return obj.part; },
      function(part) { return part instanceof go.Part && !(part instanceof go.Link) && part.isTopLevel && !part.layer.isTemporary; },
      true);
 
  var bestDiff = marginOfError;
  var bestPart = null;
  var bestSpot;
  var bestOtherSpot;
  // horizontal line -- comparing y-values
  otherParts.each(function(other) {
    if (other === part) return; // ignore itself
 
    var otherBounds = other.actualBounds;
    var q0 = otherBounds.y;
    var q1 = otherBounds.y + otherBounds.height/2;
    var q2 = otherBounds.y + otherBounds.height;
 
    // compare center with center of OTHER part
    if (Math.abs(p1 - q1) < bestDiff) { bestDiff = Math.abs(p1 - q1); bestPart = other; bestSpot = go.Spot.Center; bestOtherSpot = go.Spot.Center; }
 
    // compare top side with top and bottom sides of OTHER part
    if (Math.abs(p0-q0) < bestDiff) { bestDiff = Math.abs(p0-q0); bestPart = other; bestSpot = go.Spot.Top; bestOtherSpot = go.Spot.Top; }
    else if (Math.abs(p0-q2) < bestDiff) { bestDiff = Math.abs(p0-q2); bestPart = other; bestSpot = go.Spot.Top; bestOtherSpot = go.Spot.Bottom; }
 
    // compare bottom side with top and bottom sides of OTHER part
    if (Math.abs(p2-q0) < bestDiff) { bestDiff = Math.abs(p2-q0); bestPart = other; bestSpot = go.Spot.Bottom; bestOtherSpot = go.Spot.Top; }
    else if (Math.abs(p2-q2) < bestDiff) { bestDiff = Math.abs(p2-q2); bestPart = other; bestSpot = go.Spot.Bottom; bestOtherSpot = go.Spot.Bottom; }
  });
 
  if (bestPart !== null) {
    var bestBounds = bestPart.actualBounds;
    // line extends from x0 to x2
    var x0 = Math.min(partBounds.x, bestBounds.x) - 10;
    var x2 = Math.max(partBounds.x + partBounds.width, bestBounds.x + bestBounds.width) + 10;
    // find bestPart's desired Y
    var bestPoint = new go.Point().setRectSpot(bestBounds, bestOtherSpot);
    if (bestSpot === go.Spot.Center) {
      if (snap) {
        // call Part.move in order to automatically move member Parts of Groups
        part.move(new go.Point(partBounds.x, bestPoint.y - partBounds.height / 2));
        this.invalidateLinks(part);
      }
      if (guideline) {
        this.guidelineHcenter.position = new go.Point(x0, bestPoint.y);
        this.guidelineHcenter.elt(0).width = x2 - x0;
        this.diagram.add(this.guidelineHcenter);
      }
    } else if (bestSpot === go.Spot.Top) {
      if (snap) {
        part.move(new go.Point(partBounds.x, bestPoint.y));
        this.invalidateLinks(part);
      }
      if (guideline) {
        this.guidelineHtop.position = new go.Point(x0, bestPoint.y);
        this.guidelineHtop.elt(0).width = x2 - x0;
        this.diagram.add(this.guidelineHtop);
      }
    } else if (bestSpot === go.Spot.Bottom) {
      if (snap) {
        part.move(new go.Point(partBounds.x, bestPoint.y - partBounds.height));
        this.invalidateLinks(part);
      }
      if (guideline) {
        this.guidelineHbottom.position = new go.Point(x0, bestPoint.y);
        this.guidelineHbottom.elt(0).width = x2 - x0;
        this.diagram.add(this.guidelineHbottom);
      }
    }
  }
}
 
/**
* This finds parts that are aligned near the selected part along vertical lines. It compares the selected
* part to all parts within a rectangle approximately twice the {@link #searchDistance} tall.
* The guidelines appear when a part is aligned within a margin-of-error equal to {@link #guidelineSnapDistance}.
* The parameters used for {@link #guidelineSnap} are also set here.
* @this {GuidedDraggingTool}
* @param {Part} part
* @param {boolean} guideline if true, show guideline
* @param {boolean} snap if true, don't show guidelines but just snap the part to where the guideline would be
*/
GuidedDraggingTool.prototype.showVerticalMatches = function(part, guideline, snap) {
  var partBounds = part.actualBounds;
  var p0 = partBounds.x;
  var p1 = partBounds.x + partBounds.width/2;
  var p2 = partBounds.x + partBounds.width;
 
  var marginOfError = this.guidelineSnapDistance;
  var distance = this.searchDistance;
  // compares with parts within narrow vertical area
  var area = partBounds.copy();
  area.inflate(marginOfError + 1, distance);
  var otherParts = this.diagram.findObjectsIn(area,
      function(obj) { return obj.part; },
      function(part) { return part instanceof go.Part && !(part instanceof go.Link) && part.isTopLevel && !part.layer.isTemporary; },
      true);
 
  var bestDiff = marginOfError;
  var bestPart = null;
  var bestSpot;
  var bestOtherSpot;
  // vertical line -- comparing x-values
  otherParts.each(function(other) {
    if (other === part) return; // ignore itself
 
    var otherBounds = other.actualBounds;
    var q0 = otherBounds.x;
    var q1 = otherBounds.x + otherBounds.width/2;
    var q2 = otherBounds.x + otherBounds.width;
 
    // compare center with center of OTHER part
    if (Math.abs(p1 - q1) < bestDiff) { bestDiff = Math.abs(p1 - q1); bestPart = other; bestSpot = go.Spot.Center; bestOtherSpot = go.Spot.Center; }
 
    // compare left side with left and right sides of OTHER part
    if (Math.abs(p0-q0) < bestDiff) { bestDiff = Math.abs(p0-q0); bestPart = other; bestSpot = go.Spot.Left; bestOtherSpot = go.Spot.Left; }
    else if (Math.abs(p0-q2) < bestDiff) { bestDiff = Math.abs(p0-q2); bestPart = other; bestSpot = go.Spot.Left; bestOtherSpot = go.Spot.Right; }
 
    // compare right side with left and right sides of OTHER part
    if (Math.abs(p2-q0) < bestDiff) { bestDiff = Math.abs(p2-q0); bestPart = other; bestSpot = go.Spot.Right; bestOtherSpot = go.Spot.Left; }
    else if (Math.abs(p2-q2) < bestDiff) { bestDiff = Math.abs(p2-q2); bestPart = other; bestSpot = go.Spot.Right; bestOtherSpot = go.Spot.Right; }
  });
 
  if (bestPart !== null) {
    var bestBounds = bestPart.actualBounds;
    // line extends from y0 to y2
    var y0 = Math.min(partBounds.y, bestBounds.y) - 10;
    var y2 = Math.max(partBounds.y + partBounds.height, bestBounds.y + bestBounds.height) + 10;
    // find bestPart's desired X
    var bestPoint = new go.Point().setRectSpot(bestBounds, bestOtherSpot);
    if (bestSpot === go.Spot.Center) {
      if (snap) {
        // call Part.move in order to automatically move member Parts of Groups
        part.move(new go.Point(bestPoint.x - partBounds.width / 2, partBounds.y));
        this.invalidateLinks(part);
      }
      if (guideline) {
        this.guidelineVcenter.position = new go.Point(bestPoint.x, y0);
        this.guidelineVcenter.elt(0).height = y2 - y0;
        this.diagram.add(this.guidelineVcenter);
      }
    } else if (bestSpot === go.Spot.Left) {
      if (snap) {
        part.move(new go.Point(bestPoint.x, partBounds.y));
        this.invalidateLinks(part);
      }
      if (guideline) {
        this.guidelineVleft.position = new go.Point(bestPoint.x, y0);
        this.guidelineVleft.elt(0).height = y2 - y0;
        this.diagram.add(this.guidelineVleft);
      }
    } else if (bestSpot === go.Spot.Right) {
      if (snap) {
        part.move(new go.Point(bestPoint.x - partBounds.width, partBounds.y));
        this.invalidateLinks(part);
      }
      if (guideline) {
        this.guidelineVright.position = new go.Point(bestPoint.x, y0);
        this.guidelineVright.elt(0).height = y2 - y0;
        this.diagram.add(this.guidelineVright);
      }
    }
  }
}
 
/**
* Gets or sets the margin of error for which guidelines show up.
* The default value is 6.
* Guidelines will show up when the aligned nods are ± 6px away from perfect alignment.
* @name GuidedDraggingTool#guidelineSnapDistance
* @function.
* @return {number}
*/
Object.defineProperty(GuidedDraggingTool.prototype, "guidelineSnapDistance", {
    get: function() { return this._guidelineSnapDistance; },
    set: function(val) {
        if (typeof val !== "number" || isNaN(val) || val < 0) throw new Error("new value for GuidedDraggingTool.guidelineSnapDistance must be a non-negative number.");
        if (this._guidelineSnapDistance !== val) {
          this._guidelineSnapDistance = val;
        }
    }
});
 
/**
* Gets or sets whether the guidelines are enabled or disable.
* The default value is true.
* @name GuidedDraggingTool#isGuidelineEnabled
* @function.
* @return {boolean}
*/
Object.defineProperty(GuidedDraggingTool.prototype, "isGuidelineEnabled", {
    get: function() { return this._isGuidelineEnabled; },
    set: function(val) {
        if (typeof val !== "boolean") throw new Error("new value for GuidedDraggingTool.isGuidelineEnabled must be a boolean value.");
        if (this._isGuidelineEnabled !== val) {
          this._isGuidelineEnabled = val;
        }
    }
});
 
/**
* Gets or sets the color of horizontal guidelines.
* The default value is "gray".
* @name GuidedDraggingTool#horizontalGuidelineColor
* @function.
* @return {string}
*/
Object.defineProperty(GuidedDraggingTool.prototype, "horizontalGuidelineColor", {
    get: function() { return this._horizontalGuidelineColor; },
    set: function(val) {
        if (this._horizontalGuidelineColor !== val) {
          this._horizontalGuidelineColor = val;
          this.guidelineHbottom.elements.first().stroke = this._horizontalGuidelineColor;
          this.guidelineHtop.elements.first().stroke = this._horizontalGuidelineColor;
        }
    }
});
 
/**
* Gets or sets the color of vertical guidelines.
* The default value is "gray".
* @name GuidedDraggingTool#verticalGuidelineColor
* @function.
* @return {string}
*/
Object.defineProperty(GuidedDraggingTool.prototype, "verticalGuidelineColor", {
    get: function() { return this._verticalGuidelineColor; },
    set: function(val) {
        if (this._verticalGuidelineColor !== val) {
          this._verticalGuidelineColor = val;
          this.guidelineVleft.elements.first().stroke = this._verticalGuidelineColor;
          this.guidelineVright.elements.first().stroke = this._verticalGuidelineColor;
        }
    }
});
 
/**
* Gets or sets the color of center guidelines.
* The default value is "gray".
* @name GuidedDraggingTool#centerGuidelineColor
* @function.
* @return {string}
*/
Object.defineProperty(GuidedDraggingTool.prototype, "centerGuidelineColor", {
    get: function() { return this._centerGuidelineColor; },
    set: function(val) {
        if (this._centerGuidelineColor !== val) {
          this._centerGuidelineColor = val;
          this.guidelineVcenter.elements.first().stroke = this._centerGuidelineColor;
          this.guidelineHcenter.elements.first().stroke = this._centerGuidelineColor;
        }
    }
});
 
/**
* Gets or sets the width guidelines.
* The default value is 1.
* @name GuidedDraggingTool#guidelineWidth
* @function.
* @return {number}
*/
Object.defineProperty(GuidedDraggingTool.prototype, "guidelineWidth", {
    get: function() { return this._guidelineWidth; },
    set: function(val) {
        if (typeof val !== "number" || isNaN(val) || val < 0) throw new Error("New value for GuidedDraggingTool.guidelineWidth must be a non-negative number.");
        if (this._guidelineWidth !== val) {
          this._guidelineWidth = val;
          this.guidelineVcenter.elements.first().strokeWidth = val;
          this.guidelineHcenter.elements.first().strokeWidth = val;
          this.guidelineVleft.elements.first().strokeWidth = val;
          this.guidelineVright.elements.first().strokeWidth = val;
          this.guidelineHbottom.elements.first().strokeWidth = val;
          this.guidelineHtop.elements.first().strokeWidth = val;
        }
    }
});
/**
* Gets or sets the distance around the selected part to search for aligned parts.
* The default value is 1000.
* Set this to Infinity if you want to search the entire diagram no matter how far away.
* @name GuidedDraggingTool#searchDistance
* @function.
* @return {number}
*/
Object.defineProperty(GuidedDraggingTool.prototype, "searchDistance", {
    get: function() { return this._searchDistance; },
    set: function(val) {
        if (typeof val !== "number" || isNaN(val) || val <= 0) throw new Error("new value for GuidedDraggingTool.searchDistance must be a positive number.");
        if (this._searchDistance !== val) {
          this._searchDistance = val;
        }
    }
});
 
/**
* Gets or sets whether snapping to guidelines is enabled.
* The default value is true.
* @name GuidedDraggingTool#isGuidelineSnapEnabled
* @function.
* @return {Boolean}
*/
Object.defineProperty(GuidedDraggingTool.prototype, "isGuidelineSnapEnabled", {
    get: function() { return this._isGuidelineSnapEnabled; },
    set: function(val) {
        if (typeof val !== "boolean") throw new Error("new value for GuidedDraggingTool.isGuidelineSnapEnabled must be a boolean.");
        if (this._isGuidelineSnapEnabled !== val) {
          this._isGuidelineSnapEnabled = val;
        }
    }
});
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/HyperlinkText.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/HyperlinkText.js

Statements: 3.92% (2 / 51)      Branches: 0% (0 / 37)      Functions: 0% (0 / 10)      Lines: 4.88% (2 / 41)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125                                                                          2                                                                                                                 1                                                            
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A "HyperlinkText" is either a TextBlock or a Panel containing a TextBlock that when clicked
// opens a new browser window with a given or computed URL.
// When the user's mouse passes over a "HyperlinkText", the text is underlined.
// When the mouse hovers over a "HyperlinkText", it shows a tooltip that displays the URL.
 
// This "HyperlinkText" builder is not pre-defined in the GoJS library, so you will need to load this definition.
 
// Typical usages:
//    $("HyperlinkText", "https://gojs.net", "Visit GoJS")
//
//    $("HyperlinkText",
//        function(node) { return "https://gojs.net/" + node.data.version; },
//        function(node) { return "Visit GoJS version " + node.data.version; })
//
//    $("HyperlinkText",
//        function(node) { return "https://gojs.net/" + node.data.version; },
//        $(go.Panel, "Auto",
//            $(go.Shape, ...),
//            $(go.TextBlock, ...)
//        )
//    )
 
// The first argument to the "HyperlinkText" builder should be either the URL string or a function
// that takes the data-bound Panel and returns the URL string.
 
// The second argument to the "HyperlinkText" builder may be either a string to display in a TextBlock,
// or a function that takes the data-bound Panel and returns the string to display in a TextBlock.
// If no text string or function is provided, it assumes all of the arguments are used to
// define the visual tree for the "HyperlinkText", in the normal fashion for a Panel.
 
// The result is either a TextBlock or a Panel.
 
go.GraphObject.defineBuilder("HyperlinkText", function(args) {
  // the URL is required as the first argument, either a string or a side-effect-free function returning a string
  var url = go.GraphObject.takeBuilderArgument(args, undefined, function(x) { return typeof x === "string" || typeof x === "function"; });
  // the text for the HyperlinkText is the optional second argument, either a string or a side-effect-free function returning a string
  var text = go.GraphObject.takeBuilderArgument(args, null, function(x) { return typeof x === "string" || typeof x === "function"; });
 
  // see if the visual tree is supplied in the arguments to the "HyperlinkText"
  var anyGraphObjects = false;
  for (var i = 0; i < args.length; i++) {
    var a = args[i];
    if (a && a instanceof go.GraphObject) anyGraphObjects = true;
  }
 
  // define the click behavior
  var click =
    function(e, obj) {
      var url = obj._url;
      if (typeof url === "function") url = url(obj.findTemplateBinder());
      window.open(url, "_blank");
    };
 
  // define the tooltip
  var tooltip =
    go.GraphObject.make(go.Adornment, "Auto",
      go.GraphObject.make(go.Shape, { fill: "#EFEFCC" }),
      go.GraphObject.make(go.TextBlock, { margin: 4 },
        new go.Binding("text", "", function(obj) {
          // here OBJ will be in the Adornment, need to get the HyperlinkText/TextBlock
          obj = obj.part.adornedObject;
          var url = obj._url;
          if (typeof url === "function") url = url(obj.findTemplateBinder());
          return url;
        }).ofObject())
    );
 
  // if the text is provided, use a new TextBlock; otherwise assume the TextBlock is provided
  if (typeof (text) === "string" || typeof (text) === "function" || !anyGraphObjects) {
    if (text === null && typeof (url) === "string") text = url;
    var tb = go.GraphObject.make(go.TextBlock,
                {
                  "_url": url,
                  cursor: "pointer",
                  mouseEnter: function(e, obj) { obj.isUnderline = true; },
                  mouseLeave: function(e, obj) { obj.isUnderline = false; },
                  click: click,  // defined above
                  toolTip: tooltip // shared by all HyperlinkText textblocks
                }
              );
    if (typeof(text) === "string") {
      tb.text = text;
    } else if (typeof(text) === "function") {
      tb.bind(new go.Binding("text", "", text).ofObject())
    } else if (typeof (url) === "function") {
      tb.bind(new go.Binding("text", "", url).ofObject())
    }
    return tb;
  } else {
    function findTextBlock(obj) {
      if (obj instanceof go.TextBlock) return obj;
      if (obj instanceof go.Panel) {
        var it = obj.elements;
        while (it.next()) {
          var result = findTextBlock(it.value);
          if (result !== null) return result;
        }
      }
      return null;
    }
    return go.GraphObject.make(go.Panel,
      {
        "_url": url,
        cursor: "pointer",
        mouseEnter: function(e, panel) {
          var tb = findTextBlock(panel);
          if (tb !== null) tb.isUnderline = true;
        },
        mouseLeave: function(e, panel) {
          var tb = findTextBlock(panel);
          if (tb !== null) tb.isUnderline = false;
        },
        click: click,  // defined above
        toolTip: tooltip  // shared by all HyperlinkText panels
      }
    );
  }
});
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/LightBoxContextMenu.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/LightBoxContextMenu.js

Statements: 3.7% (3 / 81)      Branches: 0% (0 / 8)      Functions: 0% (0 / 34)      Lines: 4.23% (3 / 71)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137        2                                                                                                                                                                   1                                                                                       1            
// HTML + JavaScript context menu, made with HTMLInfo
// This file exposes one instance of HTMLInfo, window.myHTMLLightBox
// see also LightBoxContextMenu.css and /samples/htmlLightBoxContextMenu.html
"use strict";
(function(window) {
  /* HTML for context menu:
  <div id="contextMenuDIV">
    <div id="cmLight"></div>
    <div id="cmDark"></div>
  </div>
  */
 
  var contextMenuDIV = document.createElement("div");
  contextMenuDIV.id = "contextMenuDIV";
  // This is the actual HTML LightBox-style context menu, composed of buttons and a background:
  var cmLight = document.createElement("div");
  cmLight.id = "cmLight";
  var cmDark = document.createElement("div");
  cmDark.id = "cmDark";
  contextMenuDIV.appendChild(cmLight);
  contextMenuDIV.appendChild(cmDark);
 
  var cxMenuButtons = [
    {
      text: 'Copy',
      command: function(diagram) { diagram.commandHandler.copySelection(); },
      isVisible: function(diagram) { return diagram.commandHandler.canCopySelection(); }
    }, {
      text: 'Cut',
      command: function(diagram) { diagram.commandHandler.cutSelection(); },
      isVisible: function(diagram) { return diagram.commandHandler.canCutSelection(); }
    }, {
      text: 'Delete',
      command: function(diagram) { diagram.commandHandler.deleteSelection(); },
      isVisible: function(diagram) { return diagram.commandHandler.canDeleteSelection(); }
    }, {
      text: 'Paste',
      command: function(diagram) { diagram.commandHandler.pasteSelection(diagram.lastInput.documentPoint); },
      isVisible: function(diagram) { return diagram.commandHandler.canPasteSelection(); }
    }, {
      text: 'Select All',
      command: function(diagram) { diagram.commandHandler.selectAll(); },
      isVisible: function(diagram) { return diagram.commandHandler.canSelectAll(); }
    }, {
      text: 'Undo',
      command: function(diagram) { diagram.commandHandler.undo(); },
      isVisible: function(diagram) { return diagram.commandHandler.canUndo(); }
    }, {
      text: 'Redo',
      command: function(diagram) { diagram.commandHandler.redo(); },
      isVisible: function(diagram) { return diagram.commandHandler.canRedo(); }
    }, {
      text: 'Scroll To Part',
      command: function(diagram) { diagram.commandHandler.scrollToPart(); },
      isVisible: function(diagram) { return diagram.commandHandler.canScrollToPart(); }
    }, {
      text: 'Zoom To Fit',
      command: function(diagram) { diagram.commandHandler.zoomToFit(); },
      isVisible: function(diagram) { return diagram.commandHandler.canZoomToFit(); }
    }, {
      text: 'Reset Zoom',
      command: function(diagram) { diagram.commandHandler.resetZoom(); },
      isVisible: function(diagram) { return diagram.commandHandler.canResetZoom(); }
    }, {
      text: 'Group Selection',
      command: function(diagram) { diagram.commandHandler.groupSelection(); },
      isVisible: function(diagram) { return diagram.commandHandler.canGroupSelection(); }
    }, {
      text: 'Ungroup Selection',
      command: function(diagram) { diagram.commandHandler.ungroupSelection(); },
      isVisible: function(diagram) { return diagram.commandHandler.canUngroupSelection(); }
    }, {
      text: 'Edit Text',
      command: function(diagram) { diagram.commandHandler.editTextBlock(); },
      isVisible: function(diagram) { return diagram.commandHandler.canEditTextBlock(); }
    }
  ];
 
  var $ = go.GraphObject.make;
  var myContextMenu = $(go.HTMLInfo, {
    show: showContextMenu,
    hide: hideContextMenu
  });
 
  var firstTime = true;
 
  function showContextMenu(obj, diagram, tool) {
    if (firstTime) {
      // We don't want the div acting as a context menu to have a (browser) context menu!
      cmLight.addEventListener('contextmenu', function(e) { e.preventDefault(); return false; }, false);
      cmLight.addEventListener('selectstart', function(e) { e.preventDefault(); return false; }, false);
      contextMenuDIV.addEventListener('contextmenu', function(e) { e.preventDefault(); return false; }, false);
      // Stop the context menu tool if you click on the dark part:
      contextMenuDIV.addEventListener('click', function(e) { diagram.currentTool.stopTool(); return false; }, false);
      firstTime = false;
    }
 
    // Empty the context menu and only show buttons that are relevant
    cmLight.innerHTML = '';
 
    var ul = document.createElement('ul');
    cmLight.appendChild(ul);
 
    for (var i = 0; i < cxMenuButtons.length; i++) {
      var button = cxMenuButtons[i];
      var command = button.command;
      var isVisible = button.isVisible;
 
      if (!(typeof command === 'function')) continue;
      // Only show buttons that have isVisible = true
      if (typeof isVisible === 'function' && !isVisible(diagram)) continue;
      var li = document.createElement('li');
      var ahref = document.createElement('a');
      ahref.href = '#';
      ahref._command = button.command;
      ahref.addEventListener('click', function(e) {
        this._command(diagram);
        tool.stopTool();
        e.preventDefault();
        return false;
      }, false);
      ahref.textContent = button.text;
      li.appendChild(ahref);
      ul.appendChild(li);
    }
 
    // show the whole LightBox context menu
    document.body.appendChild(contextMenuDIV);
  };
 
  function hideContextMenu(diagram, tool) {
    document.body.removeChild(contextMenuDIV);
  }
 
  window.myHTMLLightBox = myContextMenu;
})(window);
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/LinkLabelDraggingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/LinkLabelDraggingTool.js

Statements: 2.38% (2 / 84)      Branches: 0% (0 / 40)      Functions: 0% (0 / 10)      Lines: 2.7% (2 / 74)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173                              1                     2                                                                                                                                                                                                                                                                                                    
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom Tool for moving a label on a Link
 
/**
* @constructor
* @extends Tool
* @class
* This tool only works when the Link has a label
* that is positioned at the Link.midPoint plus some offset.
* It does not work for labels that have a particular segmentIndex.
*/
function LinkLabelDraggingTool() {
  go.Tool.call(this);
  this.name = "LinkLabelDragging";
 
  /** @type {GraphObject} */
  this.label = null;
  /** @type {Point} */
  this._offset = new go.Point();  // of the mouse relative to the center of the label object
  /** @type {Point} */
  this._originalOffset = null;
}
go.Diagram.inherit(LinkLabelDraggingTool, go.Tool);
 
/**
* This tool can only start if the mouse has moved enough so that it is not a click,
* and if the mouse down point is on a GraphObject "label" in a Link Panel,
* as determined by findLabel().
* @this {LinkLabelDraggingTool}
* @return {boolean}
*/
LinkLabelDraggingTool.prototype.canStart = function() {
  if (!go.Tool.prototype.canStart.call(this)) return false;
  var diagram = this.diagram;
  if (diagram === null) return false;
  // require left button & that it has moved far enough away from the mouse down point, so it isn't a click
  var e = diagram.lastInput;
  if (!e.left) return false;
  if (!this.isBeyondDragSize()) return false;
 
  return this.findLabel() !== null;
}
 
/**
* From the GraphObject at the mouse point, search up the visual tree until we get to
* an object that is a label of a Link.
* @this {LinkLabelDraggingTool}
* @return {GraphObject} This returns null if no such label is at the mouse down point.
*/
LinkLabelDraggingTool.prototype.findLabel = function() {
  var diagram = this.diagram;
  var e = diagram.lastInput;
  var elt = diagram.findObjectAt(e.documentPoint, null, null);
 
  if (elt === null || !(elt.part instanceof go.Link)) return null;
  while (elt.panel !== elt.part) {
    elt = elt.panel;
  }
  // If it's at an arrowhead segment index, don't consider it a label:
  if (elt.segmentIndex === 0 || elt.segmentIndex === -1) return null;
  return elt;
};
 
/**
* Start a transaction, call findLabel and remember it as the "label" property,
* and remember the original value for the label's segmentOffset property.
* @this {LinkLabelDraggingTool}
*/
LinkLabelDraggingTool.prototype.doActivate = function() {
  this.startTransaction("Shifted Label");
  this.label = this.findLabel();
  if (this.label !== null) {
    // compute the offset of the mouse-down point relative to the center of the label
    this._offset = this.diagram.firstInput.documentPoint.copy().subtract(this.label.getDocumentPoint(go.Spot.Center));
    this._originalOffset = this.label.segmentOffset.copy();
  }
  go.Tool.prototype.doActivate.call(this);
}
 
/**
* Stop any ongoing transaction.
* @this {LinkLabelDraggingTool}
*/
LinkLabelDraggingTool.prototype.doDeactivate = function() {
  go.Tool.prototype.doDeactivate.call(this);
  this.stopTransaction();
}
 
/**
* Clear any reference to a label element.
* @this {LinkLabelDraggingTool}
*/
LinkLabelDraggingTool.prototype.doStop = function() {
  this.label = null;
  go.Tool.prototype.doStop.call(this);
}
 
/**
* Restore the label's original value for GraphObject.segmentOffset.
* @this {LinkLabelDraggingTool}
*/
LinkLabelDraggingTool.prototype.doCancel = function() {
  if (this.label !== null) {
    this.label.segmentOffset =  this._originalOffset;
  }
  go.Tool.prototype.doCancel.call(this);
}
 
/**
* During the drag, call updateSegmentOffset in order to set
* the GraphObject.segmentOffset of the label.
* @this {LinkLabelDraggingTool}
*/
LinkLabelDraggingTool.prototype.doMouseMove = function() {
  if (!this.isActive) return;
  this.updateSegmentOffset();
}
 
/**
* At the end of the drag, update the segment offset of the label and finish the tool,
* completing a transaction.
* @this {LinkLabelDraggingTool}
*/
LinkLabelDraggingTool.prototype.doMouseUp = function() {
  if (!this.isActive) return;
  this.updateSegmentOffset();
  this.transactionResult = "Shifted Label";
  this.stopTool();
}
 
/**
* Save the label's GraphObject.segmentOffset as a rotated offset from the midpoint of the
* Link that the label is in.
* @this {LinkLabelDraggingTool}
*/
LinkLabelDraggingTool.prototype.updateSegmentOffset = function() {
  var lab = this.label;
  if (lab === null) return;
  var link = lab.part;
  if (!(link instanceof go.Link)) return;
  var last = this.diagram.lastInput.documentPoint;
  var idx = lab.segmentIndex;
  var numpts = link.pointsCount;
  // if the label is a "mid" label, assume it is positioned differently from a label at a particular segment
  if (idx < -numpts || idx >= numpts) {
    var mid = link.midPoint;
    // need to rotate this point to account for the angle of the link segment at the mid-point
    var p = new go.Point(last.x - this._offset.x - mid.x, last.y - this._offset.y - mid.y);
    lab.segmentOffset = p.rotate(-link.midAngle);
  } else {  // handle the label point being on a partiular segment with a given fraction
    var frac = lab.segmentFraction;
    var a, b;
    if (idx >= 0) {  // indexing forwards
      a = link.getPoint(idx);
      b = (idx < numpts - 1) ? link.getPoint(idx + 1) : a;
    } else {  // or backwards if segmentIndex is negative
      var i = numpts + idx;
      a = link.getPoint(i);
      b = (i > 0) ? link.getPoint(i - 1) : a;
    }
    var labx = a.x + (b.x - a.x) * frac;
    var laby = a.y + (b.y - a.y) * frac;
    var p = new go.Point(last.x - this._offset.x - labx, last.y - this._offset.y - laby);
    var segangle = (idx >= 0) ? a.directionPoint(b) : b.directionPoint(a);
    lab.segmentOffset = p.rotate(-segangle);
  }
}
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/LinkShiftingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/LinkShiftingTool.js

Statements: 1.18% (2 / 169)      Branches: 0% (0 / 105)      Functions: 0% (0 / 11)      Lines: 1.27% (2 / 157)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285                              1                                                                       2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
"use strict"
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom Tool for shifting the end point of a Link to be anywhere along the edges of the port.
 
/**
* This constructor produces a tool for shifting the end of a link;
* use it in a diagram.toolManager.mouseDownTools list:
* <pre>myDiagram.toolManager.mouseDownTools.add(new LinkShiftingTool());</pre>
* @constructor
* @extends Tool
* @class
*/
function LinkShiftingTool() {
  go.Tool.call(this);
  this.name = "LinkShifting";
 
  // these are archetypes for the two shift handles, one at each end of the Link:
  var h = new go.Shape();
  h.geometryString = "F1 M0 0 L8 0 M8 4 L0 4";
  h.fill = null;
  h.stroke = "dodgerblue";
  h.background = "lightblue";
  h.cursor = "pointer";
  h.segmentIndex = 0;
  h.segmentFraction = 1;
  h.segmentOrientation = go.Link.OrientAlong;
 
  /** @type {GraphObject} */
  this._fromHandleArchetype = h;
 
  h = new go.Shape();
  h.geometryString = "F1 M0 0 L8 0 M8 4 L0 4";
  h.fill = null;
  h.stroke = "dodgerblue";
  h.background = "lightblue";
  h.cursor = "pointer";
  h.segmentIndex = -1;
  h.segmentFraction = 1;
  h.segmentOrientation = go.Link.OrientAlong;
  /** @type {GraphObject} */
  this._toHandleArchetype = h;
 
  // transient state
  /** @type {GraphObject} */
  this._handle = null;
  /** @type {List} */
  this._originalPoints = null;
}
go.Diagram.inherit(LinkShiftingTool, go.Tool);
 
/**
* @this {LinkShiftingTool}
* @param {Part} part
*/
LinkShiftingTool.prototype.updateAdornments = function(part) {
  if (part === null || !(part instanceof go.Link)) return;  // this tool only applies to Links
  var link = part;
  // show handles if link is selected, remove them if no longer selected
  var category = "LinkShiftingFrom";
  var adornment = null;
  if (link.isSelected && !this.diagram.isReadOnly) {
    var selelt = link.selectionObject;
    if (selelt !== null && link.actualBounds.isReal() && link.isVisible() &&
        selelt.actualBounds.isReal() && selelt.isVisibleObject()) {
      var spot = link.computeSpot(true);
      if (spot.isSide() || spot.isSpot()) {
        adornment = link.findAdornment(category);
        if (adornment === null) {
          adornment = this.makeAdornment(selelt, false);
          adornment.category = category;
          link.addAdornment(category, adornment);
        }
      }
    }
  }
  if (adornment === null) link.removeAdornment(category);
 
  category = "LinkShiftingTo";
  adornment = null;
  if (link.isSelected && !this.diagram.isReadOnly) {
    var selelt = link.selectionObject;
    if (selelt !== null && link.actualBounds.isReal() && link.isVisible() &&
        selelt.actualBounds.isReal() && selelt.isVisibleObject()) {
      var spot = link.computeSpot(false);
      if (spot.isSide() || spot.isSpot()) {
        adornment = link.findAdornment(category);
        if (adornment === null) {
          adornment = this.makeAdornment(selelt, true);
          adornment.category = category;
          link.addAdornment(category, adornment);
        }
      }
    }
  }
  if (adornment === null) link.removeAdornment(category);
};
 
/**
* @this {LinkShiftingTool}
* @param {GraphObject} selelt the {@link GraphObject} of the {@link Link} being shifted.
* @param {boolean} toend
* @return {Adornment}
*/
LinkShiftingTool.prototype.makeAdornment = function(selelt, toend) {
  var adornment = new go.Adornment();
  adornment.type = go.Panel.Link;
  var h = (toend ? this._toHandleArchetype : this._fromHandleArchetype);
  if (h !== null) {
    // add a single handle for shifting at one end
    adornment.add(h.copy());
  }
  adornment.adornedObject = selelt;
  return adornment;
};
 
/**
* @this {LinkShiftingTool}
* @return {boolean}
*/
LinkShiftingTool.prototype.canStart = function() {
  if (!this.isEnabled) return false;
  var diagram = this.diagram;
  if (diagram === null || diagram.isReadOnly || diagram.isModelReadOnly) return false;
  if (!diagram.lastInput.left) return false;
  var h = this.findToolHandleAt(diagram.firstInput.documentPoint, "LinkShiftingFrom");
  if (h === null) h = this.findToolHandleAt(diagram.firstInput.documentPoint, "LinkShiftingTo");
  return (h !== null);
}
 
/**
* @this {LinkShiftingTool}
*/
LinkShiftingTool.prototype.doActivate = function() {
  var diagram = this.diagram;
  if (diagram === null) return;
  var h = this.findToolHandleAt(diagram.firstInput.documentPoint, "LinkShiftingFrom");
  if (h === null) h = this.findToolHandleAt(diagram.firstInput.documentPoint, "LinkShiftingTo");
  if (h === null) return;
  var ad = h.part;
  var link = ad.adornedObject.part;
  if (!(link instanceof go.Link)) return;
 
  this._handle = h;
  this._originalPoints = link.points.copy();
  this.startTransaction(this.name);
  diagram.isMouseCaptured = true;
  diagram.currentCursor = 'pointer';
  this.isActive = true;
};
 
/**
* @this {LinkShiftingTool}
*/
LinkShiftingTool.prototype.doDeactivate = function() {
  this.isActive = false;
  var diagram = this.diagram;
  if (diagram === null) return;
 
  diagram.isMouseCaptured = false;
  diagram.currentCursor = '';
  this.stopTransaction();
};
 
/**
* Clean up tool state.
* @this {LinkShiftingTool}
*/
LinkShiftingTool.prototype.doStop = function() {
  this._handle = null;
  this._originalPoints = null;
};
 
/**
* Clean up tool state.
* @this {LinkShiftingTool}
*/
LinkShiftingTool.prototype.doCancel = function() {
  var ad = this._handle.part;
  var link = ad.adornedObject.part;
  link.points = this._originalPoints;
  this.stopTool();
};
 
/**
* @this {LinkShiftingTool}
*/
LinkShiftingTool.prototype.doMouseMove = function() {
  if (this.isActive) {
    this.doReshape(this.diagram.lastInput.documentPoint);
  }
};
 
/**
* @this {LinkShiftingTool}
*/
LinkShiftingTool.prototype.doMouseUp = function() {
  if (this.isActive) {
    this.doReshape(this.diagram.lastInput.documentPoint);
    this.transactionResult = this.name;
  }
  this.stopTool();
};
 
/**
* @this {LinkShiftingTool}
* @param {Point} pt
*/
LinkShiftingTool.prototype.doReshape = function(pt) {
  var ad = this._handle.part;
  var link = ad.adornedObject.part;
  var fromend = ad.category === "LinkShiftingFrom";
  var port = null;
  if (fromend) {
    port = link.fromPort;
  } else {
    port = link.toPort;
  }
  var portb = new go.Rect(port.getDocumentPoint(go.Spot.TopLeft),
                          port.getDocumentPoint(go.Spot.BottomRight));
  // determine new connection point based on closest point to bounds of port property
  var x = portb.width > 0 ? (pt.x - portb.x) / portb.width : 0;
  var y = portb.height > 0 ? (pt.y - portb.y) / portb.height : 0;
 
  var sx = undefined;
  var sy = undefined;
 
  if (x <= 0) {
    sx = 0;
    if (y <= 0) {
      sy = 0;
    } else if (y >= 1) {
      sy = 1;
    } else {
      sy = y;
    }
  } else if (x >= 1) {
    sx = 1;
    if (y <= 0) {
      sy = 0;
    } else if (y >= 1) {
      sy = 1;
    } else {
      sy = y;
    }
  } else {
    if (y <= 0) {
      sx = x;
      sy = 0;
    } else if (y >= 1) {
      sx = x;
      sy = 1;
    } else {  // in the middle
      if (x > y) {
        if (x > 1 - y) {
          sx = 1;  // right side
          sy = y;
        } else {
          sx = x;
          sy = 0;  // top side
        }
      } else {  // y <= x
        if (x > 1 - y) {
          sx = x;
          sy = 1;  // bottom side
        } else {
          sx = 0;  // left side
          sy = y;
        }
      }
    }
  }
 
  if (sx !== undefined && sy !== undefined) {
    if (fromend) {
      link.fromSpot = new go.Spot(sx, sy);
    } else {
      link.toSpot = new go.Spot(sx, sy);
    }
  }
};
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/LocalStorageCommandHandler.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/LocalStorageCommandHandler.js

Statements: 4.44% (2 / 45)      Branches: 0% (0 / 22)      Functions: 0% (0 / 4)      Lines: 4.88% (2 / 41)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114                                                            1         2                                                                                                                                                            
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
/**
* @constructor
* @extends CommandHandler
* @class 
* This CommandHandler class uses localStorage as the repository for the clipboard,
* rather than an in-memory global variable.
* It requires that the {@link Diagram#model} be serializable and deserializable using {@link Model#toJson} and {@link Model.fromJson}.
* <p>
* The {@link #copyToClipboard} and {@link #pasteFromClipboard} functions fall back to using the standard definitions
* if there are any errors calling <code>Storage.getItem</code> or <code>Storage.setItem</code>.
* <p>
* Typical usage:
* <pre>
*   $(go.Diagram, "myDiagramDiv",
*     {
*       commandHandler: $(LocalStorageCommandHandler),
*       . . .
*     }
*   )
* </pre>
* or:
* <pre>
*    myDiagram.commandHandler = new LocalStorageCommandHandler();
* </pre>
*/
function LocalStorageCommandHandler() {
  go.CommandHandler.call(this);
  this.StorageKey = "go._clipboard";
  this.FormatKey = "go._clipboardFormat";
}
go.Diagram.inherit(LocalStorageCommandHandler, go.CommandHandler);
 
/**
* @override
* @this {LocalStorageCommandHandler}
* @param {Iterable.<Part>} coll a collection of {@link Part}s.
*/
LocalStorageCommandHandler.prototype.copyToClipboard = function(coll) {
  try {
    if (coll === null) {
      window.localStorage.setItem(this.StorageKey, "");
      window.localStorage.setItem(this.FormatKey, "");
    } else {
      var clipdiag = new go.Diagram();  // create a temporary Diagram
      // copy from this diagram to the temporary diagram some properties that affects copying:
      clipdiag.isTreePathToChildren = this.diagram.isTreePathToChildren;
      clipdiag.toolManager.draggingTool.dragsLink = this.diagram.toolManager.draggingTool.dragsLink;
      // create a model like this one but with no data
      clipdiag.model = this.diagram.model.copy();
      // copy the given Parts into this temporary Diagram
      this.diagram.copyParts(coll, clipdiag, false);
 
      window.localStorage.setItem(this.StorageKey, clipdiag.model.toJson());
      window.localStorage.setItem(this.FormatKey, clipdiag.model.dataFormat);
    }
  } catch (ex) {
    // fallback implementation
    go.CommandHandler.prototype.copyToClipboard.call(this, coll);
  }
};
 
/**
* @override
* @this {LocalStorageCommandHandler}
* @return {Set.<Part>} a collection of newly pasted {@link Part}s
*/
LocalStorageCommandHandler.prototype.pasteFromClipboard = function() {
  var coll = new go.Set(go.Part);
  try {
    var clipstr = window.localStorage.getItem(this.StorageKey);
    var clipfrmt = window.localStorage.getItem(this.FormatKey);
    if (clipstr === null || clipstr === "" || clipfrmt !== this.diagram.model.dataFormat) {
      return coll;
    } else {
      var clipdiag = new go.Diagram();  // create a temporary Diagram
      // recover the model from the clipboard rendering
      clipdiag.model = go.Model.fromJson(clipstr);
      // copy all the CLIPDIAG Parts into this Diagram
      var copymap = this.diagram.copyParts(clipdiag.parts.concat(clipdiag.nodes).concat(clipdiag.links), this.diagram, false);
      // return a Set of the copied Parts
      return new go.Set(go.Part).addAll(copymap.iteratorValues);
    }
  } catch (ex) {
    // fallback implementation
    return go.CommandHandler.prototype.pasteFromClipboard.call(this);
  }
};
 
/**
* @override
* @this {LocalStorageCommandHandler}
* @return {boolean}
*/
LocalStorageCommandHandler.prototype.canPasteSelection = function() {
  var diagram = this.diagram;
  if (diagram === null || diagram.isReadOnly || diagram.isModelReadOnly) return false;
  if (!diagram.allowInsert || !diagram.allowClipboard) return false;
  try {
    var clipstr = window.localStorage.getItem(this.StorageKey);
    var clipfrmt = window.localStorage.getItem(this.FormatKey);
    if (clipstr === null || clipstr === "") return false;
    if (clipfrmt !== diagram.model.dataFormat) return false;
    return true;
  } catch (ex) {
    // fallback implementation
    return go.CommandHandler.prototype.canPasteSelection();
  }
};
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/NodeLabelDraggingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/NodeLabelDraggingTool.js

Statements: 3.03% (2 / 66)      Branches: 0% (0 / 27)      Functions: 0% (0 / 10)      Lines: 3.51% (2 / 57)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151                                1                         2                                                                                                                                                                                                                                                  
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom Tool for moving a label on a Node
 
/**
* @constructor
* @extends Tool
* @class
* This tool only works when the Node has a label (any GraphObject) marked with
* { _isNodeLabel: true } that is positioned in a Spot Panel.
* It works by modifying that label's GraphObject.alignment property to have an
* offset from the center of the panel.
*/
function NodeLabelDraggingTool() {
  go.Tool.call(this);
  this.name = "NodeLabelDragging";
 
  /** @type {GraphObject} */
  this.label = null;
  /** @type {Point} */
  this._offset = new go.Point();  // of the mouse relative to the center of the label object
  /** @type {Point} */
  this._originalAlignment = null;
  /** @type {Point} */
  this._originalCenter = null;
}
go.Diagram.inherit(NodeLabelDraggingTool, go.Tool);
 
/**
* This tool can only start if the mouse has moved enough so that it is not a click,
* and if the mouse down point is on a GraphObject "label" in a Spot Panel,
* as determined by findLabel().
* @this {NodeLabelDraggingTool}
* @return {boolean}
*/
NodeLabelDraggingTool.prototype.canStart = function() {
  if (!go.Tool.prototype.canStart.call(this)) return false;
  var diagram = this.diagram;
  if (diagram === null) return false;
  // require left button & that it has moved far enough away from the mouse down point, so it isn't a click
  var e = diagram.lastInput;
  if (!e.left) return false;
  if (!this.isBeyondDragSize()) return false;
 
  return this.findLabel() !== null;
}
 
/**
* From the GraphObject at the mouse point, search up the visual tree until we get to
* an object that has the "_isNodeLabel" property set to true, that is in a Spot Panel,
* and that is not the first element of that Panel (i.e. not the main element of the panel).
* @this {NodeLabelDraggingTool}
* @return {GraphObject} This returns null if no such label is at the mouse down point.
*/
NodeLabelDraggingTool.prototype.findLabel = function() {
  var diagram = this.diagram;
  var e = diagram.firstInput;
  var elt = diagram.findObjectAt(e.documentPoint, null, null);
 
  if (elt === null || !(elt.part instanceof go.Node)) return null;
  while (elt.panel !== null) {
    if (elt._isNodeLabel && elt.panel.type === go.Panel.Spot && elt.panel.findMainElement() !== elt) return elt;
    elt = elt.panel;
  }
  return null;
};
 
/**
* Start a transaction, call findLabel and remember it as the "label" property,
* and remember the original value for the label's alignment property.
* @this {NodeLabelDraggingTool}
*/
NodeLabelDraggingTool.prototype.doActivate = function() {
  this.startTransaction("Shifted Label");
  this.label = this.findLabel();
  if (this.label !== null) {
    // compute the offset of the mouse-down point relative to the center of the label
    this._offset = this.diagram.firstInput.documentPoint.copy().subtract(this.label.getDocumentPoint(go.Spot.Center));
    this._originalAlignment = this.label.alignment.copy();
    var main = this.label.panel.findMainElement();
    this._originalCenter = main.getDocumentPoint(go.Spot.Center);
  }
  go.Tool.prototype.doActivate.call(this);
}
 
/**
* Stop any ongoing transaction.
* @this {NodeLabelDraggingTool}
*/
NodeLabelDraggingTool.prototype.doDeactivate = function() {
  go.Tool.prototype.doDeactivate.call(this);
  this.stopTransaction();
}
 
/**
* Clear any reference to a label element.
* @this {NodeLabelDraggingTool}
*/
NodeLabelDraggingTool.prototype.doStop = function() {
  this.label = null;
  go.Tool.prototype.doStop.call(this);
}
 
/**
* Restore the label's original value for GraphObject.alignment.
* @this {NodeLabelDraggingTool}
*/
NodeLabelDraggingTool.prototype.doCancel = function() {
  if (this.label !== null) {
    this.label.alignment = this._originalAlignment;
  }
  go.Tool.prototype.doCancel.call(this);
}
 
/**
* During the drag, call updateAlignment in order to set the GraphObject.alignment of the label.
* @this {NodeLabelDraggingTool}
*/
NodeLabelDraggingTool.prototype.doMouseMove = function() {
  if (!this.isActive) return;
  this.updateAlignment();
}
 
/**
* At the end of the drag, update the alignment of the label and finish the tool,
* completing a transaction.
* @this {NodeLabelDraggingTool}
*/
NodeLabelDraggingTool.prototype.doMouseUp = function() {
  if (!this.isActive) return;
  this.updateAlignment();
  this.transactionResult = "Shifted Label";
  this.stopTool();
}
 
/**
* Save the label's GraphObject.alignment as an absolute offset from the center of the Spot Panel
* that the label is in.
* @this {NodeLabelDraggingTool}
*/
NodeLabelDraggingTool.prototype.updateAlignment = function() {
  if (this.label === null) return;
  var last = this.diagram.lastInput.documentPoint;
  var cntr = this._originalCenter;
  this.label.alignment = new go.Spot(0.5, 0.5, last.x - this._offset.x - cntr.x, last.y - this._offset.y - cntr.y);
}
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/OrthogonalLinkReshapingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/OrthogonalLinkReshapingTool.js

Statements: 2.47% (2 / 81)      Branches: 0% (0 / 40)      Functions: 0% (0 / 6)      Lines: 2.47% (2 / 81)      Ignored: none     

All files » node-npmtest-gojs/node_modules/gojs/extensions/ » OrthogonalLinkReshapingTool.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170                            1       2                                                                                                                                                                                                                                                                                                              
"use strict"
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom Tool for dragging a segment of an orthogonal link.
 
/**
* This OrthogonalLinkReshapingTool class allows for a Link's path to be modified by the user
* via the dragging of a tool handle along the link segment, which will move the whole segment.
* @constructor
* @extends LinkReshapingTool
* @class
*/
function OrthogonalLinkReshapingTool() {
  go.LinkReshapingTool.call(this);
  this.name = "OrthogonalLinkReshaping";
}
go.Diagram.inherit(OrthogonalLinkReshapingTool, go.LinkReshapingTool);
 
/**
* For orthogonal, straight links, create the handles and set reshaping behavior.
* @override
* @param {Shape} pathshape
* @return {Adornment}
* @this {OrthogonalLinkReshapingTool}
*/
OrthogonalLinkReshapingTool.prototype.makeAdornment = function(pathshape) {
  var link = pathshape.part;
 
  // add all normal handles first
  var adornment = go.LinkReshapingTool.prototype.makeAdornment.call(this, pathshape);
 
  // add long reshaping handles for orthogonal, straight links
  if (link !== null && link.isOrthogonal && link.curve !== go.Link.Bezier) {
    var firstindex = link.firstPickIndex;
    var lastindex = link.lastPickIndex;
    for (var i = firstindex + 1; i < lastindex - 1; i++) {
      this.makeSegmentDragHandle(link, adornment, i);
    }
  }
  return adornment;
};
 
/**
* Once we finish a reshape, make sure any handles are properly updated.
* @override
* @this {OrthogonalLinkReshapingTool}
*/
OrthogonalLinkReshapingTool.prototype.doDeactivate = function() {
  // when we finish, recreate adornment to ensure proper reshaping behavior/cursor
  var link = this.adornedLink;
  if (link !== null && link.isOrthogonal && link.curve !== go.Link.Bezier) {
    var pathshape = link.path;
    var adornment = this.makeAdornment(pathshape);
    if (adornment !== null) {
      link.addAdornment(this.name, adornment);
      adornment.location = link.position;
    }
  }
  go.LinkReshapingTool.prototype.doDeactivate.call(this);
};
 
/**
* Set the reshaping behavior for segment dragging handles.
* @override
* @param {Point} newpt
* @this {OrthogonalLinkReshapingTool}
*/
OrthogonalLinkReshapingTool.prototype.reshape = function(newpt) {
  var link = this.adornedLink;
 
  // identify if the handle being dragged is a segment dragging handle
  if (link !== null && link.isOrthogonal && link.curve !== go.Link.Bezier && this.handle.toMaxLinks === 999) {
    link.startRoute();
    var index = this.handle.segmentIndex; // for these handles, firstPickIndex + 1 <= index < lastPickIndex - 1
    var behavior = this.getReshapingBehavior(this.handle);
    if (behavior === go.LinkReshapingTool.Vertical) {
      // move segment vertically
      link.setPointAt(index, link.getPoint(index - 1).x, newpt.y);
      link.setPointAt(index + 1, link.getPoint(index + 2).x, newpt.y);
    } else if (behavior === go.LinkReshapingTool.Horizontal) {
      // move segment horizontally
      link.setPointAt(index, newpt.x, link.getPoint(index - 1).y);
      link.setPointAt(index + 1, newpt.x, link.getPoint(index + 2).y);
    }
    link.commitRoute();
  } else {
    go.LinkReshapingTool.prototype.reshape.call(this, newpt);
  }
};
 
/**
* Create the segment dragging handles. 
* There are two parts: one invisible handle that spans the segment, and a visible handle at the middle of the segment.
* These are inserted at the front of the adornment such that the normal handles have priority.
* @param {Link} link
* @param {Adornment} adornment
* @param {number} index
* @this {OrthogonalLinkReshapingTool}
*/
OrthogonalLinkReshapingTool.prototype.makeSegmentDragHandle = function(link, adornment, index) {
  var a = link.getPoint(index);
  var b = link.getPoint(index + 1);
  var seglength = Math.max(Math.abs(a.x - b.x), Math.abs(a.y - b.y));
  // determine segment orientation
  var orient = "";
  if (OrthogonalLinkReshapingTool.isApprox(a.x, b.x) && OrthogonalLinkReshapingTool.isApprox(a.y, b.y)) {
    b = link.getPoint(index - 1);
    if (OrthogonalLinkReshapingTool.isApprox(a.x, b.x)) {
      orient = "vertical";
    } else if (OrthogonalLinkReshapingTool.isApprox(a.y, b.y)) {
      orient = "horizontal";
    }
  } else {
    if (OrthogonalLinkReshapingTool.isApprox(a.x, b.x)) {
      orient = "vertical";
    } else if (OrthogonalLinkReshapingTool.isApprox(a.y, b.y)) {
      orient = "horizontal";
    }
  }
 
  // first, make an invisible handle along the whole segment
  var h = new go.Shape();
  h.opacity = 0;
  h.segmentOrientation = go.Link.OrientAlong;
  h.segmentIndex = index;
  h.segmentFraction = 0.5;
  h.toMaxLinks = 999; // set this unsused property to easily identify that we have a segment dragging handle
  if (orient === "horizontal") {
    this.setReshapingBehavior(h, go.LinkReshapingTool.Vertical);
    h.cursor = 'n-resize';
  } else {
    this.setReshapingBehavior(h, go.LinkReshapingTool.Horizontal);
    h.cursor = 'w-resize';
  }
  h.geometryString = "M 0 0 L " + seglength + " 0";
  adornment.insertAt(0, h);
 
  // second, make a visible handle near the middle
  h = new go.Shape();
  h.fill = "#1B3471"; // different from other handles to make sure it stands out
  h.stroke = "dodgerblue";
  h.segmentOrientation = go.Link.OrientAlong;
  h.segmentIndex = index;
  h.segmentFraction = 0.5;
  h.toMaxLinks = 999; // set this unsused property to easily identify that we have a segment dragging handle
  if (orient === "horizontal") {
    this.setReshapingBehavior(h, go.LinkReshapingTool.Vertical);
    h.cursor = 'n-resize';
  } else {
    this.setReshapingBehavior(h, go.LinkReshapingTool.Horizontal);
    h.cursor = 'w-resize';
  }
  h.geometryString = "F M 0 0 L 12 0 L 12 4 L 0 4 Z X M 6 0 L 6 -3 X M 6 4 L 6 7";
  adornment.insertAt(0, h);
};
 
/**
* Compare two numbers to ensure they are almost equal.
* Used in this class for comparing coordinates of Points.
* @param {number} x
* @param {number} y
* @return {boolean}
*/
OrthogonalLinkReshapingTool.isApprox = function(x, y) {
  var d = x - y;
  return d < 0.5 && d > -0.5;
}
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/ParallelLayout.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/ParallelLayout.js

Statements: 3.03% (2 / 66)      Branches: 0% (0 / 40)      Functions: 0% (0 / 4)      Lines: 3.33% (2 / 60)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105                                    1                 2                                                                                                                                                          
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom TreeLayout that requires a "Split" node and a "Merge" node, by category.
// The "Split" node should be the root of a tree-like structure if one excludes links to the "Merge" node.
// This will position the "Merge" node to line up with the "Split" node.
 
/**
* @constructor
* @extends TreeLayout
* @class
* Assume there is a pair of nodes that "Split" and "Merge",
* along with any number of nodes extending in a tree-structure from the "Split" node.
* You can set all of the TreeLayout properties that you like,
* except that for simplicity this code just works for angle === 0 or angle === 90.
*/
function ParallelLayout() {
  go.TreeLayout.call(this);
  this.isRealtime = false;
  // these are desired for the Parallel Layout:
  this.alignment = go.TreeLayout.AlignmentCenterSubtrees;
  this.compaction = go.TreeLayout.CompactionNone;
  this.alternateAlignment = go.TreeLayout.AlignmentCenterSubtrees;
  this.alternateCompaction = go.TreeLayout.CompactionNone;
}
go.Diagram.inherit(ParallelLayout, go.TreeLayout);
 
ParallelLayout.prototype.makeNetwork = function(coll) {
  var net = go.TreeLayout.prototype.makeNetwork.call(this, coll);
  // look for and remember the one "Split" node and the one "Merge" node
  for (var it = net.vertexes.iterator; it.next(); ) {
    var v = it.value;
    if (v.node.category === "Split") {
      if (net.splitNode) throw new Error("Split node already exists in " + this + " -- existing: " + net.splitNode + " new: " + v.node);
      net.splitNode = v.node;
    } else if (v.node.category === "Merge") {
      if (net.mergeNode) throw new Error("Merge node already exists in " + this + " -- existing: " + net.mergeNode + " new: " + v.node);
      net.mergeNode = v.node;
    }
  }
  if (net.splitNode || net.mergeNode) {
    if (!net.splitNode) throw new Error("Missing Split node in " + this);
    if (!net.mergeNode) throw new Error("Missing Merge node in " + this);
  }
  // don't lay out the Merge node
  if (net.mergeNode) net.deleteNode(net.mergeNode);
  return net;
};
 
ParallelLayout.prototype.commitNodes = function() {
  go.TreeLayout.prototype.commitNodes.call(this);
  var mergeNode = this.network.mergeNode;
  var splitNode = this.network.splitNode;
  var splitVertex = this.network.findVertex(splitNode);
  if (mergeNode && splitVertex) {
    // line up the "Merge" node to the center of the "Split" node
    if (this.angle === 0) {
      mergeNode.position = new go.Point(splitVertex.x + splitVertex.subtreeSize.width + this.layerSpacing,
                                        splitVertex.centerY - mergeNode.actualBounds.height/2);
    } else if (this.angle === 90) {
      mergeNode.position = new go.Point(splitVertex.centerX - mergeNode.actualBounds.width / 2,
                                        splitVertex.y + splitVertex.subtreeSize.height + this.layerSpacing);
    }
  }
};
 
ParallelLayout.prototype.commitLinks = function() {
  go.TreeLayout.prototype.commitLinks.call(this);
  var mergeNode = this.network.mergeNode;
  if (mergeNode) {
    for (var it = mergeNode.findLinksInto(); it.next();) {
      var link = it.value;
      if (this.angle === 0) {
        link.fromSpot = go.Spot.Right;
        link.toSpot = go.Spot.Left;
      } else if (this.angle === 90) {
        link.fromSpot = go.Spot.Bottom;
        link.toSpot = go.Spot.Top;
      }
      if (!link.isOrthogonal) continue;
      // have all of the links coming into the "Merge" node have segments
      // that share a common X (or if angle==90, Y) coordinate
      link.updateRoute();
      if (link.pointsCount >= 6) {
        var pts = link.points.copy();
        var p2 = pts.elt(pts.length - 4);
        var p3 = pts.elt(pts.length - 3);
        if (this.angle === 0) {
          var x = mergeNode.position.x - this.layerSpacing / 2;
          pts.setElt(pts.length - 4, new go.Point(x, p2.y));
          pts.setElt(pts.length - 3, new go.Point(x, p3.y));
        } else if (this.angle === 90) {
          var y = mergeNode.position.y - this.layerSpacing / 2;
          pts.setElt(pts.length - 4, new go.Point(p2.x, y));
          pts.setElt(pts.length - 3, new go.Point(p3.x, y));
        }
        link.points = pts;
      }
    }
  }
};
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/PolygonDrawingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/PolygonDrawingTool.js

Statements: 1.24% (2 / 161)      Branches: 0% (0 / 69)      Functions: 0% (0 / 21)      Lines: 1.34% (2 / 149)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343                                          1                       2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom Tool for drawing polygons or polylines
 
/**
* @constructor
* @extends Tool
* @class
* This tool allows the user to draw a new polygon or polyline shape by clicking where the corners should go.
* Right click or type ENTER to finish the operation.
* <p/>
* Set {@link #isPolygon} to false if you want this tool to draw open unfilled polyline shapes.
* Set {@link #archetypePartData} to customize the node data object that is added to the model.
* Data-bind to those properties in your node template to customize the appearance and behavior of the part.
* <p/>
* This tool uses a temporary {@link Shape}, {@link #temporaryShape}, held by a {@link Part} in the "Tool" layer,
* to show interactively what the user is drawing.
*/
function PolygonDrawingTool() {
  go.Tool.call(this);
  this.name = "PolygonDrawing";
  this._isPolygon = true;
  this._hasArcs = false;
  this._archetypePartData = {}; // the data to copy for a new polygon Part
 
  // this is the Shape that is shown during a drawing operation
  this._temporaryShape = go.GraphObject.make(go.Shape, { name: "SHAPE", fill: "lightgray", strokeWidth: 1.5 });
  // the Shape has to be inside a temporary Part that is used during the drawing operation
  go.GraphObject.make(go.Part, { layerName: "Tool" }, this._temporaryShape);
}
go.Diagram.inherit(PolygonDrawingTool, go.Tool);
 
/**
* Don't start this tool in a mode-less fashion when the user's mouse-down is on an existing Part.
* When this tool is a mouse-down tool, it requires using the left mouse button in the background of a modifiable Diagram.
* Modal uses of this tool will not call this canStart predicate.
* @this {PolygonDrawingTool}
*/
PolygonDrawingTool.prototype.canStart = function() {
  if (!this.isEnabled) return false;
  var diagram = this.diagram;
  if (diagram === null || diagram.isReadOnly || diagram.isModelReadOnly) return false;
  var model = diagram.model;
  if (model === null) return false;
  // require left button
  if (!diagram.firstInput.left) return false;
  // can't start when mouse-down on an existing Part
  var obj = diagram.findObjectAt(diagram.firstInput.documentPoint, null, null);
  return (obj === null);
};
 
/**
* Start a transaction, capture the mouse, use a "crosshair" cursor,
* and start accumulating points in the geometry of the {@link #temporaryShape}.
* @this {PolygonDrawingTool}
*/
PolygonDrawingTool.prototype.doActivate = function() {
  go.Tool.prototype.doActivate.call(this);
  var diagram = this.diagram;
  this.startTransaction(this.name);
  if (!diagram.lastInput.isTouchEvent) diagram.isMouseCaptured = true;
  diagram.currentCursor = "crosshair";
  // the first point
  if (!diagram.lastInput.isTouchEvent) this.addPoint(diagram.lastInput.documentPoint);
};
 
/**
* Stop the transaction and clean up.
* @this {PolygonDrawingTool}
*/
PolygonDrawingTool.prototype.doDeactivate = function() {
  go.Tool.prototype.doDeactivate.call(this);
  var diagram = this.diagram;
  if (this.temporaryShape !== null) {
    diagram.remove(this.temporaryShape.part);
  }
  diagram.currentCursor = "";
  if (diagram.isMouseCaptured) diagram.isMouseCaptured = false;
  this.stopTransaction();
};
 
/**
* This internal method adds a segment to the geometry of the {@link #temporaryShape}.
* @this {PolygonDrawingTool}
*/
PolygonDrawingTool.prototype.addPoint = function(p) {
  var shape = this.temporaryShape;
  if (shape === null) return;
 
  // for the temporary Shape, normalize the geometry to be in the viewport
  var viewpt = this.diagram.viewportBounds.position;
  var q = new go.Point(p.x-viewpt.x, p.y-viewpt.y);
 
  var part = shape.part;
  // if it's not in the Diagram, re-initialize the Shape's geometry and add the Part to the Diagram
  if (part.diagram === null) {
    var fig = new go.PathFigure(q.x, q.y, true);  // possibly filled, depending on Shape.fill
    var geo = new go.Geometry().add(fig);  // the Shape.geometry consists of a single PathFigure
    this.temporaryShape.geometry = geo;
    // position the Shape's Part, accounting for the stroke width
    part.position = viewpt.copy().offset(-shape.strokeWidth / 2, -shape.strokeWidth / 2);
    this.diagram.add(part);
  } else {
    // must copy whole Geometry in order to add a PathSegment
    var geo = shape.geometry.copy();
    var fig = geo.figures.first();
    if (this.hasArcs) {
      var lastseg = fig.segments.last();
      if (lastseg === null) {
        fig.add(new go.PathSegment(go.PathSegment.QuadraticBezier, q.x, q.y, (fig.startX + q.x) / 2, (fig.startY + q.y) / 2));
      } else {
        fig.add(new go.PathSegment(go.PathSegment.QuadraticBezier, q.x, q.y, (lastseg.endX + q.x) / 2, (lastseg.endY + q.y) / 2));
      }
    } else {
      fig.add(new go.PathSegment(go.PathSegment.Line, q.x, q.y));
    }
  }
  shape.geometry = geo;
};
 
/**
* This internal method changes the last segment of the geometry of the {@link #temporaryShape} to end at the given point.
* @this {PolygonDrawingTool}
*/
PolygonDrawingTool.prototype.moveLastPoint = function(p) {
  // must copy whole Geometry in order to change a PathSegment
  var shape = this.temporaryShape;
  var geo = shape.geometry.copy();
  var fig = geo.figures.first();
  var segs = fig.segments;
  if (segs.count > 0) {
    // for the temporary Shape, normalize the geometry to be in the viewport
    var viewpt = this.diagram.viewportBounds.position;
    var seg = segs.elt(segs.count - 1);
    // modify the last PathSegment to be the given Point p
    seg.endX = p.x - viewpt.x;
    seg.endY = p.y - viewpt.y;
    if (seg.type === go.PathSegment.QuadraticBezier) {
      var prevx = 0.0;
      var prevy = 0.0;
      if (segs.count > 1) {
        var prevseg = segs.elt(segs.count - 2);
        prevx = prevseg.endX;
        prevy = prevseg.endY;
      } else {
        prevx = fig.startX;
        prevy = fig.startY;
      }
      seg.point1X = (seg.endX + prevx)/2;
      seg.point1Y = (seg.endY + prevy)/2;
    }
    shape.geometry = geo;
  }
};
 
/**
* This internal method removes the last segment of the geometry of the {@link #temporaryShape}.
* @this {PolygonDrawingTool}
*/
PolygonDrawingTool.prototype.removeLastPoint = function() {
  // must copy whole Geometry in order to remove a PathSegment
  var shape = this.temporaryShape;
  var geo = shape.geometry.copy();
  var segs = geo.figures.first().segments;
  if (segs.count > 0) {
    segs.removeAt(segs.count-1);
    shape.geometry = geo;
  }
};
 
/**
* Add a new node data JavaScript object to the model and initialize the Part's
* position and its Shape's geometry by copying the {@link #temporaryShape}'s {@link Shape#geometry}.
* @this {PolygonDrawingTool}
*/
PolygonDrawingTool.prototype.finishShape = function() {
  var diagram = this.diagram;
  var shape = this.temporaryShape;
  if (shape !== null && this.archetypePartData !== null) {
    // remove the temporary point, which is last, except on touch devices
    if (!diagram.lastInput.isTouchEvent) this.removeLastPoint();
    var tempgeo = shape.geometry;
    // require 3 points (2 segments) if polygon; 2 points (1 segment) if polyline
    if (tempgeo.figures.first().segments.count >= (this.isPolygon ? 2 : 1)) {
      // normalize geometry and node position
      var viewpt = diagram.viewportBounds.position;
      var geo = tempgeo.copy();
      if (this.isPolygon) {
        // if polygon, close the last segment
        var segs = geo.figures.first().segments;
        var seg = segs.elt(segs.count-1);
        seg.isClosed = true;
      }
      // create the node data for the model
      var d = diagram.model.copyNodeData(this.archetypePartData);
      // adding data to model creates the actual Part
      diagram.model.addNodeData(d);
      var part = diagram.findPartForData(d);
      // assign the position for the whole Part
      var pos = geo.normalize();
      pos.x = viewpt.x - pos.x - shape.strokeWidth / 2;
      pos.y = viewpt.y - pos.y - shape.strokeWidth / 2;
      part.position = pos;
      // assign the Shape.geometry
      var shape = part.findObject("SHAPE");
      if (shape !== null) shape.geometry = geo;
      this.transactionResult = this.name;
    }
  }
  this.stopTool();
};
 
/**
* Add another point to the geometry of the {@link #temporaryShape}.
* @this {PolygonDrawingTool}
*/
PolygonDrawingTool.prototype.doMouseDown = function() {
  if (!this.isActive) {
    this.doActivate();
  }
  // a new temporary end point, the previous one is now "accepted"
  this.addPoint(this.diagram.lastInput.documentPoint);
  if (!this.diagram.lastInput.left) {  // e.g. right mouse down
    this.finishShape();
  } else if (this.diagram.lastInput.clickCount > 1) {  // e.g. double-click
    this.removeLastPoint();
    this.finishShape();
  }
};
 
/**
* Move the last point of the {@link #temporaryShape}'s geometry to follow the mouse point.
* @this {PolygonDrawingTool}
*/
PolygonDrawingTool.prototype.doMouseMove = function() {
  if (this.isActive) {
    this.moveLastPoint(this.diagram.lastInput.documentPoint);
  }
};
 
/**
* Do not stop this tool, but continue to accumulate Points via mouse-down events.
* @this {PolygonDrawingTool}
*/
PolygonDrawingTool.prototype.doMouseUp = function() {
  // don't stop this tool (the default behavior is to call stopTool)
};
 
/**
* Typing the "ENTER" key accepts the current geometry (excluding the current mouse point)
* and creates a new part in the model by calling {@link #finishShape}.
* <p/>
* Typing the "Z" key causes the previous point to be discarded.
* <p/>
* Typing the "ESCAPE" key causes the temporary Shape and its geometry to be discarded and this tool to be stopped.
* @this {PolygonDrawingTool}
*/
PolygonDrawingTool.prototype.doKeyDown = function() {
  if (!this.isActive) return;
  var e = this.diagram.lastInput;
  if (e.key === '\r') {  // accept
    this.finishShape();  // all done!
  } else if (e.key === 'Z') {  // undo
    this.undo();
  } else {
    go.Tool.prototype.doKeyDown.call(this);
  }
};
 
/**
* Undo: remove the last point and continue the drawing of new points.
* @this {PolygonDrawingTool}
*/
PolygonDrawingTool.prototype.undo = function() {
  // remove a point, and then treat the last one as a temporary one
  this.removeLastPoint();
  var lastInput = this.diagram.lastInput;
  if (lastInput.event instanceof window.MouseEvent) this.moveLastPoint(lastInput.documentPoint);
};
 
 
// Public properties
 
/**
* Gets or sets whether this tools draws a filled polygon or an unfilled open polyline.
* The default value is true.
* @name PolygonDrawingTool#isPolygon
* @function.
* @return {boolean}
*/
Object.defineProperty(PolygonDrawingTool.prototype, "isPolygon", {
  get: function() { return this._isPolygon; },
  set: function(val) { this._isPolygon = val; }
});
 
/**
* Gets or sets whether this tools draws shapes with quadratic bezier curves for each segment, or just straight lines.
* The default value is false -- only use straight lines.
* @name PolygonDrawingTool#hasArcs
* @function.
* @return {boolean}
*/
Object.defineProperty(PolygonDrawingTool.prototype, "hasArcs", {
  get: function() { return this._hasArcs; },
  set: function(val) { this._hasArcs = val; }
});
 
/**
* Gets or sets the Shape that is used to hold the line as it is being drawn.
* The default value is a simple Shape drawing an unfilled open thin black line.
* @name PolygonDrawingTool#temporaryShape
* @function.
* @return {Shape}
*/
Object.defineProperty(PolygonDrawingTool.prototype, "temporaryShape", {
  get: function() { return this._temporaryShape; },
  set: function(val) {
    if (this._temporaryShape !== val && val !== null) {
      val.name = "SHAPE";
      var panel = this._temporaryShape.panel;
      panel.remove(this._temporaryShape);
      this._temporaryShape = val;
      panel.add(this._temporaryShape);
    }
  }
});
 
/**
* Gets or sets the node data object that is copied and added to the model
* when the drawing operation completes.
* @name PolygonDrawingTool#archetypePartData
* @function.
* @return {Object}
*/
Object.defineProperty(PolygonDrawingTool.prototype, "archetypePartData", {
  get: function() { return this._archetypePartData; },
  set: function(val) { this._archetypePartData = val; }
});
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/PolylineLinkingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/PolylineLinkingTool.js

Statements: 1.92% (2 / 104)      Branches: 0% (0 / 54)      Functions: 0% (0 / 10)      Lines: 2.04% (2 / 98)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235                                        1         2                                                                                                                                                                                                                                                                                                                                                                                                                                  
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom LinkingTool for manually routing a new link
 
/**
* @constructor
* @extends LinkingTool
* @class
* This tool allows the user to draw a new link by clicking where the route should go,
* until clicking on a valid target port.
* <p/>
* This tool supports routing both orthogonal and straight links.
* You can customize the {@link LinkingBaseTool#temporaryLink} as needed to affect the
* appearance and behavior of the temporary link that is shown during the linking operation.
* You can customize the {@link LinkingTool#archetypeLinkData} to specify property values
* that can be data-bound by your link template for the Links that are actually created.
*/
function PolylineLinkingTool() {
  go.LinkingTool.call(this);
  this.name = "PolylineLinking";
  this.portGravity = 0;  // gotta click on a target port in order to complete the link
}
go.Diagram.inherit(PolylineLinkingTool, go.LinkingTool);
 
/**
* Use a "crosshair" cursor.
* @this {PolylineLinkingTool}
*/
PolylineLinkingTool.prototype.doActivate = function() {
  go.LinkingTool.prototype.doActivate.call(this);
  this.diagram.currentCursor = "crosshair";
  // until a mouse down occurs, allow the temporary link to be routed to the temporary node/port
  this._firstMouseDown = true;
};
 
/**
* This internal method adds a point to the route.
* During the operation of this tool, the very last point changes to follow the mouse point.
* This method is called by {@link #doMouseDown} in order to add a new "last" point.
* @this {PolylineLinkingTool}
* @param {Point} p
*/
PolylineLinkingTool.prototype.addPoint = function(p) {
  if (this._firstMouseDown) return;
  var pts = this.temporaryLink.points.copy();
  this._horizontal = !this._horizontal;
  pts.add(p.copy());
  this.temporaryLink.points = pts;
};
 
/**
* This internal method moves the last point of the temporary Link's route.
* This is called by {@link #doMouseMove} and other methods that want to adjust the end of the route.
* @this {PolylineLinkingTool}
* @param {Point} p
*/
PolylineLinkingTool.prototype.moveLastPoint = function(p) {
  if (this._firstMouseDown) return;
  var pts = this.temporaryLink.points.copy();
  if (this.temporaryLink.isOrthogonal) {
    var q = pts.elt(pts.length - 3).copy();
    if (this._horizontal) {
      q.y = p.y;
    } else {
      q.x = p.x;
    }
    pts.setElt(pts.length - 2, q);
  }
  pts.setElt(pts.length - 1, p.copy());
  this.temporaryLink.points = pts;
};
 
/**
* This internal method removes the last point of the temporary Link's route.
* This is called by the "Z" command in {@link #doKeyDown}
* and by {@link #doMouseUp} when a valid target port is found and we want to
* discard the current mouse point from the route.
* @this {PolylineLinkingTool}
*/
PolylineLinkingTool.prototype.removeLastPoint = function() {
  if (this._firstMouseDown) return;
  var pts = this.temporaryLink.points.copy();
  if (pts.length === 0) return;
  pts.removeAt(pts.length - 1);
  this.temporaryLink.points = pts;
  this._horizontal = !this._horizontal;
};
 
/**
* Add a point to the route that the temporary Link is accumulating.
* @this {PolylineLinkingTool}
*/
PolylineLinkingTool.prototype.doMouseDown = function() {
  if (!this.isActive) {
    this.doActivate();
  }
  if (this.diagram.lastInput.left) {
    if (this._firstMouseDown) {
      this._firstMouseDown = false;
      // disconnect the temporary node/port from the temporary link
      // so that it doesn't lose the points that are accumulating
      if (this.isForwards) {
        this.temporaryLink.toNode = null;
      } else {
        this.temporaryLink.fromNode = null;
      }
      var pts = this.temporaryLink.points;
      var ult = pts.elt(pts.length - 1);
      var penult = pts.elt(pts.length - 2);
      this._horizontal = (ult.x === penult.x);
    }
    // a new temporary end point, the previous one is now "accepted"
    this.addPoint(this.diagram.lastInput.documentPoint);
  } else {  // e.g. right mouse down
    this.doCancel();
  }
};
 
/**
* Have the temporary link reach to the last mouse point.
* @this {PolylineLinkingTool}
*/
PolylineLinkingTool.prototype.doMouseMove = function() {
  if (this.isActive) {
    this.moveLastPoint(this.diagram.lastInput.documentPoint);
    go.LinkingTool.prototype.doMouseMove.call(this);
  }
};
 
/**
* If this event happens on a valid target port (as determined by {@link LinkingBaseTool#findTargetPort}),
* we complete the link drawing operation.  {@link #insertLink} is overridden to transfer the accumulated
* route drawn by user clicks to the new {@link Link} that was created.
* <p/>
* If this event happens elsewhere in the diagram, this tool is not stopped: the drawing of the route continues.
* @this {PolylineLinkingTool}
*/
PolylineLinkingTool.prototype.doMouseUp = function() {
  if (!this.isActive) return;
  var target = this.findTargetPort(this.isForwards);
  if (target !== null) {
    if (this._firstMouseDown) {
      go.LinkingTool.prototype.doMouseUp.call(this);
    } else {
      var pts;
      this.removeLastPoint();  // remove temporary point
      var spot = this.isForwards ? target.toSpot : target.fromSpot;
      if (spot.equals(go.Spot.None)) {
        var pt = this.temporaryLink.getLinkPointFromPoint(target.part, target,
                          target.getDocumentPoint(go.Spot.Center),
                          this.temporaryLink.points.elt(this.temporaryLink.points.length - 2),
                          !this.isForwards);
        this.moveLastPoint(pt);
        pts = this.temporaryLink.points.copy();
        if (this.temporaryLink.isOrthogonal) {
          pts.insertAt(pts.length - 2, pts.elt(pts.length - 2));
        }
      } else {
        // copy the route of saved points, because we're about to recompute it
        pts = this.temporaryLink.points.copy();
        // terminate the link in the expected manner by letting the
        // temporary link connect with the temporary node/port and letting the
        // normal route computation take place
        if (this.isForwards) {
          this.copyPortProperties(target.part, target, this.temporaryToNode, this.temporaryToPort, true);
          this.temporaryLink.toNode = target.part;
        } else {
          this.copyPortProperties(target.part, target, this.temporaryFromNode, this.temporaryFromPort, false);
          this.temporaryLink.fromNode = target.part;
        }
        this.temporaryLink.updateRoute();
        // now copy the final one or two points of the temporary link's route
        // into the route built up in the PTS List.
        var natpts = this.temporaryLink.points;
        var numnatpts = natpts.length;
        if (numnatpts >= 2) {
          if (numnatpts >= 3) {
            var penult = natpts.elt(numnatpts - 2);
            pts.insertAt(pts.length - 1, penult);
            if (this.temporaryLink.isOrthogonal) {
              pts.insertAt(pts.length - 1, penult);
            }
          }
          var ult = natpts.elt(numnatpts - 1);
          pts.setElt(pts.length - 1, ult);
        }
      }
      // save desired route in temporary link;
      // insertLink will copy the route into the new real Link
      this.temporaryLink.points = pts;
      go.LinkingTool.prototype.doMouseUp.call(this);
    }
  }
};
 
/**
* This method overrides the standard link creation method by additionally
* replacing the default link route with the custom one laid out by the user.
* @this {PolylineLinkingTool}
* @this {Node} fromnode
* @this {GraphObject} fromport
* @this {Node} tonode
* @this {GraphObject} toport
* @return {Link}
*/
PolylineLinkingTool.prototype.insertLink = function(fromnode, fromport, tonode, toport) {
  var link = go.LinkingTool.prototype.insertLink.call(this, fromnode, fromport, tonode, toport);
  if (link !== null && !this._firstMouseDown) {
    // ignore natural route by replacing with route accumulated by this tool
    link.points = this.temporaryLink.points;
  }
  return link;
};
 
/**
* This supports the "Z" command during this tool's operation to remove the last added point of the route.
* Type ESCAPE to completely cancel the operation of the tool.
* @this {PolylineLinkingTool}
*/
PolylineLinkingTool.prototype.doKeyDown = function() {
  if (!this.isActive) return;
  var e = this.diagram.lastInput;
  if (e.key === 'Z' && this.temporaryLink.points.length > (this.temporaryLink.isOrthogonal ? 4 : 3)) {  // undo
    // remove a point, and then treat the last one as a temporary one
    this.removeLastPoint();
    this.moveLastPoint(e.documentPoint);
  } else {
    go.Tool.prototype.doKeyDown.call(this);
  }
};
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/PortShiftingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/PortShiftingTool.js

Statements: 3.03% (2 / 66)      Branches: 0% (0 / 31)      Functions: 0% (0 / 10)      Lines: 3.51% (2 / 57)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151                                1                 2                                                                                                                                                                                                                                                          
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom Tool for moving a port on a Node
 
/**
* @constructor
* @extends Tool
* @class
* This tool only works when the Node has a port (any GraphObject) marked with
* a non-null and non-empty portId that is positioned in a Spot Panel,
* and the user holds down the Shift key.
* It works by modifying that port's GraphObject.alignment property.
*/
function PortShiftingTool() {
  go.Tool.call(this);
  this.name = "NodeLabelDragging";
 
  /** @type {GraphObject} */
  this.port = null;
  /** @type {Point} */
  this._originalAlignment = null;
}
go.Diagram.inherit(PortShiftingTool, go.Tool);
 
/**
* This tool can only start if the mouse has moved enough so that it is not a click,
* and if the mouse down point is on a GraphObject "port" in a Spot Panel,
* as determined by findPort().
* @this {PortShiftingTool}
* @return {boolean}
*/
PortShiftingTool.prototype.canStart = function() {
  if (!go.Tool.prototype.canStart.call(this)) return false;
  var diagram = this.diagram;
  if (diagram === null) return false;
  // require left button & that it has moved far enough away from the mouse down point, so it isn't a click
  var e = diagram.lastInput;
  if (!e.left || !e.shift) return false;
  if (!this.isBeyondDragSize()) return false;
 
  return this.findPort() !== null;
}
 
/**
* From the GraphObject at the mouse point, search up the visual tree until we get to
* an object that has the portId property set to a non-empty string, that is in a Spot Panel,
* and that is not the main element of the panel (typically the first element).
* @this {PortShiftingTool}
* @return {GraphObject} This returns null if no such port is at the mouse down point.
*/
PortShiftingTool.prototype.findPort = function() {
  var diagram = this.diagram;
  var e = diagram.firstInput;
  var elt = diagram.findObjectAt(e.documentPoint, null, null);
 
  if (elt === null || !(elt.part instanceof go.Node)) return null;
  while (elt.panel !== null && elt.panel.type === go.Panel.Spot && elt.panel.findMainElement() !== elt) {
    if (elt.portId !== null && elt.portId !== "") return elt;
    elt = elt.panel;
  }
  return null;
};
 
/**
* Start a transaction, call findPort and remember it as the "port" property,
* and remember the original value for the port's alignment property.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.doActivate = function() {
  this.startTransaction("Shifted Label");
  this.port = this.findPort();
  if (this.port !== null) {
    this._originalAlignment = this.port.alignment.copy();
    var main = this.port.panel.findMainElement();
  }
  go.Tool.prototype.doActivate.call(this);
}
 
/**
* Stop any ongoing transaction.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.doDeactivate = function() {
  go.Tool.prototype.doDeactivate.call(this);
  this.stopTransaction();
}
 
/**
* Clear any reference to a port element.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.doStop = function() {
  this.port = null;
  go.Tool.prototype.doStop.call(this);
}
 
/**
* Restore the port's original value for GraphObject.alignment.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.doCancel = function() {
  if (this.port !== null) {
    this.port.alignment = this._originalAlignment;
  }
  go.Tool.prototype.doCancel.call(this);
}
 
/**
* During the drag, call updateAlignment in order to set the GraphObject.alignment of the port.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.doMouseMove = function() {
  if (!this.isActive) return;
  this.updateAlignment();
}
 
/**
* At the end of the drag, update the alignment of the port and finish the tool,
* completing a transaction.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.doMouseUp = function() {
  if (!this.isActive) return;
  this.updateAlignment();
  this.transactionResult = "Shifted Label";
  this.stopTool();
}
 
/**
* Save the port's GraphObject.alignment as a fractional Spot in the Spot Panel
* that the port is in.  Thus if the main element changes size, the relative positions
* of the ports will be maintained.  But that does assume that the port must remain
* inside the main element -- it cannot wander away from the node.
* This does not modify the port's GraphObject.alignmentFocus property.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.updateAlignment = function() {
  if (this.port === null) return;
  var last = this.diagram.lastInput.documentPoint;
  var main = this.port.panel.findMainElement();
  var tl = main.getDocumentPoint(go.Spot.TopLeft);
  var br = main.getDocumentPoint(go.Spot.BottomRight);
  var x = Math.max(0, Math.min((last.x - tl.x) / (br.x - tl.x), 1));
  var y = Math.max(0, Math.min((last.y - tl.y) / (br.y - tl.y), 1));
  this.port.alignment = new go.Spot(x, y);
}
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/RadialLayout.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/RadialLayout.js

Statements: 2.58% (4 / 155)      Branches: 0% (0 / 48)      Functions: 0% (0 / 21)      Lines: 2.84% (4 / 141)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322                        1           2                                                                                                                                                                                                                                                                                                                                                                                                           1                                                                                                                                                                                           1                      
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
/**
* @constructor 
* @extends Layout
* @class
* Given a root Node this arranges connected nodes in concentric rings,
* layered by the minimum link distance from the root.
*/
function RadialLayout() {
  go.Layout.call(this);
  this._root = null;
  this._layerThickness = 100;  // how thick each ring should be
  this._maxLayers = Infinity;
}
go.Diagram.inherit(RadialLayout, go.Layout);
 
/**
* @ignore
* Copies properties to a cloned Layout.
* @this {RadialLayout}
* @param {Layout} copy
* @override
*/
RadialLayout.prototype.cloneProtected = function(copy) {
  go.Layout.prototype.cloneProtected.call(this, copy);
  // don't copy .root
  copy._layerThickness = this._layerThickness;
  copy._maxLayers = this._maxLayers;
};
 
/*
* The Node to act as the root or central node of the radial layout.
* @name RadialLayout#root
* @function.
* @return {Node}
*/
Object.defineProperty(RadialLayout.prototype, "root", {
  get: function() { return this._root; },
  set: function(value) {
    if (this._root !== value) {
      this._root = value;
      this.invalidateLayout();
    }
  }
});
 
/*
* The thickness of each ring representing a layer.
* @name RadialLayout#layerThickness
* @function.
* @return {number}
*/
Object.defineProperty(RadialLayout.prototype, "layerThickness", {
  get: function() { return this._layerThickness; },
  set: function(value) {
    if (this._layerThickness !== value) {
      this._layerThickness = value;
      this.invalidateLayout();
    }
  }
});
 
/*
* The maximum number of layers to be shown, in addition to the root node at layer zero.
* The default value is Infinity.
* @name RadialLayout#maxLayers
* @function.
* @return {number}
*/
Object.defineProperty(RadialLayout.prototype, "maxLayers", {
  get: function() { return this._maxLayers; },
  set: function(value) {
    if (this._maxLayers !== value) {
      this._maxLayers = value;
      this.invalidateLayout();
    }
  }
});
 
/**
* Use a LayoutNetwork that always creates RadialVertexes.
* @this {RadialLayout}
* @return {LayoutNetwork}
* @override
*/
RadialLayout.prototype.createNetwork = function() {
  var net = new go.LayoutNetwork();
  net.createVertex = function() { return new RadialVertex(); };
  return net;
}
 
/**
* @this {RadialLayout}
* @param {Diagram|Group|Iterable} coll the collection of Parts to layout.
* @override
*/
RadialLayout.prototype.doLayout = function(coll) {
  if (this.network === null) {
    this.network = this.makeNetwork(coll);
  }
 
  if (this.root === null) {
    // If no root supplied, choose one without any incoming edges
    var it = this.network.vertexes.iterator;
    while (it.next()) {
      var v = it.value;
      if (v.node !== null && v.sourceEdges.count === 0) {
        this.root = v.node;
        break;
      }
    }
  }
  if (this.root === null) {
    // If could not find any default root, choose a random one
    this.root = this.network.vertexes.first().node;
  }
  if (this.root === null) return;  // nothing to do
 
  var rootvert = this.network.findVertex(this.root);
  if (rootvert === null) throw new Error("RadialLayout.root must be a Node in the LayoutNetwork that the RadialLayout is operating on")
 
  this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin);
  this.findDistances(rootvert);
 
  // sort all results into Arrays of RadialVertexes with the same distance
  var verts = [];
  var maxlayer = 0;
  var it = this.network.vertexes.iterator;
  while (it.next()) {
    var v = it.value;
    v.laid = false;
    var layer = v.distance;
    if (layer === Infinity) continue; // Infinity used as init value (set in findDistances())
    if (layer > maxlayer) maxlayer = layer;
    var layerverts = verts[layer];
    if (layerverts === undefined) {
      layerverts = [];
      verts[layer] = layerverts;
    }
    layerverts.push(v);
  }
 
  // now recursively position nodes (using radlay1()), starting with the root
  rootvert.centerX = this.arrangementOrigin.x;
  rootvert.centerY = this.arrangementOrigin.y;
  this.radlay1(rootvert, 1, 0, 360);
 
  // Update the "physical" positions of the nodes and links.
  this.updateParts();
  this.network = null;
}
 
/**
* @ignore
* recursively position vertexes in a radial layout
* @this {RadialLayout}
* @param {RadialVertex} vert
* @param {number} layer
* @param {number} angle
* @param {number} sweep
*/
RadialLayout.prototype.radlay1 = function(vert, layer, angle, sweep) {
  if (layer > this.maxLayers) return; // no need to position nodes outside of maxLayers
  var verts = []; // array of all RadialVertexes connected to 'vert' in layer 'layer'
  vert.vertexes.each(function(v) {
    if (v.laid) return;
    if (v.distance === layer) verts.push(v);
  });
  var found = verts.length;
  if (found === 0) return;
 
  var radius = layer * this.layerThickness;
  var separator = sweep / found; // distance between nodes in their sweep portion
  var start = angle - sweep / 2 + separator / 2;
  // for each vertex in this layer, place it in its correct layer and position
  for (var i = 0; i < found; i++) {
    var v = verts[i];
    var a = start + i * separator; // the angle to rotate the node to
    if (a < 0) a += 360; else if (a > 360) a -= 360;
    // the point to place the node at -- this corresponds with the layer the node is in
    // all nodes in the same layer are placed at a constant point, then rotated accordingly
    var p = new go.Point(radius, 0);
    p.rotate(a);
    v.centerX = p.x + this.arrangementOrigin.x;
    v.centerY = p.y + this.arrangementOrigin.y;
    v.laid = true;
    v.angle = a;
    v.sweep = separator;
    v.radius = radius;
    // keep going for all layers
    this.radlay1(v, layer + 1, a, sweep / found);
  }
};
 
/**
* @ignore
* Update RadialVertex.distance for every vertex.
* @this {RadialLayout}
* @param {RadialVertex} source
*/
RadialLayout.prototype.findDistances = function(source) {
  var diagram = this.diagram;
  // keep track of distances from the source node
  this.network.vertexes.each(function(v) { v.distance = Infinity; });
  // the source node starts with distance 0
  source.distance = 0;
  // keep track of nodes for we have set a non-Infinity distance,
  // but which we have not yet finished examining
  var seen = new go.Set(go.RadialVertex);
  seen.add(source);
 
  // local function for finding a vertex with the smallest distance in a given collection
  function leastVertex(coll) {
    var bestdist = Infinity;
    var bestvert = null;
    var it = coll.iterator;
    while (it.next()) {
      var v = it.value;
      var dist = v.distance;
      if (dist < bestdist) {
        bestdist = dist;
        bestvert = v;
      }
    }
    return bestvert;
  }
 
  // keep track of vertexes we have finished examining;
  // this avoids unnecessary traversals and helps keep the SEEN collection small
  var finished = new go.Set(go.RadialVertex);
  while (seen.count > 0) {
    // look at the unfinished vertex with the shortest distance so far
    var least = leastVertex(seen);
    var leastdist = least.distance;
    // by the end of this loop we will have finished examining this LEAST vertex
    seen.remove(least);
    finished.add(least);
    // look at all edges connected with this vertex
    least.edges.each(function(e) {
      var neighbor = e.getOtherVertex(least);
      // skip vertexes that we have finished
      if (finished.contains(neighbor)) return;
      var neighbordist = neighbor.distance;
      // assume "distance" along a link is unitary, but could be any non-negative number.
      var dist = leastdist + 1;
      if (dist < neighbordist) {
        // if haven't seen that vertex before, add it to the SEEN collection
        if (neighbordist == Infinity) {
          seen.add(neighbor);
        }
        // record the new best distance so far to that node
        neighbor.distance = dist;
      }
    });
  }
}
 
/**
* This override positions each Node and also calls {@link #rotateNode}.
* @this {RadialLayout}
* @override
*/
RadialLayout.prototype.commitLayout = function() {
  go.Layout.prototype.commitLayout.call(this);
 
  var it = this.network.vertexes.iterator;
  while (it.next()) {
    var v = it.value;
    var n = v.node;
    if (n !== null) {
      n.visible = (v.distance <= this.maxLayers);
      this.rotateNode(n, v.angle, v.sweep, v.radius);
    }
  }
 
  this.commitLayers();
};
 
/**
* Override this method in order to modify each node as it is laid out.
* By default this method does nothing.
* @this {RadialLayout}
* @param {Node} node
* @param {number} angle in degrees relative to the center point
* @param {number} sweep in degrees
* @param {number} radius the inner radius for this node's layer
*/
RadialLayout.prototype.rotateNode = function(node, angle, sweep, radius) {
};
 
/**
* Override this method in order to create background circles indicating the layers of the radial layout.
* By default this method does nothing.
* @this {RadialLayout}
*/
RadialLayout.prototype.commitLayers = function() {
};
// end RadialLayout
 
 
/**
* @ignore
* @constructor
* @extends LayoutVertex
* @class
*/
function RadialVertex() {
  go.LayoutVertex.call(this);
  this.distance = Infinity;  // number of layers from the root, non-negative integers
  this.laid = false;  // used internally to keep track
  this.angle = 0;  // the direction at which the node is placed relative to the root node
  this.sweep = 0;  // the angle subtended by the vertex
  this.radius = 0;  // the inner radius of the layer containing this vertex
}
go.Diagram.inherit(RadialVertex, go.LayoutVertex);
 
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/RealtimeDragSelectingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/RealtimeDragSelectingTool.js

Statements: 2.67% (2 / 75)      Branches: 0% (0 / 34)      Functions: 0% (0 / 20)      Lines: 3.77% (2 / 53)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123                            1           2                                                                                                                                                                                                            
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom DragSelectingTool for selecting and deselecting Parts during a drag.
 
/**
* @constructor
* @extends DragSelectingTool
* @class
* The RealtimeDragSelectingTool selects and deselects Parts within the {@link DragSelectingTool#box}
* during a drag, not just at the end of the drag.
*/
function RealtimeDragSelectingTool() {
  go.DragSelectingTool.call(this);
  this._originalSelection = null;
  this._temporarySelection = null;
}
 
go.Diagram.inherit(RealtimeDragSelectingTool, go.DragSelectingTool);
 
/**
* Remember the original collection of selected Parts.
* @this {RealtimeDragSelectingTool}
*/
RealtimeDragSelectingTool.prototype.doActivate = function() {
  go.DragSelectingTool.prototype.doActivate.call(this);
  // keep a copy of the original Set of selected Parts
  this._originalSelection = this.diagram.selection.copy();
  // these Part.isSelected may have been temporarily modified
  this._temporarySelection = new go.Set(go.Part);
};
 
/**
* Release any references to selected Parts.
* @this {RealtimeDragSelectingTool}
*/
RealtimeDragSelectingTool.prototype.doDeactivate = function() {
  this._originalSelection = null;
  this._temporarySelection = null;
  go.DragSelectingTool.prototype.doDeactivate.call(this);
};
 
/**
* Restore the selection which may have been modified during a drag.
* @this {RealtimeDragSelectingTool}
*/
RealtimeDragSelectingTool.prototype.doCancel = function() {
  var orig = this._originalSelection;
  if (orig !== null) {
    orig.each(function(p) { p.isSelected = true; });
    this._temporarySelection.each(function(p) { if (!orig.contains(p)) p.isSelected = false; });
  }
  go.DragSelectingTool.prototype.doCancel.call(this);
};
 
/**
* @this {RealtimeDragSelectingTool}
*/
RealtimeDragSelectingTool.prototype.doMouseMove = function() {
  if (this.isActive) {
    go.DragSelectingTool.prototype.doMouseMove.call(this);
    this.selectInRect(this.computeBoxBounds());
  }
};
 
/**
* @this {RealtimeDragSelectingTool}
*/
RealtimeDragSelectingTool.prototype.doKeyDown = function() {
  if (this.isActive) {
    go.DragSelectingTool.prototype.doKeyDown.call(this);
    this.selectInRect(this.computeBoxBounds());
  }
};
 
/**
* @this {RealtimeDragSelectingTool}
*/
RealtimeDragSelectingTool.prototype.doKeyUp = function() {
  if (this.isActive) {
    go.DragSelectingTool.prototype.doKeyUp.call(this);
    this.selectInRect(this.computeBoxBounds());
  }
};
 
/**
* @expose
* @this {RealtimeDragSelectingTool}
* @param {Rect} r a rectangular bounds in document coordinates.
*/
RealtimeDragSelectingTool.prototype.selectInRect = function(r) {
  var diagram = this.diagram;
  var orig = this._originalSelection;
  var temp = this._temporarySelection;
  if (diagram === null || orig === null) return;
  var e = diagram.lastInput;
  diagram.raiseDiagramEvent("ChangingSelection");
  var found = diagram.findObjectsIn(r, null,
                                    function(p) { return (p instanceof go.Part) && p.canSelect(); },
                                    this.isPartialInclusion,
                                    new go.Set(go.Part));
  if (e.control || e.meta) {  // toggle or deselect
    if (e.shift) {  // deselect only
      temp.each(function(p) { if (!found.contains(p)) p.isSelected = orig.contains(p); });
      found.each(function(p) { p.isSelected = false; temp.add(p); });
    } else {  // toggle selectedness of parts based on _originalSelection
      temp.each(function(p) { if (!found.contains(p)) p.isSelected = orig.contains(p); });
      found.each(function(p) { p.isSelected = !orig.contains(p); temp.add(p); });
    }
  } else if (e.shift) {  // extend selection only
    temp.each(function(p) { if (!found.contains(p)) p.isSelected = orig.contains(p); });
    found.each(function(p) { p.isSelected = true; temp.add(p); });
  } else {  // select found parts, and unselect all other previously selected parts
    temp.each(function(p) { if (!found.contains(p)) p.isSelected = false; });
    orig.each(function(p) { if (!found.contains(p)) p.isSelected = false; });
    found.each(function(p) { p.isSelected = true; temp.add(p); });
  }
  diagram.raiseDiagramEvent("ChangedSelection");
};
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/ResizeMultipleTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/ResizeMultipleTool.js

Statements: 7.14% (2 / 28)      Branches: 0% (0 / 22)      Functions: 0% (0 / 3)      Lines: 7.69% (2 / 26)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55                      1       2                                                                              
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
/**
* @constructor
* @extends ResizingTool
* @class 
* A custom tool for resizing multiple objects at once.
*/
function ResizeMultipleTool() {
  go.ResizingTool.call(this);
  this.name = "ResizeMultiple";
}
go.Diagram.inherit(ResizeMultipleTool, go.ResizingTool);
 
/**
* Overrides ResizingTool.resize to resize all selected objects to the same size.
* @this {ResizeMultipleTool}
* @param {Rect} newr the intended new rectangular bounds for each Part's {@link Part#resizeObject}.
*/
ResizeMultipleTool.prototype.resize = function(newr) {
  var diagram = this.diagram;
  if (diagram === null) return;
  diagram.selection.each(function(part) {
    if (part instanceof go.Link || part instanceof go.Group) return; // only Nodes and simple Parts
    var obj = part.resizeObject;
 
    // calculate new location
    var pos = part.position.copy();
    var angle = obj.getDocumentAngle();
    var sc = obj.getDocumentScale();
 
    var radAngle = Math.PI * angle / 180;
    var angleCos = Math.cos(radAngle);
    var angleSin = Math.sin(radAngle);
 
    var deltaWidth = newr.width - obj.naturalBounds.width;
    var deltaHeight = newr.height - obj.naturalBounds.height;
 
    var angleRight = (angle > 270 || angle < 90) ? 1 : 0;
    var angleBottom = (angle > 0 && angle < 180) ? 1 : 0;
    var angleLeft = (angle > 90 && angle < 270) ? 1 : 0;
    var angleTop = (angle > 180 && angle < 360) ? 1 : 0;
 
    pos.x += sc * ((newr.x + deltaWidth * angleLeft) * angleCos - (newr.y + deltaHeight * angleBottom) * angleSin);
    pos.y += sc * ((newr.x + deltaWidth * angleTop) * angleSin + (newr.y + deltaHeight * angleLeft) * angleCos);
 
    obj.desiredSize = newr.size;
    part.position = pos;
  });
}
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/Robot.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/Robot.js

Statements: 6.35% (8 / 126)      Branches: 0% (0 / 78)      Functions: 0% (0 / 8)      Lines: 8.08% (8 / 99)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201                                    1                       1                             1                                                       1                                                     1                                                       1                                             1                                                       1                                          
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A class for simulating mouse and keyboard input.
 
// As a special hack, this supports limited simulation of drag-and-drop between Diagrams,
// by setting on the EVENTPROPS argument of the mouseDown/mouseMove/mouseUp methods
// both the "sourceDiagram" and "targetDiagram" properties.
// Although InputEvent.targetDiagram is a real property,
// the "sourceDiagram" property is only used by these Robot methods.
 
/**
* @constructor
* @class
* @param {Diagram=} dia the Diagram on which the Robot simulates input events
*/
function Robot(dia) {
  if (dia === undefined) dia = null;
  this.diagram = dia;
}
 
/**
* @ignore
* Transfer property settings from a JavaScript Object to an InputEvent.
* @this {Robot}
* @param {InputEvent} e
* @param {Object} props
*/
Robot.prototype.initializeEvent = function(e, props) {
  if (!props) return;
  for (var p in props) {
    if (p !== "sourceDiagram") e[p] = props[p];
  }
};
 
/**
* Simulate a mouse down event.
* @this {Robot}
* @param {number} x the X-coordinate of the mouse point in document coordinates.
* @param {number} y the Y-coordinate of the mouse point in document coordinates.
* @param {number=} time the timestamp of the simulated event, in milliseconds; default zero
* @param {object=} eventprops an optional argument providing properties for the InputEvent.
*/
Robot.prototype.mouseDown = function(x, y, time, eventprops) {
  if (typeof x !== "number" || typeof y !== "number") throw new Error("Robot.mouseDown first two args must be X,Y numbers");
  if (time === undefined) time = 0;
 
  var diagram = this.diagram;
  if (eventprops && eventprops.sourceDiagram) diagram = eventprops.sourceDiagram;
  if (!diagram.isEnabled) return;
 
  var n = new go.InputEvent();
  n.diagram = diagram;
  n.documentPoint = new go.Point(x, y);
  n.viewPoint = diagram.transformDocToView(n.documentPoint);
  n.timestamp = time;
  n.down = true;
  this.initializeEvent(n, eventprops);
  diagram.lastInput = n;
  diagram.firstInput = n.copy();
  diagram.currentTool.doMouseDown();
};
 
/**
* Simulate a mouse move event.
* @this {Robot}
* @param {number} x the X-coordinate of the mouse point in document coordinates.
* @param {number} y the Y-coordinate of the mouse point in document coordinates.
* @param {number=} time the timestamp of the simulated event, in milliseconds; default zero
* @param {object=} eventprops an optional argument providing properties for the InputEvent.
*/
Robot.prototype.mouseMove = function(x, y, time, eventprops) {
  if (typeof x !== "number" || typeof y !== "number") throw new Error("Robot.mouseMove first two args must be X,Y numbers");
  if (time === undefined) time = 0;
 
  var diagram = this.diagram;
  if (eventprops && eventprops.sourceDiagram) diagram = eventprops.sourceDiagram;
  if (!diagram.isEnabled) return;
 
  var n = new go.InputEvent();
  n.diagram = diagram;
  n.documentPoint = new go.Point(x, y);
  n.viewPoint = diagram.transformDocToView(n.documentPoint);
  n.timestamp = time;
  this.initializeEvent(n, eventprops);
  diagram.lastInput = n;
  if (diagram.simulatedMouseMove(null, n.documentPoint, n.targetDiagram)) return;
  diagram.currentTool.doMouseMove();
};
 
/**
* Simulate a mouse up event.
* @this {Robot}
* @param {number} x the X-coordinate of the mouse point in document coordinates.
* @param {number} y the Y-coordinate of the mouse point in document coordinates.
* @param {number=} time the timestamp of the simulated event, in milliseconds; default zero
* @param {object=} eventprops an optional argument providing properties for the InputEvent.
*/
Robot.prototype.mouseUp = function(x, y, time, eventprops) {
  if (typeof x !== "number" || typeof y !== "number") throw new Error("Robot.mouseUp first two args must be X,Y numbers");
  if (time === undefined) time = 0;
 
  var diagram = this.diagram;
  if (eventprops && eventprops.sourceDiagram) diagram = eventprops.sourceDiagram;
  if (!diagram.isEnabled) return;
 
  var n = new go.InputEvent();
  n.diagram = diagram;
  n.documentPoint = new go.Point(x, y);
  n.viewPoint = diagram.transformDocToView(n.documentPoint);
  n.timestamp = time;
  n.up = true;
  if (diagram.firstInput.documentPoint.equals(n.documentPoint)) n.clickCount = 1;  // at least??
  this.initializeEvent(n, eventprops);
  diagram.lastInput = n;
  if (diagram.simulatedMouseUp(null, n.sourceDiagram, n.documentPoint, n.targetDiagram)) return;
  diagram.currentTool.doMouseUp();
};
 
/**
* Simulate a mouse wheel event.
* @this {Robot}
* @param {number} delta non-zero turn
* @param {number=} time the timestamp of the simulated event, in milliseconds; default zero
* @param {object=} eventprops an optional argument providing properties for the InputEvent.
*/
Robot.prototype.mouseWheel = function(delta, time, eventprops) {
  if (typeof delta !== "number") throw new Error("Robot.mouseWheel first arg must be DELTA number");
  if (time === undefined) time = 0;
 
  var diagram = this.diagram;
  if (!diagram.isEnabled) return;
 
  var n = diagram.lastInput.copy();
  n.diagram = diagram;
  n.delta = delta;
  n.timestamp = time;
  this.initializeEvent(n, eventprops);
  diagram.lastInput = n;
  diagram.currentTool.doMouseWheel();
};
 
/**
* Simulate a key down event.
* @this {Robot}
* @param {string|number} keyorcode
* @param {number=} time the timestamp of the simulated event, in milliseconds; default zero
* @param {object=} eventprops an optional argument providing properties for the InputEvent.
*/
Robot.prototype.keyDown = function(keyorcode, time, eventprops) {
  if (typeof keyorcode !== "string" && typeof keyorcode !== "number") throw new Error("Robot.keyDown first arg must be a string or a number");
  if (time === undefined) time = 0;
 
  var diagram = this.diagram;
  if (!diagram.isEnabled) return;
 
  var n = diagram.lastInput.copy();
  n.diagram = diagram;
  if (typeof (keyorcode) === 'string') {
    n.key = keyorcode;
  } else if (typeof (keyorcode) === 'number') {
    n.key = String.fromCharCode(keyorcode);
  }
  n.timestamp = time;
  n.down = true;
  this.initializeEvent(n, eventprops);
  diagram.lastInput = n;
  diagram.currentTool.doKeyDown();
};
 
/**
* Simulate a key up event.
* @this {Robot}
* @param {string|number} keyorcode
* @param {number=} time the timestamp of the simulated event, in milliseconds; default zero
* @param {object=} eventprops an optional argument providing properties for the InputEvent.
*/
Robot.prototype.keyUp = function(keyorcode, time, eventprops) {
  if (typeof keyorcode !== "string" && typeof keyorcode !== "number") throw new Error("Robot.keyUp first arg must be a string or a number");
  if (time === undefined) time = 0;
 
  var diagram = this.diagram;
  if (!diagram.isEnabled) return;
 
  var n = diagram.lastInput.copy();
  n.diagram = diagram;
  if (typeof (keyorcode) === 'string') {
    n.key = keyorcode;
  } else if (typeof (keyorcode) === 'number') {
    n.key = String.fromCharCode(keyorcode);
  }
  n.timestamp = time;
  n.up = true;
  this.initializeEvent(n, eventprops);
  diagram.lastInput = n;
  diagram.currentTool.doKeyUp();
};
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/RotateMultipleTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/RotateMultipleTool.js

Statements: 3.85% (3 / 78)      Branches: 0% (0 / 35)      Functions: 0% (0 / 9)      Lines: 4.23% (3 / 71)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161                              1                   2                                                                                                 1                                                                                                                                                                            
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
/**
* @constructor
* @extends RotatingTool
* @class
* A custom tool for rotating multiple objects at a time. When more than one
* part is selected, rotates all parts, revolving them about their collective center.
* If the control key is held down during rotation, rotates all parts individually.
* <p>
* Caution: this only works for Groups that do *not* have a Placeholder.
*/
function RotateMultipleTool() {
  go.RotatingTool.call(this);
  this.name = "RotateMultiple";
  // holds references to all selected non-Link Parts and their offset & angles
  this.initialInfo = null;
  // initial angle when rotating as a whole
  this.initialAngle = 0;
  // rotation point of selection
  this.centerPoint = null;
 }
go.Diagram.inherit(RotateMultipleTool, go.RotatingTool);
 
/**
* Calls RotatingTool.doActivate, and then remembers the center point of the collection,
* and the initial distances and angles of selected parts to the center.
* @this {RotateMultipleTool}
*/
RotateMultipleTool.prototype.doActivate = function() {
  go.RotatingTool.prototype.doActivate.call(this);
  var diagram = this.diagram;
  // center point of the collection
  this.centerPoint = diagram.computePartsBounds(diagram.selection).center;
 
  // remember the angle relative to the center point when rotating the whole collection
  this.initialAngle = this.centerPoint.directionPoint(diagram.lastInput.documentPoint);
 
  // remember initial angle and distance for each Part
  var infos = new go.Map(go.Part, PartInfo);
  var tool = this;
  diagram.selection.each(function(part) {
    tool.walkTree(part, infos);
  });
  this.initialInfo = infos;
}
 
/**
* @ignore
* @param {Part} part
* @param {Map} infos
*/
RotateMultipleTool.prototype.walkTree = function(part, infos) {
  if (part === null || part instanceof go.Link) return;
  // distance from centerPoint to locationSpot of part
  var dist = Math.sqrt(this.centerPoint.distanceSquaredPoint(part.location));
  // calculate initial relative angle
  var dir = this.centerPoint.directionPoint(part.location);
  // saves part-angle combination in array
  infos.add(part, new PartInfo(dir, dist, part.rotateObject.angle));
  // recurse into Groups
  if (part instanceof go.Group) {
    var it = part.memberParts.iterator;
    while (it.next()) this.walkTree(it.value, infos);
  }
};
 
/**
* @ignore
* Internal class that remembers a Part's offset & angle.
*/
function PartInfo(placementAngle, distance, rotationAngle) {
  this.placementAngle = placementAngle * (Math.PI / 180);  // in radians
  this.distance = distance;
  this.rotationAngle = rotationAngle;  // in degrees
}
 
/**
* Clean up any references to Parts.
* @this {RotateMultipleTool}
*/
RotateMultipleTool.prototype.doDeactivate = function() {
  this.initialInfo = null;
  go.RotatingTool.prototype.doDeactivate.call(this);
};
 
/**
* Overrides rotatingTool.rotate to rotate all selected objects about their collective center.
* When the control key is held down while rotating, all selected objects are rotated individually.
* @this {RotateMultipleTool}
* @param {number} newangle
*/
RotateMultipleTool.prototype.rotate = function(newangle) {
  var diagram = this.diagram;
  var e = diagram.lastInput;
  // when rotating individual parts, remember the original angle difference
  var angleDiff = newangle - this.adornedObject.part.rotateObject.angle;
  var tool = this;
  this.initialInfo.each(function(kvp) {
    var part = kvp.key;
    if (part instanceof go.Link) return; // only Nodes and simple Parts
    var partInfo = kvp.value;
    // rotate every selected non-Link Part
    // find information about the part set in RotateMultipleTool.initialInformation
    if (e.control || e.meta) {
      if (tool.adornedObject.part === part) {
        part.rotateObject.angle = newangle;
      } else {
        part.rotateObject.angle += angleDiff;
      }
    } else {
      var radAngle = newangle * (Math.PI / 180); // converts the angle traveled from degrees to radians
      // calculate the part's x-y location relative to the central rotation point
      var offsetX = partInfo.distance * Math.cos(radAngle + partInfo.placementAngle);
      var offsetY = partInfo.distance * Math.sin(radAngle + partInfo.placementAngle);
      // move part
      part.location = new go.Point(tool.centerPoint.x + offsetX, tool.centerPoint.y + offsetY);
      // rotate part
      part.rotateObject.angle = partInfo.rotationAngle + newangle;
    }
  });
}
 
/**
* This override needs to calculate the desired angle with different rotation points,
* depending on whether we are rotating the whole selection as one, or Parts individually.
* @this {RotateMultipleTool}
* @param {Point} newPoint in document coordinates
*/
RotateMultipleTool.prototype.computeRotate = function(newPoint) {
  var diagram = this.diagram;
  var angle;
  var e = diagram.lastInput;
  if (e.control || e.meta) {  // relative to the center of the Node whose handle we are rotating
    var part = this.adornedObject.part;
    var rotationPoint = part.getDocumentPoint(part.locationSpot);
    angle = rotationPoint.directionPoint(newPoint);
  } else {  // relative to the center of the whole selection
    angle = this.centerPoint.directionPoint(newPoint) - this.initialAngle;
  }
  if (angle >= 360) angle -= 360;
  else if (angle < 0) angle += 360;
  var interval = Math.min(Math.abs(this.snapAngleMultiple), 180);
  var epsilon = Math.min(Math.abs(this.snapAngleEpsilon), interval / 2);
  // if it's close to a multiple of INTERVAL degrees, make it exactly so
  if (!diagram.lastInput.shift && interval > 0 && epsilon > 0) {
    if (angle % interval < epsilon) {
      angle = Math.floor(angle / interval) * interval;
    } else if (angle % interval > interval - epsilon) {
      angle = (Math.floor(angle / interval) + 1) * interval;
    }
    if (angle >= 360) angle -= 360;
    else if (angle < 0) angle += 360;
  }
  return angle;
};
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/RoundedRectangles.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/RoundedRectangles.js

Statements: 3.85% (1 / 26)      Branches: 0% (0 / 12)      Functions: 0% (0 / 2)      Lines: 4.17% (1 / 24)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55                2                                                                                            
'use strict';
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// This file holds the definitions of two useful figures: "RoundedTopRectangle" and "RoundedBottomRectangle".
// These are demonstrated at ../samples/twoHalves.html and ../samples/roundedGroups.html.
 
go.Shape.defineFigureGenerator("RoundedTopRectangle", function (shape, w, h) {
  // this figure takes one parameter, the size of the corner
  var p1 = 5;  // default corner size
  if (shape !== null) {
    var param1 = shape.parameter1;
    if (!isNaN(param1) && param1 >= 0) p1 = param1;  // can't be negative or NaN
  }
  p1 = Math.min(p1, w / 2);
  p1 = Math.min(p1, h / 2);  // limit by whole height or by half height?
  var geo = new go.Geometry();
  // a single figure consisting of straight lines and quarter-circle arcs
  geo.add(new go.PathFigure(0, p1)
    .add(new go.PathSegment(go.PathSegment.Arc, 180, 90, p1, p1, p1, p1))
    .add(new go.PathSegment(go.PathSegment.Line, w - p1, 0))
    .add(new go.PathSegment(go.PathSegment.Arc, 270, 90, w - p1, p1, p1, p1))
    .add(new go.PathSegment(go.PathSegment.Line, w, h))
    .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()));
  // don't intersect with two top corners when used in an "Auto" Panel
  geo.spot1 = new go.Spot(0, 0, 0.3 * p1, 0.3 * p1);
  geo.spot2 = new go.Spot(1, 1, -0.3 * p1, 0);
  return geo;
});
 
go.Shape.defineFigureGenerator("RoundedBottomRectangle", function (shape, w, h) {
  // this figure takes one parameter, the size of the corner
  var p1 = 5;  // default corner size
  if (shape !== null) {
    var param1 = shape.parameter1;
    if (!isNaN(param1) && param1 >= 0) p1 = param1;  // can't be negative or NaN
  }
  p1 = Math.min(p1, w / 2);
  p1 = Math.min(p1, h / 2);  // limit by whole height or by half height?
  var geo = new go.Geometry();
  // a single figure consisting of straight lines and quarter-circle arcs
  geo.add(new go.PathFigure(0, 0)
    .add(new go.PathSegment(go.PathSegment.Line, w, 0))
    .add(new go.PathSegment(go.PathSegment.Line, w, h - p1))
    .add(new go.PathSegment(go.PathSegment.Arc, 0, 90, w - p1, h - p1, p1, p1))
    .add(new go.PathSegment(go.PathSegment.Line, p1, h))
    .add(new go.PathSegment(go.PathSegment.Arc, 90, 90, p1, h - p1, p1, p1).close()));
  // don't intersect with two bottom corners when used in an "Auto" Panel
  geo.spot1 = new go.Spot(0, 0, 0.3 * p1, 0);
  geo.spot2 = new go.Spot(1, 1, -0.3 * p1, -0.3 * p1);
  return geo;
});
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/RowResizingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/RowResizingTool.js

Statements: 1.31% (2 / 153)      Branches: 0% (0 / 70)      Functions: 0% (0 / 19)      Lines: 1.46% (2 / 137)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295                        1                                             2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom Tool for resizing each row of a named Table Panel in a selected Part.
 
/**
* @constructor
* @extends Tool
* @class
*/
function RowResizingTool() {
	go.Tool.call(this);
	this.name = "RowResizing";
 
	var h = new go.Shape();
  h.geometryString = "M0 0 H14 M0 2 H14";
  h.desiredSize = new go.Size(14, 2);
  h.cursor = "row-resize";
  h.geometryStretch = go.GraphObject.None;
  h.background = "rgba(255,255,255,0.5)";
  h.stroke = "rgba(30,144,255,0.5)";
  /** @type {GraphObject} */
	this._handleArchetype = h;
 
  /** @type {string} */
	this._tableName = "TABLE";
 
  // internal state
  /** @type {GraphObject} */
	this._handle = null;
  /** @type {Panel} */
	this._adornedTable = null;
}
go.Diagram.inherit(RowResizingTool, go.Tool);
 
 
/*
* A small GraphObject used as a resize handle for each row.
* This tool expects that this object's {@link GraphObject#desiredSize} (a.k.a width and height) has been set to real numbers.
* @name RowResizingTool#handleArchetype 
* @function.
* @return {GraphObject}
*/
Object.defineProperty(RowResizingTool.prototype, "handleArchetype", {
  get: function() { return this._handleArchetype; },
  set: function(value) { this._handleArchetype = value; }
});
 
/*
* The name of the Table Panel to be resized, by default the name "TABLE".
* @name RowResizingTool#tableName
* @function.
* @return {string}
*/
Object.defineProperty(RowResizingTool.prototype, "tableName", {
  get: function() { return this._tableName; },
  set: function(value) { this._tableName = value; }
});
 
/*
* This read-only property returns the {@link GraphObject} that is the tool handle being dragged by the user.
* This will be contained by an {@link Adornment} whose category is "RowResizing".
* Its {@link Adornment#adornedObject} is the same as the {@link #adornedTable}.
* @name RowResizingTool#handle
* @function.
* @return {GraphObject}
*/
Object.defineProperty(RowResizingTool.prototype, "handle", {
  get: function() { return this._handle; }
});
 
/*
* Gets the {@link Panel} of type {@link Panel#Table} whose rows may be resized.
* This must be contained within the selected Part.
* @name RowResizingTool#adornedTable
* @function.
* @return {Panel}
*/
Object.defineProperty(RowResizingTool.prototype, "adornedTable", {
  get: function() { return this._adornedTable; }
});
 
 
/**
* Show an {@link Adornment} with a resize handle at each row.
* Don't show anything if {@link #tableName} doesn't identify a {@link Panel}
* that has a {@link Panel#type} of type {@link Panel#Table}.
* @this {RowResizingTool}
* @param {Part} part the part.
*/
RowResizingTool.prototype.updateAdornments = function(part) {
  if (part === null || part instanceof go.Link) return;  // this tool never applies to Links
  if (part.isSelected && !this.diagram.isReadOnly) {
    var selelt = part.findObject(this.tableName);
    if (selelt instanceof go.Panel && selelt.actualBounds.isReal() && selelt.isVisibleObject() &&
        part.actualBounds.isReal() && part.isVisible() &&
        selelt.type === go.Panel.Table) {
      var table = selelt;
      var adornment = part.findAdornment(this.name);
      if (adornment === null) {
        adornment = this.makeAdornment(table);
        part.addAdornment(this.name, adornment);
      }
      if (adornment !== null) {
        var pad = table.padding;
        var numrows = table.rowCount;
        // update the position/alignment of each handle
        adornment.elements.each(function(h) {
          if (!h.pickable) return;
          var rowdef = table.getRowDefinition(h.row);
          var hgt = rowdef.actual;
          if (hgt > 0) hgt = rowdef.total;
          var sep = 0;
          // find next non-zero-height row's separatorStrokeWidth
          var idx = h.row + 1;
          while (idx < numrows && table.getRowDefinition(idx).actual === 0) idx++;
          if (idx < numrows) {
            sep = table.getRowDefinition(idx).separatorStrokeWidth;
            if (isNaN(sep)) sep = table.defaultRowSeparatorStrokeWidth;
          }
          h.alignment = new go.Spot(0, 0, pad.left + h.width/2, pad.top + rowdef.position + hgt + sep/2);
        });
        adornment.locationObject.desiredSize = table.actualBounds.size;
        adornment.location = table.getDocumentPoint(adornment.locationSpot);
        adornment.angle = table.getDocumentAngle();
        return;
      }
    }
  }
  part.removeAdornment(this.name);
};
 
/*
* @this {RowResizingTool}
* @param {Panel} table the Table Panel whose rows may be resized
* @return {Adornment}
*/
RowResizingTool.prototype.makeAdornment = function(table) {
  // the Adornment is a Spot Panel holding resize handles
  var adornment = new go.Adornment();
  adornment.category = this.name;
  adornment.adornedObject = table;
  adornment.type = go.Panel.Spot;
  adornment.locationObjectName = "BLOCK";
  // create the "main" element of the Spot Panel
  var block = new go.TextBlock();  // doesn't matter much what this is
  block.name = "BLOCK";
  block.pickable = false;  // it's transparent and not pickable
  adornment.add(block);
  // now add resize handles for each row
  for (var i = 0; i < table.rowCount; i++) {
    var rowdef = table.getRowDefinition(i);
    adornment.add(this.makeHandle(table, rowdef));
  }
  return adornment;
};
 
/*
* @this {RowResizingTool}
* @param {Panel} table the Table Panel whose rows may be resized
* @param {RowRowDefinition} rowdef the row definition to be resized
* @return a copy of the {@link #handleArchetype}
*/
RowResizingTool.prototype.makeHandle = function(table, rowdef) {
  var h = this.handleArchetype;
  if (h === null) return null;
  var c = h.copy();
  c.row = rowdef.index;
  return c;
};
 
 
/*
* This predicate is true when there is a resize handle at the mouse down point.
* @this {RowResizingTool}
* @return {boolean}
*/
RowResizingTool.prototype.canStart = function() {
  if (!this.isEnabled) return false;
 
  var diagram = this.diagram;
  if (diagram === null || diagram.isReadOnly) return false;
  if (!diagram.lastInput.left) return false;
  var h = this.findToolHandleAt(diagram.firstInput.documentPoint, this.name);
  return (h !== null);
};
 
/**
* @this {RowResizingTool}
*/
RowResizingTool.prototype.doActivate = function() {
  var diagram = this.diagram;
  if (diagram === null) return;
  this._handle = this.findToolHandleAt(diagram.firstInput.documentPoint, this.name);
  if (this.handle === null) return;
  var panel = this.handle.part.adornedObject;
  if (!panel || panel.type !== go.Panel.Table) return;
  this._adornedTable = panel;
  diagram.isMouseCaptured = true;
  this.startTransaction(this.name);
  this.isActive = true;
};
 
/**
* @this {RowResizingTool}
*/
RowResizingTool.prototype.doDeactivate = function() {
  this.stopTransaction();
  this._handle = null;
  this._adornedTable = null;
  var diagram = this.diagram;
  if (diagram !== null) diagram.isMouseCaptured = false;
  this.isActive = false;
};
 
/**
* @this {RowResizingTool}
*/
RowResizingTool.prototype.doMouseMove = function() {
  var diagram = this.diagram;
  if (this.isActive && diagram !== null) {
    var newpt = this.computeResize(diagram.lastInput.documentPoint);
    this.resize(newpt);
  }
};
 
/**
* @this {RowResizingTool}
*/
RowResizingTool.prototype.doMouseUp = function() {
  var diagram = this.diagram;
  if (this.isActive && diagram !== null) {
    var newpt = this.computeResize(diagram.lastInput.documentPoint);
    this.resize(newpt);
    this.transactionResult = this.name;  // success
  }
  this.stopTool();
};
 
/**
* This should change the {@link RowRowDefinition#height} of the row being resized
* to a value corresponding to the given mouse point.
* @expose
* @this {RowResizingTool}
* @param {Point} newPoint the value of the call to {@link #computeResize}.
*/
RowResizingTool.prototype.resize = function(newPoint) {
  var table = this.adornedTable;
  var pad = table.padding;
  var numrows = table.rowCount;
  var locpt = table.getLocalPoint(newPoint);
  var h = this.handle;
  var rowdef = table.getRowDefinition(h.row);
  var sep = 0;
  var idx = h.row + 1;
  while (idx < numrows && table.getRowDefinition(idx).actual === 0) idx++;
  if (idx < numrows) {
    sep = table.getRowDefinition(idx).separatorStrokeWidth;
    if (isNaN(sep)) sep = table.defaultRowSeparatorStrokeWidth;
  }
  rowdef.height = Math.max(0, locpt.y - pad.top - rowdef.position - (rowdef.total - rowdef.actual) - sep/2);
};
 
 
/**
* This can be overridden in order to customize the resizing process.
* @expose
* @this {RowResizingTool}
* @param {Point} p the point where the handle is being dragged.
* @return {Point}
*/
RowResizingTool.prototype.computeResize = function(p) {
  return p;
};
 
/**
* Pressing the Delete key removes any row width setting and stops this tool.
* @this {RowResizingTool}
*/
RowResizingTool.prototype.doKeyDown = function() {
  if (!this.isActive) return;
  var e = this.diagram.lastInput;
  if (e.key === 'Del' || e.key === '\t') {  // remove height setting
    var rowdef = this.adornedTable.getRowDefinition(this.handle.row);
    rowdef.height = NaN;
    this.transactionResult = this.name;  // success
    this.stopTool();
  } else {
    go.Tool.prototype.doKeyDown.call(this);
  }
};
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/ScrollingTable.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/ScrollingTable.js

Statements: 9.8% (5 / 51)      Branches: 0% (0 / 28)      Functions: 0% (0 / 10)      Lines: 11.36% (5 / 44)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130                        2     1               1                         1                                               1                                                                                                                                          
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A "ScrollingTable" Panel
 
// This also defines an "AutoRepeatButton" Panel,
// which is used by the scrollbar in the "ScrollingTable" Panel.
 
// This defines a custom "Button" that automatically repeats its click
// action when the user holds down the mouse.
go.GraphObject.defineBuilder("AutoRepeatButton", function(args) {
  var $ = go.GraphObject.make;
  // some internal helper functions for auto-repeating
  function delayClicking(e, obj) {
    endClicking(e, obj);
    if (obj.click) {
      obj._timer =
        setTimeout(function() { repeatClicking(e, obj); },
                   500);  // wait 0.5 seconds before starting clicks
    }
  }
  function repeatClicking(e, obj) {
    if (obj._timer) clearTimeout(obj._timer);
    if (obj.click) {
      obj._timer =
        setTimeout(function() {
                     if (obj.click) {
                       (obj.click)(e, obj);
                       repeatClicking(e, obj);
                     }
                   },
                   100);  // 0.1 seconds between clicks
    }
  }
  function endClicking(e, obj) {
    if (obj._timer) {
      clearTimeout(obj._timer);
      obj._timer = undefined;
    }
  }
 
  return $("Button",
           { actionDown: delayClicking, actionUp: endClicking });
});
 
// Create a scrolling Table Panel, whose name is given as the optional first argument.
// If not given the name defaults to "TABLE".
// Example use:
//   $("ScrollingTable", "TABLE",
//     new go.Binding("TABLE.itemArray", "someArrayProperty"),
//     ...)
// Note that if you have more than one of these in a Part,
// you'll want to make sure each one has a unique name.
go.GraphObject.defineBuilder("ScrollingTable", function(args) {
  var $ = go.GraphObject.make;
  var tablename = go.GraphObject.takeBuilderArgument(args, "TABLE");
 
  // an internal helper function for actually performing a scrolling operation
  function incrTableIndex(obj, i) {
    var diagram = obj.diagram;
    if (diagram !== null) diagram.startTransaction("scroll");
    var table = obj.panel.panel.panel.findObject(tablename);
    if (i === +Infinity || i === -Infinity) {  // page up or down
      var tabh = table.actualBounds.height;
      var rowh = table.elt(table.topIndex).actualBounds.height;  // assume each row has same height?
      if (i === +Infinity) {
        i = Math.max(1, Math.ceil(tabh / rowh) - 1);
      } else {
        i = -Math.max(1, Math.ceil(tabh / rowh) - 1);
      }
    }
    var idx = table.topIndex + i;
    if (idx < 0) idx = 0;
    else if (idx >= table.rowCount - 1) idx = table.rowCount - 1;
    table.topIndex = idx;
    var up = table.panel.findObject("UP");
    if (up) up.visible = (idx > 0);
    var down = table.panel.findObject("DOWN");
    if (down) down.visible = (idx < table.rowCount - 1);
    if (diagram !== null) diagram.commitTransaction("scroll");
  }
 
  return $(go.Panel, "Table",
 
            // this actually holds the item elements
            $(go.Panel, "Table",
              {
                name: tablename,
                column: 0,
                stretch: go.GraphObject.Fill,
                background: "whitesmoke",
                rowSizing: go.RowColumnDefinition.None,
                defaultAlignment: go.Spot.Top
              }),
 
            // this is the scrollbar
            $(go.RowColumnDefinition,
              { column: 1, sizing: go.RowColumnDefinition.None }),
            $(go.Panel, "Table",
              { column: 1, stretch: go.GraphObject.Vertical, background: "#DDDDDD" },
              // the scroll up button
              $("AutoRepeatButton",
                {
                  row: 0,
                  alignment: go.Spot.Top,
                  "ButtonBorder.figure": "Rectangle",
                  "ButtonBorder.fill": "lightgray",
                  click: function(e, obj) { incrTableIndex(obj, -1); }
                },
                $(go.Shape, "TriangleUp",
                  { stroke: null, desiredSize: new go.Size(6, 6) })),
              // (someday implement a thumb here and support dragging to scroll)
              // the scroll down button
              $("AutoRepeatButton",
                {
                  row: 3,
                  alignment: go.Spot.Bottom,
                  "ButtonBorder.figure": "Rectangle",
                  "ButtonBorder.fill": "lightgray",
                  click: function(e, obj) { incrTableIndex(obj, +1); }
                },
                $(go.Shape, "TriangleDown",
                  { stroke: null, desiredSize: new go.Size(6, 6) }))
            )
         );
});
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/SectorReshapingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/SectorReshapingTool.js

Statements: 1.82% (2 / 110)      Branches: 0% (0 / 57)      Functions: 0% (0 / 14)      Lines: 2% (2 / 100)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210                                      1               2                                                                                                                                                                                                                                                                                                                                                                            
"use strict"
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// The SectorReshapingTool shows three handles:
// two for changing the angles of the sides of the filled sector,
// and one for controlling the diameter of the sector.
 
// This depends on there being three data properties, "angle", "sweep", and "radius",
// that hold the needed information to be able to reproduce the sector.
 
/**
* This SectorReshapingTool class allows for the user to interactively modify the angles of a "pie"-shaped sector of a circle.
* When a node is selected, this shows two handles for changing the angles of the sides of the sector and one handle for changing the radius.
* @constructor
* @extends Tool
* @class
*/
function SectorReshapingTool() {
  go.Tool.call(this);
  this.name = "SectorReshaping";
  this._handle = null;
  this._originalRadius = 0;
  this._originalAngle = 0;
  this._originalSweep = 0;
}
go.Diagram.inherit(SectorReshapingTool, go.Tool);
 
// these are the names of the data properties to read and write
SectorReshapingTool.radiusProperty = "radius";
SectorReshapingTool.angleProperty = "angle";
SectorReshapingTool.sweepProperty = "sweep";
 
/**
* This tool can only start if Diagram.allowReshape is true and the mouse-down event
* is at a tool handle created by this tool.
* @override
* @this {SectorReshapingTool}
*/
SectorReshapingTool.prototype.canStart = function() {
  if (!this.isEnabled) return false;
  var diagram = this.diagram;
  if (diagram === null || diagram.isReadOnly) return false;
  if (!diagram.allowReshape) return false;
  var h = this.findToolHandleAt(diagram.firstInput.documentPoint, this.name);
  return (h !== null);
};
 
/**
* If the Part is selected, show two angle-changing tool handles and one radius-changing tool handle.
* @override
* @this {SectorReshapingTool}
* @param {Part} part
*/
SectorReshapingTool.prototype.updateAdornments = function(part) {
  var data = part.data;
  if (part.isSelected && data !== null && this.diagram !== null && !this.diagram.isReadOnly) {
    var ad = part.findAdornment(this.name);
    if (ad === null) {
      var $ = go.GraphObject.make;
      ad =
        $(go.Adornment, "Spot",
          $(go.Placeholder),
          $(go.Shape, "Diamond",
            { name: "RADIUS", fill: "lime", width: 10, height: 10, cursor: "move" },
            new go.Binding("alignment", "", function(data) {
              var angle = SectorReshapingTool.getAngle(data);
              var sweep = SectorReshapingTool.getSweep(data);
              var p = new go.Point(0.5, 0).rotate(angle + sweep / 2);
              return new go.Spot(0.5 + p.x, 0.5 + p.y);
            })),
          $(go.Shape, "Circle",
            { name: "ANGLE", fill: "lime", width: 8, height: 8, cursor: "move" },
            new go.Binding("alignment", "", function(data) {
              var angle = SectorReshapingTool.getAngle(data);
              var p = new go.Point(0.5, 0).rotate(angle);
              return new go.Spot(0.5 + p.x, 0.5 + p.y);
            })),
          $(go.Shape, "Circle",
            { name: "SWEEP", fill: "lime", width: 8, height: 8, cursor: "move" },
            new go.Binding("alignment", "", function(data) {
              var angle = SectorReshapingTool.getAngle(data);
              var sweep = SectorReshapingTool.getSweep(data);
              var p = new go.Point(0.5, 0).rotate(angle + sweep);
              return new go.Spot(0.5 + p.x, 0.5 + p.y);
            }))
        );
      ad.adornedObject = part.locationObject;
      part.addAdornment(this.name, ad);
    }
  } else {
    part.removeAdornment(this.name);
  }
}
 
/**
* Remember the original angles and radius and start a transaction.
* @override
* @this {SectorReshapingTool}
*/
SectorReshapingTool.prototype.doActivate = function() {
  var diagram = this.diagram;
  if (diagram === null) return;
  this._handle = this.findToolHandleAt(diagram.firstInput.documentPoint, this.name);
  if (this._handle === null) return;
  var part = this._handle.part.adornedPart;
  if (part === null || part.data === null) return;
 
  var data = part.data;
  this._originalRadius = SectorReshapingTool.getRadius(data);
  this._originalAngle = SectorReshapingTool.getAngle(data);
  this._originalSweep = SectorReshapingTool.getSweep(data);
 
  this.startTransaction(this.name);
  this.isActive = true;
}
 
/**
* Stop the transaction.
* @override
* @this {SectorReshapingTool}
*/
SectorReshapingTool.prototype.doDeactivate = function() {
  this.stopTransaction();
 
  this._handle = null;
  this.isActive = false;
};
 
/**
* Restore the original angles and radius and then stop this tool.
* @override
* @this {SectorReshapingTool}
*/
SectorReshapingTool.prototype.doCancel = function() {
  if (this._handle !== null && this.diagram !== null) {
    var part = this._handle.part.adornedPart;
    if (part !== null) {
      var model = this.diagram.model;
      model.setDataProperty(part.data, SectorReshapingTool.radiusProperty, this._originalRadius);
      model.setDataProperty(part.data, SectorReshapingTool.angleProperty, this._originalAngle);
      model.setDataProperty(part.data, SectorReshapingTool.sweepProperty, this._originalSweep);
    }
  }
  this.stopTool();
};
 
/**
* Depending on the current handle being dragged, update the "radius", the "angle", or the "sweep"
* properties on the model data.
* Those property names are currently parameterized as static members of SectorReshapingTool.
* @override
* @this {SectorReshapingTool}
*/
SectorReshapingTool.prototype.doMouseMove = function() {
  var diagram = this.diagram;
  if (this.isActive && diagram !== null) {
    var h = this._handle;
    var center = h.part.adornedObject.getDocumentPoint(go.Spot.Center);
    var node = h.part.adornedPart;
    var mouse = diagram.lastInput.documentPoint;
    if (h.name === "RADIUS") {
      var dst = Math.sqrt(center.distanceSquaredPoint(mouse));
      diagram.model.setDataProperty(node.data, SectorReshapingTool.radiusProperty, dst);
    } else if (h.name === "ANGLE") {
      var dir = center.directionPoint(mouse);
      diagram.model.setDataProperty(node.data, SectorReshapingTool.angleProperty, dir);
    } else if (h.name === "SWEEP") {
      var dir = center.directionPoint(mouse);
      var ang = SectorReshapingTool.getAngle(node.data);
      var swp = (dir - ang + 360) % 360;
      diagram.model.setDataProperty(node.data, SectorReshapingTool.sweepProperty, swp);
    }
  }
};
 
/**
* Finish the transaction and stop the tool.
* @override
* @this {SectorReshapingTool}
*/
SectorReshapingTool.prototype.doMouseUp = function() {
  var diagram = this.diagram;
  if (this.isActive && diagram !== null) {
    this.transactionResult = this.name;  // successful finish
  }
  this.stopTool();
};
 
// static functions for getting data
SectorReshapingTool.getRadius = function(data) {
  var radius = data[SectorReshapingTool.radiusProperty];
  if (!(typeof radius === "number") || isNaN(radius) || radius <= 0) radius = 50;
  return radius;
}
 
SectorReshapingTool.getAngle = function(data) {
  var angle = data[SectorReshapingTool.angleProperty];
  if (!(typeof angle === "number") || isNaN(angle)) angle = 0; else angle = angle % 360;
  return angle;
}
 
SectorReshapingTool.getSweep = function(data) {
  var sweep = data[SectorReshapingTool.sweepProperty];
  if (!(typeof sweep === "number") || isNaN(sweep)) sweep = 360;
  return sweep;
}
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/SerpentineLayout.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/SerpentineLayout.js

Statements: 2.2% (2 / 91)      Branches: 0% (0 / 42)      Functions: 0% (0 / 7)      Lines: 2.35% (2 / 85)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181                                    1           2                                                                                                                                                                                                                                                                                                                        
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom Layout that lays out a chain of nodes in a snake-like fashion
 
/**
* @constructor
* @extends Layout
* @class
* This layout assumes the graph is a chain of Nodes,
* positioning nodes in horizontal rows back and forth, alternating between left-to-right
* and right-to-left within the {@link #wrap} limit.
* {@link #spacing} controls the distance between nodes.
* <p/>
* When this layout is the Diagram.layout, it is automatically invalidated when the viewport changes size.
*/
function SerpentineLayout() {
  go.Layout.call(this);
  this.isViewportSized = true;
  this._spacing = new go.Size(30, 30);
  this._wrap = NaN;
}
go.Diagram.inherit(SerpentineLayout, go.Layout);
 
/**
* @ignore
* Copies properties to a cloned Layout.
* @this {SerpentineLayout}
* @param {Layout} copy
* @override
*/
SerpentineLayout.prototype.cloneProtected = function(copy) {
  go.Layout.prototype.cloneProtected.call(this, copy);
  copy._spacing = this._spacing;
  copy._wrap = this._wrap;
};
 
/**
* This method actually positions all of the Nodes, assuming that the ordering of the nodes
* is given by a single link from one node to the next.
* This respects the {@link #spacing} and {@link #wrap} properties to affect the layout.
* @this {SerpentineLayout}
* @param {Diagram|Group|Iterable} coll the collection of Parts to layout.
*/
SerpentineLayout.prototype.doLayout = function(coll) {
  var diagram = this.diagram;
  coll = this.collectParts(coll);
 
  var root = null;
  // find a root node -- one without any incoming links
  var it = coll.iterator;
  while (it.next()) {
    var n = it.value;
    if (!(n instanceof go.Node)) continue;
    if (root === null) root = n;
    if (n.findLinksInto().count === 0) {
      root = n;
      break;
    }
  }
  // couldn't find a root node
  if (root === null) return;
 
  var spacing = this.spacing;
 
  // calculate the width at which we should start a new row
  var wrap = this.wrap;
  if (diagram !== null && isNaN(wrap)) {
    if (this.group === null) {  // for a top-level layout, use the Diagram.viewportBounds
      var pad = diagram.padding;
      wrap = Math.max(spacing.width * 2, diagram.viewportBounds.width - 24 - pad.left - pad.right);
    } else {
      wrap = 1000; // provide a better default value?
    }
  }
 
  // implementations of doLayout that do not make use of a LayoutNetwork
  // need to perform their own transactions
  if (diagram !== null) diagram.startTransaction("Serpentine Layout");
 
  // start on the left, at Layout.arrangementOrigin
  var x = this.arrangementOrigin.x;
  var rowh = 0;
  var y = this.arrangementOrigin.y;
  var increasing = true;
  var node = root;
  while (node !== null) {
    var b = node.actualBounds;
    // get the next node, if any
    var nextlink = node.findLinksOutOf().first();
    var nextnode = (nextlink !== null ? nextlink.toNode : null);
    var nb = (nextnode !== null ? nextnode.actualBounds : new go.Rect());
    if (increasing) {
      node.move(new go.Point(x, y));
      x += b.width;
      rowh = Math.max(rowh, b.height);
      if (x + spacing.width + nb.width > wrap) {
        y += rowh + spacing.height;
        x = wrap - spacing.width;
        rowh = 0;
        increasing = false;
        if (nextlink !== null) {
          nextlink.fromSpot = go.Spot.Right;
          nextlink.toSpot = go.Spot.Right;
        }
      } else {
        x += spacing.width;
        if (nextlink !== null) {
          nextlink.fromSpot = go.Spot.Right;
          nextlink.toSpot = go.Spot.Left;
        }
      }
    } else {
      x -= b.width;
      node.move(new go.Point(x, y));
      rowh = Math.max(rowh, b.height);
      if (x - spacing.width - nb.width < 0) {
        y += rowh + spacing.height;
        x = 0;
        rowh = 0;
        increasing = true;
        if (nextlink !== null) {
          nextlink.fromSpot = go.Spot.Left;
          nextlink.toSpot = go.Spot.Left;
        }
      } else {
        x -= spacing.width;
        if (nextlink !== null) {
          nextlink.fromSpot = go.Spot.Left;
          nextlink.toSpot = go.Spot.Right;
        }
      }
    }
    node = nextnode;
  }
 
  if (diagram !== null) diagram.commitTransaction("Serpentine Layout");
};
 
// Public properties
 
/**
* Gets or sets the {@link Size} whose width specifies the horizontal space between nodes
* and whose height specifies the minimum vertical space between nodes.
* The default value is 30x30.
* @name SerpentineLayout#spacing
* @function.
* @return {Size}
*/
Object.defineProperty(SerpentineLayout.prototype, "spacing", {
  get: function() { return this._spacing; },
  set: function(val) {
    if (!(val instanceof go.Size)) throw new Error("new value for SerpentineLayout.spacing must be a Size, not: " + val);
    if (!this._spacing.equals(val)) {
      this._spacing = val;
      this.invalidateLayout();
    }
  }
});
 
/**
* Gets or sets the total width of the layout.
* The default value is NaN, which for {@link Diagram#layout}s means that it uses
* the {@link Diagram#viewportBounds}.
* @name SerpentineLayout#wrap
* @function.
* @return {number}
*/
Object.defineProperty(SerpentineLayout.prototype, "wrap", {
  get: function() { return this._wrap; },
  set: function(val) {
    if (this._wrap !== val) {
      this._wrap = val;
      this.invalidateLayout();
    }
  }
});
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/SnapLinkReshapingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/SnapLinkReshapingTool.js

Statements: 6.25% (2 / 32)      Branches: 0% (0 / 15)      Functions: 0% (0 / 8)      Lines: 7.41% (2 / 27)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93                          1                 2                                                                                                                                            
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom LinkReshapingTool that snaps dragged reshaping handles to grid points.
 
/**
* @constructor
* @extends LinkReshapingTool
* @class
* This SnapLinkReshapingTool class supports snapping reshaping handles to go to the nearest grid point.
*/
function SnapLinkReshapingTool() {
  go.LinkReshapingTool.call(this);
  /** @type {Size} */
  this._gridCellSize = new go.Size(NaN, NaN);
  /** @type {Point} */
  this._gridOrigin = new go.Point(NaN, NaN);
  /** @type {boolean} */
  this._isGridSnapEnabled = true;
}
go.Diagram.inherit(SnapLinkReshapingTool, go.LinkReshapingTool);
 
/**
* Gets or sets the {@link Size} of each grid cell to which link points will be snapped.
* The default value is NaNxNaN, which means use the {@link Diagram#grid}'s {@link Panel#gridCellSize}.
* @name SnapLinkReshapingTool#gridCellSize
* @function.
* @return {Size}
*/
Object.defineProperty(SnapLinkReshapingTool.prototype, "gridCellSize", {
  get: function() { return this._gridCellSize; },
  set: function(val) {
    if (!(val instanceof go.Size)) throw new Error("new value for SnapLinkReshapingTool.gridCellSize must be a Size, not: " + val);
    this._gridCellSize = val.copy();
  }
});
 
/**
* Gets or sets the {@link Point} origin for the grid to which link points will be snapped.
* The default value is NaN,NaN, which means use the {@link Diagram#grid}'s {@link Panel#gridOrigin}.
* @name SnapLinkReshapingTool#gridOrigin
* @function.
* @return {Point}
*/
Object.defineProperty(SnapLinkReshapingTool.prototype, "gridOrigin", {
  get: function() { return this._gridOrigin; },
  set: function(val) {
    if (!(val instanceof go.Point)) throw new Error("new value for SnapLinkReshapingTool.gridOrigin must be a Point, not: " + val);
    this._gridOrigin = val.copy();
  }
});
 
/**
* Gets or sets whether a reshape handle's position should be snapped to a grid point.
* The default value is true.
* This affects the behavior of {@link #computeReshape}.
*/
Object.defineProperty(SnapLinkReshapingTool.prototype, "isGridSnapEnabled", {
  get: function() { return this._isGridSnapEnabled; },
  set: function(val) {
    if (typeof val !== "boolean") throw new Error("new value for SnapLinkReshapingTool.isGridSnapEnabled must be a boolean, not: " + val);
    this._isGridSnapEnabled = val;
  }
});
 
/**
* @override
* Pretend while dragging a reshape handle the mouse point is at the nearest grid point,
* if {@link #isGridSnapEnabled} is true.
* This uses {@link #gridCellSize} and {@link #gridOrigin}, unless those are not real values,
* in which case this uses the {@link Diagram#grid}'s {@link Panel#gridCellSize} and {@link Panel#gridOrigin}.
* @this {SnapLinkReshapingTool}
* @param {Point} p
* @return {Point}
*/
SnapLinkReshapingTool.prototype.computeReshape = function(p) {
  var pt = p;
  if (this.isGridSnapEnabled) {
    // first, find the grid to which we should snap
    var cell = this.gridCellSize;
    var orig = this.gridOrigin;
    if (!cell.isReal() || cell.width === 0 || cell.height === 0) cell = this.diagram.grid.gridCellSize;
    if (!orig.isReal()) orig = this.diagram.grid.gridOrigin;
    // second, compute the closest grid point
    pt = p.copy().snapToGrid(orig.x, orig.y, cell.width, cell.height);
  }
  // then do whatever LinkReshapingTool would normally do as if the mouse were at that point
  return go.LinkReshapingTool.prototype.computeReshape.call(this, pt);
}
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/SpiralLayout.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/SpiralLayout.js

Statements: 2.2% (2 / 91)      Branches: 0% (0 / 48)      Functions: 0% (0 / 10)      Lines: 2.38% (2 / 84)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191                            1           2                                                                                                                                                                                                                                                                                                                                                    
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom Layout that lays out a chain of nodes in a spiral
 
/**
* @constructor
* @extends Layout
* @class
* This layout assumes the graph is a chain of Nodes,
* {@link #spacing} controls the spacing between nodes.
*/
function SpiralLayout() {
  go.Layout.call(this);
  this._radius = NaN;
  this._spacing = 10;
  this._clockwise = true;
}
go.Diagram.inherit(SpiralLayout, go.Layout);
 
/**
* @ignore
* Copies properties to a cloned Layout.
* @this {SpiralLayout}
* @param {Layout} copy
* @override
*/
SpiralLayout.prototype.cloneProtected = function(copy) {
  go.Layout.prototype.cloneProtected.call(this, copy);
  copy._radius = this._radius;
  copy._spacing = this._spacing;
  copy._clockwise = this._clockwise;
};
 
/**
* This method actually positions all of the Nodes, assuming that the ordering of the nodes
* is given by a single link from one node to the next.
* This respects the {@link #spacing} property to affect the layout.
* @this {SpiralLayout}
* @param {Diagram|Group|Iterable} coll the collection of Parts to layout.
*/
SpiralLayout.prototype.doLayout = function(coll) {
  if (this.network === null) {
    this.network = this.makeNetwork(coll);
  }
  this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin);
  var originx = this.arrangementOrigin.x;
  var originy = this.arrangementOrigin.y;
  var root = null;
  // find a root vertex -- one without any incoming edges
  var it = this.network.vertexes.iterator;
  while (it.next()) {
    var v = it.value;
    if (root === null) root = v;  // in case there are only circles
    if (v.sourceEdges.count === 0) {
      root = v;
      break;
    }
  }
  // couldn't find a root vertex
  if (root === null) {
    this.network = null;
    return;
  }
 
  var space = this.spacing;
  var cw = (this.clockwise ? 1 : -1);
  var rad = this.radius;
  if (rad <= 0 || isNaN(rad) || !isFinite(rad)) rad = this.diameter(root) / 4;
 
  // treat the root node specially: it goes in the center
  var dia = this.diameter(root);
  var angle = cw * Math.PI;
  root.centerX = originx;
  root.centerY = originy;
 
  var edge = root.destinationEdges.first();
  if (edge !== null && edge.link !== null) edge.link.curviness = cw * rad;
 
  // now locate each of the following nodes, in order, along a spiral
  var vert = (edge !== null ? edge.toVertex : null);
  while (vert !== null) {
    // involute spiral
    var cos = Math.cos(angle);
    var sin = Math.sin(angle);
    var x = rad * (cos + angle * sin);
    var y = rad * (sin - angle * cos);
    // the link might connect to a member node of a group
    if (vert.node instanceof go.Group && edge.link.toNode !== vert.node) {
      var offset = edge.link.toNode.location.copy().subtract(vert.node.location);
      x -= offset.x;
      y -= offset.y;
    }
    vert.centerX = x + originx;
    vert.centerY = y + originy;
 
    var nextedge = vert.destinationEdges.first();
    var nextvert = (nextedge !== null ? nextedge.toVertex : null);
 
    // clockwise curves want positive Link.curviness
    if (this.isRouting && nextedge !== null && nextedge.link !== null) {
      if (!isNaN(nextedge.link.curviness)) {
        var c = nextedge.link.curviness;
        nextedge.link.curviness = cw * Math.abs(c);
      }
    }
 
    // determine next node's angle
    var dia = this.diameter(vert)/2 + this.diameter(nextvert)/2;
    angle += cw * Math.atan((dia + space) / Math.sqrt(x * x + y * y));
 
    edge = nextedge;
    vert = nextvert;
  }
 
  this.updateParts();
  this.network = null;
};
 
/**
* @ignore
* Compute the effective diameter of a Node.
* @this {SpiralLayout}
* @param {LayoutVertex} v
* @return {number}
*/
SpiralLayout.prototype.diameter = function(v) {
  if (!v) return 0;
  var b = v.bounds;
  return Math.sqrt(b.width*b.width + b.height*b.height);
};
 
// Public properties
 
/**
* Gets or sets the radius distance.
* The default value is NaN.
* @name SpiralLayout#radius
* @function.
* @return {number}
*/
Object.defineProperty(SpiralLayout.prototype, "radius", {
  get: function() { return this._radius; },
  set: function(val) {
    if (typeof val !== "number") throw new Error("new value for SpiralLayout.radius must be a number, not: " + val);
    if (this._radius !== val) {
      this._radius = val;
      this.invalidateLayout();
    }
  }
});
 
/**
* Gets or sets the spacing between nodes.
* The default value is 100.
* @name SpiralLayout#spacing
* @function.
* @return {number}
*/
Object.defineProperty(SpiralLayout.prototype, "spacing", {
  get: function() { return this._spacing; },
  set: function(val) {
    if (typeof val !== "number") throw new Error("new value for SpiralLayout.spacing must be a number, not: " + val);
    if (this._spacing !== val) {
      this._spacing = val;
      this.invalidateLayout();
    }
  }
});
 
/**
* Gets or sets whether the spiral should go clockwise or counter-clockwise.
* The default value is true.
* @name SpiralLayout#clockwise
* @function.
* @return {boolean}
*/
Object.defineProperty(SpiralLayout.prototype, "clockwise", {
  get: function() { return this._clockwise; },
  set: function(val) {
    if (typeof val !== "boolean") throw new Error("new value for SpiralLayout.clockwise must be a boolean, not: " + val);
    if (this._clockwise !== val) {
      this._clockwise = val;
      this.invalidateLayout();
    }
  }
});
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/TableLayout.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/TableLayout.js

Statements: 0.41% (2 / 486)      Branches: 0% (0 / 242)      Functions: 0% (0 / 15)      Lines: 0.46% (2 / 431)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773                                                            1                     2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// This layout is patterned after the "Table" Panel layout.
 
/**
* @constructor
* @extends Layout
* @class
* This Layout positions non-Link Parts into a table according to the values of
* GraphObject.row, GraphObject.column, GraphObject.rowSpan, GraphObject.columnSpan,
* GraphObject.alignment, GraphObject.stretch.
* If the value of GraphObject.stretch is not go.GraphObject.None, the Part will be sized
* according to the available space in the cell(s).
* <p>
* You can specify constraints for whole rows or columns by calling
* getRowDefinition(row) or getColumnDefinition(col) and setting one of the following properties:
* RowColumnDefinition.alignment, RowColumnDefinition.height, RowColumnDefinition.width,
* RowColumnDefinition.maximum, RowColumnDefinition.minimum, RowColumnDefinition.stretch.
* <p>
* The defaultAlignment and defaultStretch properties apply to all parts if not specified
* on the individual Part or in the corresponding row or column definition.
* <p>
* At the current time, there is no support for separator lines
* (RowColumnDefinition.separatorStroke, separatorStrokeWidth, and separatorDashArray properties)
* nor background (RowColumnDefinition.background and coversSeparators properties).
* There is no support for RowColumnDefinition.sizing, either.
*/
function TableLayout() {
  go.Layout.call(this);
  /** @type {Spot} */
  this._defaultAlignment = go.Spot.Default;
  /** @type {EnumValue} */
  this._defaultStretch = go.GraphObject.Default;
  /** @type {Array} */
  this._rowDefs = [];
  /** @type {Array} */
  this._colDefs = [];
}
go.Diagram.inherit(TableLayout, go.Layout);
 
/** @ignore */
TableLayout.prototype.cloneProtected = function(copy) {
  go.Layout.prototype.cloneProtected.call(this, copy);
  copy._defaultAlignment = this._defaultAlignment;
  copy._defaultStretch = this._defaultStretch;
  for (var i = 0; i < this._rowDefs.length; i++) {
    var def = this._rowDefs[i];
    copy._rowDefs.push(def !== undefined ? def.copy() : def);
  }
  for (var i = 0; i < this._colDefs.length; i++) {
    var def = this._colDefs[i];
    copy._colDefs.push(def !== undefined ? def.copy() : def);
  }
};
 
/**
* Gets or sets the alignment to use by default for Parts in rows (vertically) and in columns (horizontally).
* The default value is {@link Spot#Default}.
* Setting this property does not raise any events.
* @name TableLayout#defaultAlignment
* @function.
* @return {Spot}
*/
Object.defineProperty(TableLayout.prototype, "defaultAlignment", {
  get: function() { return this._defaultAlignment; },
  set: function(val) { this._defaultAlignment = val; }
});
 
/**
* Gets or sets whether Parts should be stretched in rows (vertically) and in columns (horizontally).
* The default value is {@link GraphObject#Default}.
* Setting this property does not raise any events.
* @name TableLayout#defaultStretch
* @function.
* @return {EnumValue}
*/
Object.defineProperty(TableLayout.prototype, "defaultStretch", {
  get: function() { return this._defaultStretch; },
  set: function(val) { this._defaultStretch = val; }
});
 
/**
* Gets the {@link RowColumnDefinition} for a particular row in this TableLayout.
* If you ask for the definition of a row at or beyond the {@link #rowCount},
* it will automatically create one and return it.
* @this {TableLayout}
* @param {number} idx the non-negative zero-based integer row index.
* @return {RowColumnDefinition}
*/
TableLayout.prototype.getRowDefinition = function(idx) {
  if (idx < 0) throw new Error("Row index must be non-negative, not: " + idx);
  idx = Math.round(idx);
  var defs = this._rowDefs;
 
  var d = defs[idx];
  if (d === undefined) {
    d = new go.RowColumnDefinition();
    // .panel remains null
    d.isRow = true;
    d.index = idx;
    defs[idx] = d;
  }
  return d;
};
 
/**
* This read-only property returns the number of rows in this TableLayout.
* This value is only valid after the layout has been performed.
* @name TableLayout#rowCount
* @function.
* @return {number}
*/
Object.defineProperty(TableLayout.prototype, "rowCount", {
  get: function() { return this._rowDefs.length; }
});
 
/**
* Gets the {@link RowColumnDefinition} for a particular column in this TableLayout.
* If you ask for the definition of a column at or beyond the {@link #columnCount},
* it will automatically create one and return it.
* @this {TableLayout}
* @param {number} idx the non-negative zero-based integer column index.
* @return {RowColumnDefinition}
*/
TableLayout.prototype.getColumnDefinition = function(idx) {
  if (idx < 0) throw new Error("Column index must be non-negative, not: " + idx);
  idx = Math.round(idx);
  var defs = this._colDefs;
 
  var d = defs[idx];
  if (d === undefined) {
    d = new go.RowColumnDefinition();
    // .panel remains null
    d.isRow = false;
    d.index = idx;
    defs[idx] = d;
  }
  return d;
};
 
/**
* This read-only property returns the number of columns in this TableLayout.
* This value is only valid after the layout has been performed.
* @name TableLayout#rowCount
* @function.
* @return {number}
*/
Object.defineProperty(TableLayout.prototype, "columnCount", {
  get: function() { return this._colDefs.length; }
});
 
/**
* @ignore
* @this {TableLayout}
* @param {Part} child
* @param {number} row
* @param {number} col
* @return {EnumValue}
*/
TableLayout.prototype.getEffectiveTableStretch = function(child, row, col) {
  var effectivestretch = child.stretch;
  if (effectivestretch !== go.GraphObject.Default) return effectivestretch;
  // which directions are we stretching?
  // undefined = default
  var horizontal = undefined;
  var vertical = undefined;
  switch (row.stretch) {
    case go.GraphObject.Default:
    case go.GraphObject.Horizontal: break;
    case go.GraphObject.Vertical: vertical = true; break;
    case go.GraphObject.Fill: vertical = true; break;
  }
  switch (col.stretch) {
    case go.GraphObject.Default:
    case go.GraphObject.Vertical: break;
    case go.GraphObject.Horizontal: horizontal = true; break;
    case go.GraphObject.Fill: horizontal = true; break;
  }
 
  var str = this.defaultStretch;
  if (horizontal === undefined && (str === go.GraphObject.Horizontal || str === go.GraphObject.Fill)) {
    horizontal = true;
  } else {
    horizontal = false;
  }
  if (vertical === undefined && (str === go.GraphObject.Vertical || str === go.GraphObject.Fill)) {
    vertical = true;
  } else {
    vertical = false;
  }
  if (horizontal === true && vertical === true) return go.GraphObject.Fill;
  if (horizontal === true) return go.GraphObject.Horizontal;
  if (vertical === true) return go.GraphObject.Vertical;
  return go.GraphObject.None; // Everything else is none by default
};
 
/**
* @ignore
* @override
* @this {TableLayout}
*/
TableLayout.prototype.doLayout = function(coll) {
  this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin);
  // put all eligible Parts that are not Links into an Array
  var parts = new go.List(go.Part);
  this.collectParts(coll).each(function(p) {
    if (!(p instanceof go.Link)) {
      p.ensureBounds();
      parts.add(p);
    }
  });
 
  this.diagram.startTransaction("TableLayout");
  var union = new go.Size();
  var rowcol = this.measureTable(Infinity, Infinity, parts, union, 0, 0);
  this.arrangeTable(parts, union, rowcol);
  this.diagram.commitTransaction("TableLayout");
};
 
/**
* @ignore
* @override
* @this {TableLayout}
*/
TableLayout.prototype.measureTable = function(width, height, children, union, minw, minh) {
  var l = children.length;
  // Make the array that holds [rows][cols] of the table
  var rowcol = []; // saved (so no temp array) starts as an array of rows, will end up [row][col][cell]
  for (var i = 0; i < l; i++) {
    var child = children.elt(i);
    if (!rowcol[child.row]) {
      rowcol[child.row] = []; // make new column for this row
    }
    if (!rowcol[child.row][child.column]) {
      rowcol[child.row][child.column] = []; // new list for this cell
    }
    rowcol[child.row][child.column].push(child); // push child into right cell
  }
 
  // Reset the row/col definitions because the ones from last measure are irrelevant
  var resetCols = [];  // keep track of which columns we've already reset
 
  // Objects that span multiple columns and
  var spanners = [];
  var nosize = [];
  // These hashes are used to tally the number of rows and columns that do not have a size
  var nosizeCols = { 'count': 0 };
  var nosizeRows = { 'count': 0 };
 
  var colleft = width;
  var rowleft = height;
 
  var defs = this._rowDefs;
  l = defs.length;
  for (var i = 0; i < l; i++) {
    var def = defs[i];
    if (def !== undefined) def.actual = 0;
  }
 
  defs = this._colDefs;
  l = defs.length;
  for (var i = 0; i < l; i++) {
    var def = defs[i];
    if (def !== undefined) def.actual = 0;
  }
 
  var lrow = rowcol.length; //number of rows
  var lcol = 0;
  for (var i = 0; i < lrow; i++) {
    if (!rowcol[i]) continue;
    lcol = Math.max(lcol, rowcol[i].length); // column length in this row
  }
 
  // Go through each cell (first pass)
  var amt = 0.0;
  lrow = rowcol.length; //number of rows
  for (var i = 0; i < lrow; i++) {
    if (!rowcol[i]) continue;
    lcol = rowcol[i].length; // column length in this row
    var rowHerald = this.getRowDefinition(i);
    rowHerald.actual = 0; // Reset rows (only on first pass)
    for (var j = 0; j < lcol; j++) {
      //foreach column j in row i...
      if (!rowcol[i][j]) continue;
      var colHerald = this.getColumnDefinition(j);
      if (resetCols[j] === undefined) { // make sure we only reset these once
        colHerald.actual = 0;
        resetCols[j] = true;
      }
 
      var cell = rowcol[i][j];
      var len = cell.length;
      for (var k = 0; k < len; k++) {
        //foreach element in cell, measure
        var child = cell[k];
 
        // Skip children that span more than one row or column or do not have a set size
        var spanner = (child.rowSpan > 1 || child.columnSpan > 1);
        if (spanner) {
          spanners.push(child);
          // We used to not measure spanners twice, but now we do
          // The reason is that there may be a row whose size
          // is dictated by an object with columnSpan 2+ and vice versa
 
          // continue;
        }
 
        var marg = child.margin;
        var margw = marg.right + marg.left;
        var margh = marg.top + marg.bottom;
 
        var stretch = this.getEffectiveTableStretch(child, rowHerald, colHerald);
        var dsize = child.resizeObject.desiredSize;
        var realwidth = !(isNaN(dsize.width));
        var realheight = !(isNaN(dsize.height));
        var realsize = realwidth && realheight;
        if (!spanner && stretch !== go.GraphObject.None && !realsize) {
          if (nosizeCols[j] === undefined && (stretch === go.GraphObject.Fill || stretch === go.GraphObject.Horizontal)) {
            nosizeCols[j] = -1; nosizeCols.count++;
          }
          if (nosizeRows[i] === undefined && (stretch === go.GraphObject.Fill || stretch === go.GraphObject.Vertical)) {
            nosizeRows[i] = -1; nosizeRows.count++;
          }
          nosize.push(child);
        }
 
        if (stretch !== go.GraphObject.None) {
          var unrestrictedSize = new go.Size(NaN, NaN);
          //if (stretch !== go.GraphObject.Horizontal) unrestrictedSize.height = rowHerald.minimum;
          //if (stretch !== go.GraphObject.Vertical) unrestrictedSize.width = colHerald.minimum;
          //??? allow resizing during measure phase
          child.resizeObject.desiredSize = unrestrictedSize;
          child.ensureBounds();
        }
 
        var m = child.actualBounds;
        var mwidth = Math.max(m.width + margw, 0);
        var mheight = Math.max(m.height + margh, 0);
 
        //  Make sure the heralds have the right layout size
        //    the row/column should use the largest meausured size of any
        //    GraphObject contained, constrained by mins and maxes
        if (child.rowSpan === 1 && (realheight || stretch === go.GraphObject.None || stretch === go.GraphObject.Horizontal)) {
          var def = this.getRowDefinition(i);
          amt = Math.max(mheight - def.actual, 0);
          if (amt > rowleft) amt = rowleft;
          def.actual = def.actual + amt;
          rowleft = Math.max(rowleft - amt, 0);
        }
 
        if (child.columnSpan === 1 && (realwidth || stretch === go.GraphObject.None || stretch === go.GraphObject.Vertical)) {
          var def = this.getColumnDefinition(j);
          amt = Math.max(mwidth - def.actual, 0);
          if (amt > colleft) amt = colleft;
          def.actual = def.actual + amt;
          colleft = Math.max(colleft - amt, 0);
        }
 
      } // end cell
    } // end col
  } //end row
 
  // For objects of no desired size we allocate what is left as we go,
  // or else what is already in the column
  var totalColWidth = 0.0;
  var totalRowHeight = 0.0;
  l = this.columnCount;
  for (var i = 0; i < l; i++) {
    if (this._colDefs[i] === undefined) continue;
    totalColWidth += this.getColumnDefinition(i).actual;
  }
  l = this.rowCount;
  for (var i = 0; i < l; i++) {
    if (this._rowDefs[i] === undefined) continue;
    totalRowHeight += this.getRowDefinition(i).actual;
  }
  colleft = Math.max(width - totalColWidth, 0);
  rowleft = Math.max(height - totalRowHeight, 0);
  var originalrowleft = rowleft;
  var originalcolleft = colleft;
 
  // Determine column sizes for the yet-to-be-sized columns
  l = nosize.length;
  for (var i = 0; i < l; i++) {
    var child = nosize[i];
    var rowHerald = this.getRowDefinition(child.row);
    var colHerald = this.getColumnDefinition(child.column);
    // We want to gather the largest difference between desired and expected col/row sizes
    var mb = child.actualBounds;
    var marg = child.margin;
    var margw = marg.right + marg.left;
    var margh = marg.top + marg.bottom;
 
    if (colHerald.actual === 0 && nosizeCols[child.column] !== undefined) {
      nosizeCols[child.column] = Math.max(mb.width + margw, nosizeCols[child.column]);
    } else {
      nosizeCols[child.column] = null; // obey the column herald
    }
    if (rowHerald.actual === 0 && nosizeRows[child.row]!== undefined) {
      nosizeRows[child.row] = Math.max(mb.height + margh, nosizeRows[child.row]);
    } else {
      nosizeRows[child.row] = null; // obey the row herald
    }
  }
  // we now have the size that all these columns prefer to be
  // we also have the amount left over
  var desiredRowTotal = 0.0;
  var desiredColTotal = 0.0;
  for (i in nosizeRows) { if (i !== 'count') desiredRowTotal += nosizeRows[i] }
  for (i in nosizeCols) { if (i !== 'count') desiredColTotal += nosizeCols[i] }
 
  var allowedSize = new go.Size(); // used in stretch and span loops
 
  // Deal with objects that have a stretch
  for (var i = 0; i < l; i++) {
    var child = nosize[i];
    var rowHerald = this.getRowDefinition(child.row);
    var colHerald = this.getColumnDefinition(child.column);
 
    var w = 0.0;
    if (isFinite(colHerald.width)) {
      w = colHerald.width;
    } else {
      if (isFinite(colleft) && nosizeCols[child.column] !== null) {
        if (desiredColTotal === 0) w = colHerald.actual + colleft;
        else w = /*colHerald.actual +*/ ((nosizeCols[child.column] / desiredColTotal) * originalcolleft);
      } else {
        // Only use colHerald.actual if it was nonzero before this loop
        if (nosizeCols[child.column] !== null) w = colleft;
        else w = colHerald.actual || colleft;
        //w = nosizeCols[child.column] || colleft; // Older, less correct way
      }
      w = Math.max(0, w - colHerald.computeEffectiveSpacing());
    }
    var h = 0.0;
    if (isFinite(rowHerald.height)) {
      h = rowHerald.height;
    } else {
      if (isFinite(rowleft) && nosizeRows[child.row] !== null) {
        if (desiredRowTotal === 0) h = rowHerald.actual + rowleft;
        else h = /*rowHerald.actual +*/ ((nosizeRows[child.row] / desiredRowTotal) * originalrowleft);
      } else {
        // Only use rowHerald.actual if it was nonzero before this loop
        if (nosizeRows[child.row] !== null) h = rowleft;
        else h = rowHerald.actual || rowleft;
        //h = nosizeRows[child.row] || rowleft; // Older, less correct way
      }
      h = Math.max(0, h - rowHerald.computeEffectiveSpacing());
    }
 
    allowedSize.setTo(
      Math.max(colHerald.minimum, Math.min(w, colHerald.maximum)),
      Math.max(rowHerald.minimum, Math.min(h, rowHerald.maximum)));
 
    // Which way do we care about fill:
    var stretch = this.getEffectiveTableStretch(child, rowHerald, colHerald);
    // This used to set allowedSize height/width to Infinity,
    // but we can only set it to the current row/column space, plus rowleft/colleft values, at most.
    switch (stretch) {
      case go.GraphObject.Horizontal: // H stretch means it can be as large as its wants vertically
        allowedSize.height = Math.max(allowedSize.height, rowHerald.actual + rowleft);
        break;
      case go.GraphObject.Vertical: // vice versa
        allowedSize.width = Math.max(allowedSize.width, colHerald.actual + colleft);
        break;
    }
 
    var marg = child.margin;
    var margw = marg.right + marg.left;
    var margh = marg.top + marg.bottom;
 
    var m = child.actualBounds;
    var mwidth = Math.max(m.width + margw, 0);
    var mheight = Math.max(m.height + margh, 0);
    if (isFinite(colleft)) mwidth = Math.min(mwidth, allowedSize.width);
    if (isFinite(rowleft)) mheight = Math.min(mheight, allowedSize.height);
 
    var oldAmount = 0.0;
 
    oldAmount = rowHerald.actual;
    rowHerald.actual = Math.max(rowHerald.actual, mheight);
    amt = rowHerald.actual - oldAmount;
    rowleft = Math.max(rowleft - amt, 0);
 
    oldAmount = colHerald.actual;
    colHerald.actual = Math.max(colHerald.actual, mwidth);
    amt = colHerald.actual - oldAmount;
    colleft = Math.max(colleft - amt, 0);
  } // end no fixed size objects
 
  // Go through each object that spans multiple rows or columns
  var additionalSpan = new go.Size();
  l = spanners.length;
  for (var i = 0; i < l; i++) {
    var child = spanners[i];
    var rowHerald = this.getRowDefinition(child.row);
    var colHerald = this.getColumnDefinition(child.column);
 
    // If there's a set column width/height we don't care about the given width/height
    allowedSize.setTo(
      Math.max(colHerald.minimum, Math.min(width, colHerald.maximum)),
      Math.max(rowHerald.minimum, Math.min(height, rowHerald.maximum)));
 
    // If it is a spanner and has a fill:
    var stretch = this.getEffectiveTableStretch(child, rowHerald, colHerald);
    switch (stretch) {
      case go.GraphObject.Fill:
        if (colHerald.actual !== 0) allowedSize.width = Math.min(allowedSize.width, colHerald.actual);
        if (rowHerald.actual !== 0) allowedSize.height = Math.min(allowedSize.height, rowHerald.actual);
        break;
      case go.GraphObject.Horizontal:
        if (colHerald.actual !== 0) allowedSize.width = Math.min(allowedSize.width, colHerald.actual);
        break;
      case go.GraphObject.Vertical:
        if (rowHerald.actual !== 0) allowedSize.height = Math.min(allowedSize.height, rowHerald.actual);
        break;
    }
    // If there's a set column width/height we don't care about any of the above:
    if (isFinite(colHerald.width)) allowedSize.width = colHerald.width;
    if (isFinite(rowHerald.height)) allowedSize.height = rowHerald.height;
 
    // take into account rowSpan and columnSpan
    additionalSpan.setTo(0, 0);
    for (var n = 1; n < child.rowSpan; n++) {
      if (child.row + n >= this.rowCount) break; // if the row exists at all
      def = this.getRowDefinition(child.row + n);
      additionalSpan.height += Math.max(def.minimum, isNaN(def.size) ? def.maximum : Math.min(def.size, def.maximum));
    }
    for (var n = 1; n < child.columnSpan; n++) {
      if (child.column + n >= this.columnCount) break; // if the col exists at all
      def = this.getColumnDefinition(child.column + n);
      additionalSpan.width += Math.max(def.minimum, isNaN(def.size) ? def.maximum : Math.min(def.size, def.maximum));
    }
    allowedSize.width += additionalSpan.width;
    allowedSize.height += additionalSpan.height;
 
    var marg = child.margin;
    var margw = marg.right + marg.left;
    var margh = marg.top + marg.bottom;
    var m = child.actualBounds;
    var mwidth = Math.max(m.width + margw, 0);
    var mheight = Math.max(m.height + margh, 0);
 
    var totalRow = 0.0;
    for (var n = 0; n < child.rowSpan; n++) {
      if (child.row + n >= this.rowCount) break; // if the row exists at all
      def = this.getRowDefinition(child.row + n);
      totalRow += def.total || 0;
    }
    // def is the last row definition
    if (totalRow < mheight) {
      var roomLeft = mheight - totalRow;
      while (roomLeft > 0) { // Add the extra to the first row that allows us to
        var act = def.actual || 0;
        if (isNaN(def.height) && def.maximum > act) {
          def.actual = Math.min(def.maximum, act + roomLeft);
          if (def.actual !== act) roomLeft -= def.actual - act;
        }
        if (def.index - 1 === -1) break;
        def = this.getRowDefinition(def.index - 1);
      }
    }
 
    var totalCol = 0.0;
    for (var n = 0; n < child.columnSpan; n++) {
      if (child.column + n >= this.columnCount) break; // if the col exists at all
      def = this.getColumnDefinition(child.column + n);
      totalCol += def.total || 0;
    }
    // def is the last col definition
    if (totalCol < mwidth) {
      var roomLeft = mwidth - totalCol;
      while (roomLeft > 0) { // Add the extra to the first row that allows us to
        var act = def.actual || 0;
        if (isNaN(def.width) && def.maximum > act) {
          def.actual = Math.min(def.maximum, act + roomLeft);
          if (def.actual !== act) roomLeft -= def.actual - act;
        }
        if (def.index - 1 === -1) break;
        def = this.getColumnDefinition(def.index - 1);
      }
    }
  } // end spanning objects
 
  l = this.columnCount;
  for (var i = 0; i < l; i++) {
    if (this._colDefs[i] === undefined) continue;
    def = this.getColumnDefinition(i);
    def.position = union.width;
    if (def.actual !== 0) {
      union.width += def.actual;
      union.width += def.computeEffectiveSpacing();
    }
  }
 
  l = this.rowCount;
  for (var i = 0; i < l; i++) {
    if (this._rowDefs[i] === undefined) continue;
    def = this.getRowDefinition(i);
    def.position = union.height;
    if (def.actual !== 0) {
      union.height += def.actual;
      union.height += def.computeEffectiveSpacing();
    }
  }
 
  // save these for arrange (destroy them or not? Possibly needed for drawing spacers)
  return rowcol;
}; // end measureTable
 
 
/**
* @ignore
* @override
* @this {TableLayout}
*/
TableLayout.prototype.arrangeTable = function(children, union, rowcol) {
  var l = children.length;
  var originx = this.arrangementOrigin.x;
  var originy = this.arrangementOrigin.y;
  var x = 0.0;
  var y = 0.0;
  
  var lrow = rowcol.length; //number of rows
  var lcol = 0;
  for (var i = 0; i < lrow; i++) {
    if (!rowcol[i]) continue;
    lcol = Math.max(lcol, rowcol[i].length); // column length in this row
  }
 
  var additionalSpan = new go.Size();
  // Find cell space and arrange objects:
  for (var i = 0; i < lrow; i++) {
    if (!rowcol[i]) continue;
    lcol = rowcol[i].length; // column length in this row
    var rowHerald = this.getRowDefinition(i);
    y = originy + rowHerald.position + rowHerald.computeEffectiveSpacingTop();
    for (var j = 0; j < lcol; j++) {
      //foreach column j in row i...
      if (!rowcol[i][j]) continue;
      var colHerald = this.getColumnDefinition(j);
      x = originx + colHerald.position + colHerald.computeEffectiveSpacingTop();
      var cell = rowcol[i][j];
      var len = cell.length;
 
      for (var k = 0; k < len; k++) {
        //foreach element in cell
        var child = cell[k];
 
        // add to layoutWidth/Height any additional span
        additionalSpan.setTo(0, 0);
 
        for (var n = 1; n < child.rowSpan; n++) {
          // if the row exists at all
          if (i + n >= this.rowCount) break;
          var rh = this.getRowDefinition(i + n);
          additionalSpan.height += rh.total;
        }
 
        for (var n = 1; n < child.columnSpan; n++) {
          // if the col exists at all
          if (j + n >= this.columnCount) break;
          var ch = this.getColumnDefinition(j + n);
          additionalSpan.width += ch.total;
        }
 
        // Construct containing rect (cell):
 
        // total width and height of the cell that an object could possibly be created in
        var colwidth = colHerald.actual + additionalSpan.width;
        var rowheight = rowHerald.actual + additionalSpan.height;
 
        // construct a rect that represents the total cell size allowed for this object
        var ar = new go.Rect();
        ar.x = x;
        ar.y = y;
        ar.width = colwidth;
        ar.height = rowheight;
 
        // Also keep them for clip values
        var cellx = x;
        var celly = y;
        var cellw = colwidth;
        var cellh = rowheight;
        // Ending rows/col might have actual spaces that are larger than the remaining space
        // Modify them for clipping regions
        if (x + colwidth > union.width) cellw = Math.max(union.width - x, 0);
        if (y + rowheight > union.height) cellh = Math.max(union.height - y, 0);
 
 
        // Construct alignment:
        var align = child.alignment;
        var alignx = 0.0;
        var aligny = 0.0;
        var alignoffsetX = 0.0;
        var alignoffsetY = 0.0;
        if (align.isDefault()) {
          align = this.defaultAlignment;
          if (!align.isSpot()) align = go.Spot.Center;
          alignx = align.x;
          aligny = align.y;
          alignoffsetX = align.offsetX;
          alignoffsetY = align.offsetY;
          var ca = colHerald.alignment;
          var ra = rowHerald.alignment;
          if (ca.isSpot()) {
            alignx = ca.x;
            alignoffsetX = ca.offsetX;
          }
          if (ra.isSpot()) {
            aligny = ra.y;
            alignoffsetY = ra.offsetY;
          }
        } else {
          alignx = align.x;
          aligny = align.y;
          alignoffsetX = align.offsetX;
          alignoffsetY = align.offsetY;
        }
 
        // same as if (!align.isSpot()) align = go.Spot.Center;
        if (isNaN(alignx) || isNaN(aligny)) {
          alignx = 0.5;
          aligny = 0.5;
          alignoffsetX = 0;
          alignoffsetY = 0;
        }
 
        var width = 0.0;
        var height = 0.0;
 
        var marg = child.margin;
        var margw = marg.left + marg.right;
        var margh = marg.top + marg.bottom;
        var stretch = this.getEffectiveTableStretch(child, rowHerald, colHerald);
        if (/* isNaN(child.resizeObject.desiredSize.width) && */ (stretch === go.GraphObject.Fill || stretch === go.GraphObject.Horizontal))
          width = Math.max(colwidth - margw, 0);
        else
          width = child.actualBounds.width;
        if (/* isNaN(child.resizeObject.desiredSize.height) && */ (stretch === go.GraphObject.Fill || stretch === go.GraphObject.Vertical))
          height = Math.max(rowheight - margh, 0);
        else
          height = child.actualBounds.height;
 
        // min and max override any stretch values
        var max = child.maxSize;
        var min = child.minSize;
        width = Math.min(max.width, width);
        height = Math.min(max.height, height);
        width = Math.max(min.width, width);
        height = Math.max(min.height, height);
 
        var widthmarg = width + margw;
        var heightmarg = height + margh;
 
        ar.x += (ar.width * alignx) - (widthmarg * alignx) + alignoffsetX + marg.left;
        ar.y += (ar.height * aligny) - (heightmarg * aligny) + alignoffsetY + marg.top;
 
        child.moveTo(ar.x, ar.y);
        if (stretch !== go.GraphObject.None) {
          child.resizeObject.desiredSize = new go.Size(width, height);
        }
 
      } // end cell
    } // end col
  } //end row
}; // end arrangeTable
// end TableLayout class
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/Templates.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/Templates.js

Statements: 4.23% (11 / 260)      Branches: 100% (0 / 0)      Functions: 0% (0 / 11)      Lines: 4.23% (11 / 260)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386                            1                                                                                                                                                                               1                   1                                                             1                                                                                                                                       1                                                                       1                                                                                                     1                                               1                                       1                             1                           1                            
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// These are the definitions for all of the predefined templates and tool archetypes.
// You do not need to load this file in order to use the default templates and archetypes.
 
// Although we have tried to provide definitions here that are faithful to how they
// are actually implemented, there may be some differences from what is in the library.
 
// Caution: these may change in version 2.0.
 
// Set up the default templates that each Diagram starts off with.
function setupDiagramTemplates(diagram /* : go.Diagram */) {
  // Node Templates
  var nodeTemplateMap = new go.Map('string', go.Part);
 
  // create the default Node template
  var archnode = new go.Node();
  var nodet = new go.TextBlock();
  nodet.bind(new go.Binding('text', '', go.Binding.toString));
  archnode.add(nodet);
  nodeTemplateMap.add('', archnode);
 
  // create the default Comment Node template
  var archcmnt = new go.Node();
  var nodec = new go.TextBlock();
  nodec.stroke = 'brown';
  nodec.bind(new go.Binding('text', '', go.Binding.toString));
  archcmnt.add(nodec);
  nodeTemplateMap.add('Comment', archcmnt);
 
  // create the default Link Label Node template
  var archllab = new go.Node();
  archllab.selectable = false;
  archllab.avoidable = false;
  var nodel = new go.Shape();
  nodel.figure = 'Ellipse';
  nodel.fill = 'black';
  nodel.stroke = null;
  nodel.desiredSize = new go.Size(3, 3);
  archllab.add(nodel);
  nodeTemplateMap.add('LinkLabel', archllab);
 
  diagram.nodeTemplateMap = nodeTemplateMap;
 
  // Group Templates
  var groupTemplateMap = new go.Map('string', go.Group);
 
  // create the default Group template
  var archgrp = new go.Group();
  archgrp.selectionObjectName = 'GROUPPANEL';
  archgrp.type = go.Panel.Vertical;
  var grpt = new go.TextBlock();
  grpt.font = 'bold 12pt sans-serif';
  grpt.bind(new go.Binding('text', '', go.Binding.toString));
  archgrp.add(grpt);
  var grppan = new go.Panel(go.Panel.Auto);
  grppan.name = 'GROUPPANEL';
  var grpbord = new go.Shape();
  grpbord.figure = 'Rectangle';
  grpbord.fill = 'rgba(128,128,128,0.2)';
  grpbord.stroke = 'black';
  grppan.add(grpbord);
  var phold = new go.Placeholder();
  phold.padding = new go.Margin(5, 5, 5, 5);
  grppan.add(phold);
  archgrp.add(grppan);
  groupTemplateMap.add('', archgrp);
 
  diagram.groupTemplateMap = groupTemplateMap;
 
  // Link Templates
  var linkTemplateMap = new go.Map('string', go.Link);
 
  // create the default Link template
  var archlink = new go.Link();
  var archpath = new go.Shape();
  archpath.isPanelMain = true;
  archlink.add(archpath);
  var archarrow = new go.Shape();
  archarrow.toArrow = 'Standard';
  archarrow.fill = 'black';
  archarrow.stroke = null;
  archarrow.strokeWidth = 0;
  archlink.add(archarrow);
  linkTemplateMap.add('', archlink);
 
  // create the default Comment Link template
  var archcmntlink = new go.Link();
  var archcmntpath = new go.Shape();
  archcmntpath.isPanelMain = true;
  archcmntpath.stroke = 'brown';
  archcmntlink.add(archcmntpath);
  linkTemplateMap.add('Comment', archcmntlink);
 
  diagram.linkTemplateMap = linkTemplateMap;
}
 
 
// Set up the default Panel.itemTemplate.
function setupDefaultItemTemplate(panel /* : go.Panel */) {
  var architem = new go.Panel();
  var itemtxt = new go.TextBlock();
  itemtxt.bind(new go.Binding('text', '', go.Binding.toString));
  architem.add(itemtxt);
  panel.itemTemplate = architem;
}
 
 
// Set up the diagram's selection Adornments
function setupSelectionAdornments(diagram /* : go.Diagram */) {
  // create the default Adornment for selection
  var selad = new go.Adornment();
  selad.type = go.Panel.Auto;
  var seladhandle = new go.Shape();
  seladhandle.fill = null;
  seladhandle.stroke = 'dodgerblue';
  seladhandle.strokeWidth = 3;
  selad.add(seladhandle);
  var selplace = new go.Placeholder();
  selplace.margin = new go.Margin(1.5, 1.5, 1.5, 1.5);
  selad.add(selplace);
  diagram.nodeSelectionAdornmentTemplate = selad;
 
  // reuse the default Node Adornment for selection
  diagram.groupSelectionAdornmentTemplate = selad;
 
  // create the default Link Adornment for selection
  selad = new go.Adornment();
  selad.type = go.Panel.Link;
  seladhandle = new go.Shape();
  seladhandle.isPanelMain = true;
  seladhandle.fill = null;
  seladhandle.stroke = 'dodgerblue';
  seladhandle.strokeWidth = 3;  //?? zero to use selection object's strokeWidth is often not wide enough
  selad.add(seladhandle);
  diagram.linkSelectionAdornmentTemplate = selad;
}
 
 
// Set up the background Grid Panel.
function setupDefaultBackgroundGrid(diagram /* : go.Diagram */) {
  var grid = new go.Panel(go.Panel.Grid);
  grid.name = 'GRID';
 
  var hlines = new go.Shape();
  hlines.figure = 'LineH';
  hlines.stroke = 'lightgray';
  hlines.strokeWidth = 0.5;
  hlines.interval = 1;
  grid.add(hlines);
 
  hlines = new go.Shape();
  hlines.figure = 'LineH';
  hlines.stroke = 'gray';
  hlines.strokeWidth = 0.5;
  hlines.interval = 5;
  grid.add(hlines);
 
  hlines = new go.Shape();
  hlines.figure = 'LineH';
  hlines.stroke = 'gray';
  hlines.strokeWidth = 1;
  hlines.interval = 10;
  grid.add(hlines);
 
  var vlines = new go.Shape();
  vlines.figure = 'LineV';
  vlines.stroke = 'lightgray';
  vlines.strokeWidth = 0.5;
  vlines.interval = 1;
  grid.add(vlines);
 
  vlines = new go.Shape();
  vlines.figure = 'LineV';
  vlines.stroke = 'gray';
  vlines.strokeWidth = 0.5;
  vlines.interval = 5;
  grid.add(vlines);
 
  vlines = new go.Shape();
  vlines.figure = 'LineV';
  vlines.stroke = 'gray';
  vlines.strokeWidth = 1;
  vlines.interval = 10;
  grid.add(vlines);
 
  grid.visible = false;  // by default the grid is not visible
 
  // Create the Part that holds the grid.
  //var gridpart = new go.Part();
  //gridpart.add(grid);
  //gridpart.layerName = 'Grid';  // goes in the "Grid" layer
  //gridpart.zOrder = 0;  // to make it easier for other background parts to be behind the grid
  //gridpart.isInDocumentBounds = false;  // never part of the document bounds
  //gridpart.isAnimated = false;  // not animated
  //gridpart.pickable = false;  // user cannot pick it with mouse/touch/stylus
  //gridpart.locationObjectName = 'GRID';
  //diagram.add(gridpart);
  // So then: diagram.grid === grid
 
  // BUT, the gridpart is not actually in the Diagram.parts collection,
  // and that Part cannot be replaced; so the above code is commented out.
  // Instead, this works in an existing GoJS environment:
  diagram.grid = grid;
}
 
 
// Set up the "viewport" box part that is the initial value of Overview.box.
function setupOverviewBox(overview /* : go.Overview */) {
  var box = new go.Part();
  var s = new go.Shape();
  s.stroke = 'magenta';
  s.strokeWidth = 2;
  s.fill = 'transparent';
  s.name = 'BOXSHAPE';
  box.selectable = true;
  box.selectionObjectName = 'BOXSHAPE';
  box.locationObjectName = 'BOXSHAPE';
  //box.resizable = true;
  box.resizeObjectName = 'BOXSHAPE';
  box.cursor = 'move';
  box.add(s);
 
  // only resize the bottom-right corner
  var ad = new go.Adornment();
  ad.type = go.Panel.Spot;
  ad.locationSpot = go.Spot.Center;
  var ph = new go.Placeholder();
  ph.isPanelMain = true;
  ad.add(ph);
  var hnd = new go.Shape();
  hnd.alignmentFocus = go.Spot.Center;
  hnd.figure = 'Rectangle';
  hnd.desiredSize = new go.Size(64, 64);
  hnd.cursor = 'se-resize';
  hnd.alignment = go.Spot.BottomRight;
  ad.add(hnd);
  box.resizeAdornmentTemplate = ad;
 
  overview.box = box;
}
 
 
// Set up LinkingBaseTool's default temporary nodes and link.
function setupLinkingToolTemporaryNodesAndLink(tool /* : go.LinkingBaseTool */) {
  // LinkingTool.temporaryLink
  var link = new go.Link();
  var path = new go.Shape();
  path.isPanelMain = true;
  path.stroke = 'blue';
  link.add(path);
  var arrow = new go.Shape();
  arrow.toArrow = 'Standard';
  arrow.fill = 'blue';
  arrow.stroke = 'blue';
  link.add(arrow);
  link.layerName = 'Tool';
 
  tool.temporaryLink = link;
 
  // LinkingTool.temporaryFromNode and .temporaryFromPort
  var fromNode = new go.Node();
  var fromPort = new go.Shape();
  fromPort.portId = '';
  fromPort.figure = 'Rectangle';
  fromPort.fill = null;
  fromPort.stroke = 'magenta';
  fromPort.strokeWidth = 2;
  fromPort.desiredSize = new go.Size(1, 1);
  fromNode.add(fromPort);
  fromNode.selectable = false;
  fromNode.layerName = 'Tool';
 
  tool.temporaryFromNode = fromNode;
  tool.temporaryFromPort = fromPort;
 
  // LinkingTool.temporaryToNode and .temporaryToPort
  var toNode = new go.Node();
  var toPort = new go.Shape();
  toPort.portId = '';
  toPort.figure = 'Rectangle';
  toPort.fill = null;
  toPort.stroke = 'magenta';
  toPort.strokeWidth = 2;
  toPort.desiredSize = new go.Size(1, 1);
  toNode.add(toPort);
  toNode.selectable = false;
  toNode.layerName = 'Tool';
 
  tool.temporaryToNode = toNode;
  tool.temporaryToPort = toPort;
}
 
 
// Set up RelinkingTool's default handle archetypes
function setupRelinkingToolHandles(tool /* : go.RelinkingTool */) {
  var h = new go.Shape();
  h.figure = 'Diamond';
  h.desiredSize = new go.Size(8, 8);
  h.fill = 'lightblue';
  h.stroke = 'dodgerblue';
  h.cursor = 'pointer';
  h.segmentIndex = 0;
 
  tool.fromHandleArchetype = h;
 
  h = new go.Shape();
  h.figure = 'Diamond';
  h.desiredSize = new go.Size(8, 8);
  h.fill = 'lightblue';
  h.stroke = 'dodgerblue';
  h.cursor = 'pointer';
  h.segmentIndex = -1;
 
  tool.toHandleArchetype = h;
}
 
 
// Set up LinkReshapingTool's default handle archetypes
function setupLinkReshapingToolHandles(tool /* : go.LinkReshapingTool */) {
  var h = new go.Shape();
  h.figure = 'Rectangle';
  h.desiredSize = new go.Size(6, 6);
  h.fill = 'lightblue';
  h.stroke = 'dodgerblue';
 
  tool.handleArchetype = h;
 
  h = new go.Shape();
  h.figure = 'Diamond';
  h.desiredSize = new go.Size(6, 6);
  h.fill = 'lightblue';
  h.stroke = 'dodgerblue';
 
  tool.midHandleArchetype = h;
}
 
 
// Set up ResizingTool's default handle archetype
function setupResizingToolHandles(tool /* : go.ResizingTool */) {
  var h = new go.Shape();
  h.alignmentFocus = go.Spot.Center;
  h.figure = 'Rectangle';
  h.desiredSize = new go.Size(6, 6);
  h.fill = 'lightblue';
  h.stroke = 'dodgerblue';
  h.strokeWidth = 1;
  h.cursor = 'pointer';
 
  tool.handleArchetype = h;
}
 
 
// Set up RotatingTool's default handle archetype
function setupRotatingToolHandles(tool /* : go.RotatingTool */) {
  var h = new go.Shape();
  h.figure = 'Ellipse';
  h.desiredSize = new go.Size(8, 8);
  h.fill = 'lightblue';
  h.stroke = 'dodgerblue';
  h.strokeWidth = 1;
  h.cursor = 'pointer';
 
  tool.handleArchetype = h;
}
 
 
// Set up DragSelectingTool's default box
function setupDragSelectingToolBox(tool /* : go.DragSelectingTool */) {
  var b = new go.Part();
  b.layerName = 'Tool';
  b.selectable = false;
  var r = new go.Shape();
  r.name = 'SHAPE';
  r.figure = 'Rectangle';
  r.fill = null;
  r.stroke = 'magenta';
  b.add(r);
 
  tool.box = b;
}
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/TextEditor.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/TextEditor.js

Statements: 1.2% (1 / 83)      Branches: 0% (0 / 32)      Functions: 0% (0 / 8)      Lines: 1.35% (1 / 74)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152                  2                                                                                                                                                                                                                                                                                            
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// HTML + JavaScript text editor menu, made with HTMLInfo
// This is a re-implementation of the default text editor
// This file exposes one instance of HTMLInfo, window.TextEditor
// See also TextEditor.html
(function(window) {
  var textarea = document.createElement('textarea');
  textarea.id = "myTextArea";
 
  textarea.addEventListener('input', function(e) {
    var tool = TextEditor.tool;
    if (tool.textBlock === null) return;
    var tempText = tool.measureTemporaryTextBlock(this.value);
    var scale = this.textScale;
    this.style.width = 20 + tempText.measuredBounds.width * scale + 'px';
    this.style.height = 10 + tempText.measuredBounds.height * scale + "px";
    this.rows = tempText.lineCount;
  }, false);
 
  textarea.addEventListener('keydown', function(e) {
    var tool = TextEditor.tool;
    if (tool.textBlock === null) return;
    var keynum = e.which;
    if (keynum === 13) { // Enter
      if (tool.textBlock.isMultiline === false) e.preventDefault();
      tool.acceptText(go.TextEditingTool.Enter);
      return;
    } else if (keynum === 9) { // Tab
      tool.acceptText(go.TextEditingTool.Tab);
      e.preventDefault();
      return;
    } else if (keynum === 27) { // Esc
      tool.doCancel();
      if (tool.diagram !== null) tool.diagram.doFocus();
    }
  }, false);
 
  // handle focus:
  textarea.addEventListener('focus', function(e) {
    var tool = TextEditor.tool;
    if (tool.currentTextEditor === null) return;
 
    if (tool.state === go.TextEditingTool.StateActive) {
      tool.state = go.TextEditingTool.StateEditing;
    }
 
    if (tool.selectsTextOnActivate) {
      textarea.select();
      textarea.setSelectionRange(0, 9999);
    }
  }, false);
 
  // Disallow blur.
  // If the textEditingTool blurs and the text is not valid,
  // we do not want focus taken off the element just because a user clicked elsewhere.
  textarea.addEventListener('blur', function(e) {
    var tool = TextEditor.tool;
    if (tool.currentTextEditor === null) return;
 
    textarea.focus();
 
    if (tool.selectsTextOnActivate) {
      textarea.select();
      textarea.setSelectionRange(0, 9999);
    }
  }, false);
 
 
  var TextEditor = new go.HTMLInfo();
 
  TextEditor.valueFunction = function() { return textarea.value; }
 
  TextEditor.mainElement = textarea; // to reference it more easily
 
  // used to be in doActivate
  TextEditor.show = function(textBlock, diagram, tool) {
    if (!(textBlock instanceof go.TextBlock)) return;
 
    TextEditor.tool = tool;  // remember the TextEditingTool for use by listeners
 
    // This is called during validation, if validation failed:
    if (tool.state === go.TextEditingTool.StateInvalid) {
      textarea.style.border = '3px solid red';
      textarea.focus();
      return;
    }
 
    // This part is called during initalization:
 
    var loc = textBlock.getDocumentPoint(go.Spot.Center);
    var pos = diagram.position;
    var sc = diagram.scale;
    var textscale = textBlock.getDocumentScale() * sc;
    if (textscale < tool.minimumEditorScale) textscale = tool.minimumEditorScale;
    // Add slightly more width/height to stop scrollbars and line wrapping on some browsers
    // +6 is firefox minimum, otherwise lines will be wrapped improperly
    var textwidth = (textBlock.naturalBounds.width * textscale) + 6;
    var textheight = (textBlock.naturalBounds.height * textscale) + 2;
    var left = (loc.x - pos.x) * sc;
    var top = (loc.y - pos.y) * sc;
 
    textarea.value = textBlock.text;
    // the only way you can mix font and fontSize is if the font inherits and the fontSize overrides
    // in the future maybe have textarea contained in its own div
    diagram.div.style['font'] = textBlock.font;
 
    var paddingsize = 1;
 
    textarea.style.cssText =
    'position: absolute;' +
    'z-index: 100;' +
    'font: inherit;' +
    'fontSize: ' + (textscale * 100) + '%;' +
    'lineHeight: normal;' +
    'width: ' + (textwidth) + 'px;' +
    'height: ' + (textheight) + 'px;' +
    'left: ' + ((left - (textwidth / 2) | 0) - paddingsize) + 'px;' +
    'top: ' + ((top - (textheight / 2) | 0) - paddingsize) + 'px;' +
    'textAlign: ' + textBlock.textAlign + ';' +
    'margin: 0;' +
    'padding: ' + paddingsize + 'px;' +
    'border: 0;' +
    'outline: none;' +
    'white-space: pre-wrap;' +
    'overflow: hidden;' // for proper IE wrap
 
    textarea.textScale = textscale; // attach a value to the textarea, for convenience
 
    // Show:
    diagram.div.appendChild(textarea);
 
    // After adding, focus:
    textarea.focus();
    if (tool.selectsTextOnActivate) {
      textarea.select();
      textarea.setSelectionRange(0, 9999);
    }
  };
 
  TextEditor.hide = function(diagram, tool) {
    diagram.div.removeChild(textarea);
    TextEditor.tool = null;  // forget reference to TextEditingTool
  }
 
  window.TextEditor = TextEditor;
})(window);
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/TextEditorRadioButtons.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/TextEditorRadioButtons.js

Statements: 1.39% (1 / 72)      Branches: 0% (0 / 22)      Functions: 0% (0 / 6)      Lines: 1.52% (1 / 66)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117                    2                                                                                                                                                                                                                    
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// HTML + JavaScript text editor menu, using HTML radio inputs and HTMLInfo.
// This file exposes one instance of HTMLInfo, window.TextEditorRadioButtons
// see /samples/customTextEditingTool.html
// see also textEditorSelectBox.js for another custom editor
// see also textEditor.html for a re-implementation of the default text editor
(function(window) {
  // Use the following HTML:
  var customText = document.createElement("div");
  customText.id = "customTextEditor";
  customText.style.cssText = "border: 1px solid black; background-color: white;";
  customText.innerHTML =
  '  <label for="One">One</label> <input type="radio" name="group1" id="One" value="One"> <br/>' +
  '  <label for="Two">Two</label> <input type="radio" name="group1" id="Two" value="Two"> <br/>' +
  '  <label for="Three">Three</label> <input type="radio" name="group1" id="Three" value="Three"> <br/>' +
  '  <label for="Four">Four</label> <input type="radio" name="group1" id="Four" value="Four">';
 
  var customEditor = new go.HTMLInfo();
 
 
  customEditor.show = function(textBlock, diagram, tool) {
    if (!(textBlock instanceof go.TextBlock)) return;
    var startingValue = textBlock.text;
 
    // Populate the select box:
    customText.innerHTML = "";
 
    var list = textBlock.choices;
    // Perhaps give some default choices if textBlock.choices is null
    if (list === null) list = ["Default A", "Default B", "Default C"];
    var l = list.length;
    for (var i = 0; i < l; i++) {
      var value = list[i];
      var label = document.createElement("label");
      var input = document.createElement("input");
      label.htmlFor = value;
      label.textContent = value;
      input.type = "radio";
      input.name = "group1";
      input.id = value;
      input.value = value;
      customText.appendChild(label);
      customText.appendChild(input);
      if (i !== l-1) customText.appendChild(document.createElement("br"));
    }
 
    // consider also adding the current value, if it is not in the choices list
 
    var children = customText.children
    var l = children.length;
    for (var i = 0; i < l; i++) {
      var child = children[i];
      if (!(child instanceof HTMLInputElement)) continue;
      // Make sure the radio button that equals the text is checked
      if (child.value == startingValue) {
        child.checked = true;
      }
 
      // Finish immediately when a radio button is pressed
      customText.addEventListener("change", function(e) {
        tool.acceptText(go.TextEditingTool.Tab);
      }, false);
 
    }
 
    // Do a few different things when a user presses a key
    customText.addEventListener("keydown", function(e) {
      var keynum = e.which;
      if (keynum == 13) { // Accept on Enter
        tool.acceptText(go.TextEditingTool.Enter);
        return;
      } else if (keynum == 9) { // Accept on Tab
        tool.acceptText(go.TextEditingTool.Tab);
        e.preventDefault();
        return false;
      } else if (keynum === 27) { // Cancel on Esc
        tool.doCancel();
        if (tool.diagram) tool.diagram.focus();
      }
    }, false);
 
    var loc = textBlock.getDocumentPoint(go.Spot.TopLeft);
    var pos = myDiagram.transformDocToView(loc);
    customText.style.left = pos.x + "px";
    customText.style.top  = pos.y + "px";
    customText.style.position = 'absolute';
    customText.style.zIndex = 100; // place it in front of the Diagram
    diagram.div.appendChild(customText);
  }
 
  customEditor.hide = function(diagram, tool) {
    diagram.div.removeChild(customText);
  }
 
  // customText is a div and doesn't have a "value" field
  // So we will make value into a function that will return
  // the "value" of the checked radio button
  customEditor.valueFunction = function() {
    var children = customText.children
    var l = children.length;
    for (var i = 0; i < l; i++) {
      var child = children[i];
      if (!(child instanceof HTMLInputElement)) continue;
      if (child.checked) {
        return child.value;
      }
    }
    return "";
  }
 
  window.TextEditorRadioButtons = customEditor;
})(window);
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/TextEditorSelectBox.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/TextEditorSelectBox.js

Statements: 2.38% (1 / 42)      Branches: 0% (0 / 12)      Functions: 0% (0 / 5)      Lines: 2.63% (1 / 38)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72                    2                                                                                                                          
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// HTML + JavaScript text editor using an HTML Select Element and HTMLInfo.
// This file exposes one instance of HTMLInfo, window.TextEditorSelectBox
// see /samples/customTextEditingTool.html
// see also textEditorRadioButton.js for another custom editor
// see also textEditor.html for a re-implementation of the default text editor
(function(window) {
  var customEditor = new go.HTMLInfo();
 
  var customSelectBox = document.createElement("select");
 
  customEditor.show = function(textBlock, diagram, tool) {
    if (!(textBlock instanceof go.TextBlock)) return;
 
    // Populate the select box:
    customSelectBox.innerHTML = "";
 
    var list = textBlock.choices;
    // Perhaps give some default choices if textBlock.choices is null
    if (list === null) list = ["Default A", "Default B", "Default C"];
    var l = list.length;
    for (var i = 0; i < l; i++) {
      var op = document.createElement("option");
      op.text = list[i];
      op.value = list[i];
      customSelectBox.add(op, null);
 
      // consider also adding the current value, if it is not in the choices list
    }
 
    // After the list is populated, set the value:
    customSelectBox.value = textBlock.text;
 
    // Do a few different things when a user presses a key
    customSelectBox.addEventListener("keydown", function(e) {
      var keynum = e.which;
      if (keynum == 13) { // Accept on Enter
        tool.acceptText(go.TextEditingTool.Enter);
        return;
      } else if (keynum == 9) { // Accept on Tab
        tool.acceptText(go.TextEditingTool.Tab);
        e.preventDefault();
        return false;
      } else if (keynum === 27) { // Cancel on Esc
        tool.doCancel();
        if (tool.diagram) tool.diagram.focus();
      }
    }, false);
 
    var loc = textBlock.getDocumentPoint(go.Spot.TopLeft);
    var pos = diagram.transformDocToView(loc);
    customSelectBox.style.left = pos.x + "px";
    customSelectBox.style.top  = pos.y + "px";
    customSelectBox.style.position = 'absolute';
    customSelectBox.style.zIndex = 100; // place it in front of the Diagram
 
    diagram.div.appendChild(customSelectBox);
  }
 
  customEditor.hide = function(diagram, tool) {
    diagram.div.removeChild(customSelectBox);
  }
 
  customEditor.valueFunction = function() { return customSelectBox.value; }
 
  window.TextEditorSelectBox = customEditor;
})(window);
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/TreeMapLayout.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/TreeMapLayout.js

Statements: 2.41% (2 / 83)      Branches: 0% (0 / 30)      Functions: 0% (0 / 15)      Lines: 2.67% (2 / 75)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148                          1       2                                                                                                                                                                                                                                                                    
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom Layout that lays out nested Groups according to how much area they should have
// within the viewport as a proportion of the total area.
 
// A simple layout for positioning and sizing all nodes in a diagram to make a tree map.
// Assume that all Group.layout == null and that it's OK to set the Node.desiredSize for all nodes, including groups.
// Also assume that there is a number property named "size" on the node data;
// this computes the "total" property for each node as the sum of the group's member nodes.
// This layout ignores all Links.
function TreeMapLayout() {
  go.Layout.call(this);
  this._isTopLevelHorizontal = false;
}
go.Diagram.inherit(TreeMapLayout, go.Layout);
 
/**
* @ignore
* Copies properties to a cloned Layout.
* @this {TreeMapLayout}
* @param {Layout} copy
* @override
*/
TreeMapLayout.prototype.cloneProtected = function(copy) {
  go.Layout.prototype.cloneProtected.call(this, copy);
  copy._isTopLevelHorizontal = this._isTopLevelHorizontal;
};
 
// First call computeTotals to make sure all of the node data have values for data.total.
// Then do a top-down walk through the diagram's structure of group relationships,
// positioning everything to fit in the viewport.
TreeMapLayout.prototype.doLayout = function(coll) {
  if (!(coll instanceof go.Diagram)) throw new Error("TreeMapLayout only works as the Diagram.layout");
  var diagram = coll;
  this.computeTotals(diagram);  // make sure data.total has been computed for every node
  // figure out how large an area to cover;
  // perhaps this should be a property that could be set, rather than depending on the current viewport
  var x = this.arrangementOrigin.x;
  var y = this.arrangementOrigin.y;
  var w = diagram.viewportBounds.width;
  var h = diagram.viewportBounds.height;
  if (isNaN(w)) w = 1000;
  if (isNaN(h)) h = 1000;
  // collect all top-level nodes, and sum their totals
  var tops = new go.Set();
  var total = 0;
  diagram.nodes.each(function(n) {
    if (n.isTopLevel) {
      tops.add(n);
      total += n.data.total;
    }
  });
  var horiz = this.isTopLevelHorizontal;  // initially horizontal layout?
  // the following was copied from the layoutNode method
  var gx = x;
  var gy = y;
  var lay = this;
  tops.each(function(n) {
    var tot = n.data.total;
    if (horiz) {
      var pw = w * tot / total;
      lay.layoutNode(!horiz, n, gx, gy, pw, h);
      gx += pw;
    } else {
      var ph = h * tot / total;
      lay.layoutNode(!horiz, n, gx, gy, w, ph);
      gy += ph;
    }
  })
};
 
// Position and size the given node, and recurse if the node is a group
TreeMapLayout.prototype.layoutNode = function(horiz, n, x, y, w, h) {
  n.position = new go.Point(x, y);
  n.desiredSize = new go.Size(w, h);
  if (n instanceof go.Group) {
    var g = n;
    var total = g.data.total;
    var gx = x;
    var gy = y;
    var lay = this;
    g.memberParts.each(function(p) {
      if (p instanceof go.Link) return;
      var tot = p.data.total;
      if (horiz) {
        var pw = w * tot / total;
        lay.layoutNode(!horiz, p, gx, gy, pw, h);
        gx += pw;
      } else {
        var ph = h * tot / total;
        lay.layoutNode(!horiz, p, gx, gy, w, ph);
        gy += ph;
      }
    })
  }
};
 
// Make sure all nodes have initialized data.total property
TreeMapLayout.prototype.computeTotals = function(diagram) {
  if (!diagram.nodes.all(function(g) { return !(g instanceof go.Group) || g.data.total >= 0; })) {
    var groups = new go.Set();
    diagram.nodes.each(function(n) {
      if (n instanceof go.Group) {  // collect all groups
        groups.add(n);
      } else {  // regular nodes just have their total == size
        n.data.total = n.data.size;
      }
    });
    // keep looking for groups whose total can be computed, until all groups have been processed
    while (groups.count > 0) {
      var grps = new go.Set();
      groups.each(function(g) {
        // for a group all of whose member nodes have an initialized data.total,
        if (g.memberParts.all(function(m) { return !(m instanceof go.Group) || m.data.total >= 0; })) {
          // compute the group's total as the sum of the sizes of all of the member nodes
          g.data.total = 0;
          g.memberParts.each(function(m) { if (m instanceof go.Node) g.data.total += m.data.total; });
        } else {  // remember for the next iteration
          grps.add(g);
        }
      });
      groups = grps;
    }
  }
};
 
/**
* Gets or sets whether the top-level organization is horizontal or vertical.
* The default value is false.
* @name TreeMapLayout#isTopLevelHorizontal
* @function.
* @return {boolean}
*/
Object.defineProperty(TreeMapLayout.prototype, "isTopLevelHorizontal", {
  get: function() { return this._isTopLevelHorizontal; },
  set: function(val) {
    if (this._isTopLevelHorizontal !== val) {
      this._isTopLevelHorizontal = val;
      this.invalidateLayout();
    }
  }
});
// end TreeMapLayout
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/WallBuildingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/WallBuildingTool.js

Statements: 2.44% (2 / 82)      Branches: 0% (0 / 19)      Functions: 0% (0 / 14)      Lines: 2.63% (2 / 76)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124                  1           2                                                                                                                                                                                                                        
/*
* Copyright (C) 1998-2017 by Northwoods Software Corporation
* All Rights Reserved.
*
* WALL BUILDING TOOL
* Used to construct new walls with mouse clicking / mouse point
*/
 
// constructor
function WallBuildingTool() {
    go.Tool.call(this);
    this.name = "WallBuilding";
    this._startPoint = null;
    this._endPoint = null;
    this._wallReshapingTool = null;
} go.Diagram.inherit(WallBuildingTool, go.Tool);
 
// returns or modifies the current startPoint
Object.defineProperty(WallBuildingTool.prototype, "startPoint", {
    get: function () { return this._startPoint; },
    set: function (val) { this._startPoint = val; }
});
 
// returns or modifies the current endPoint
Object.defineProperty(WallBuildingTool.prototype, "endPoint", {
    get: function () { return this._endPoint; },
    set: function (val) { this._endPoint = val; }
});
 
// returns the diagram's wallReshapingTool
Object.defineProperty(WallBuildingTool.prototype, "wallReshapingTool", {
    get: function () { return this._wallReshapingTool; },
    set: function (val) { this._wallReshapingTool = val; }
});
 
WallBuildingTool.prototype.canStart = function () {
    var diagram = this.diagram;
    if (diagram !== null && !diagram.isReadOnly && this.isEnabled) return true;
    return false;
}
 
// start transaction, capture the mouse, use a crosshair cursor
WallBuildingTool.prototype.doActivate = function () {
    this.endPoint = null;
    this.startTransaction(this.name);
    this.isMouseCaptured = true;
    var diagram = this.diagram;
 
    // update wallWidth, based on the current value of the HTML input element
    var el = document.getElementById('wallWidthInput');
    if (isNaN(el.value) || el.value === null || el.value === '' || el.value === undefined) el.value = convertPixelsToUnits(5);
    diagram.model.setDataProperty(diagram.model.modelData, "wallWidth", convertUnitsToPixels(parseFloat(el.value)));
 
    // assign startpoint based on grid
    var point1 = this.diagram.lastInput.documentPoint;
    var gs = diagram.model.modelData.gridSize;
    if (!(this.diagram.toolManager.draggingTool.isGridSnapEnabled)) gs = 1;
    var newx = gs * Math.round(point1.x / gs);
    var newy = gs * Math.round(point1.y / gs);
    var newPoint1 = new go.Point(newx, newy);
    this.startPoint = newPoint1;
 
    this.wallReshapingTool = this.diagram.toolManager.mouseDownTools.elt(3);
    // Default functionality:
    this.isActive = true;
}
 
WallBuildingTool.prototype.doMouseDown = function () {
    var diagram = this.diagram;
    this.diagram.currentCursor = 'crosshair';
    var data = { key: "wall", category: "WallGroup", caption: "Wall", type: "Wall", startpoint: this.startPoint, endpoint: this.startPoint, strokeWidth: parseFloat(diagram.model.modelData.wallWidth), isGroup: true, notes: "" };
    this.diagram.model.addNodeData(data);
    var wall = diagram.findPartForKey(data.key);
    updateWall(wall);
    var part = diagram.findPartForData(data);
    // set the TransactionResult before raising event, in case it changes the result or cancels the tool
    this.transactionResult = this.name;
    diagram.raiseDiagramEvent('PartCreated', part);
 
    // start the wallReshapingTool, tell it what wall it's reshaping (more accurately, the shape the will have the reshape handle)
    this.wallReshapingTool.isEnabled = true;
    diagram.select(part);
    this.wallReshapingTool.isBuilding = true;
    this.wallReshapingTool.adornedShape = part.findObject("SHAPE");
    this.wallReshapingTool.doActivate();
}
 
WallBuildingTool.prototype.doKeyDown = function () {
    var e = this.diagram.lastInput;
    if (e.key === "Esc") {
        var wall = this.diagram.selection.first();
        var searchPhrase = (wall.data.key === "wall") ? "wallP" : wall.data.key;
        var dimensionLinks = this.diagram.findLinksByExample({ category: "dimensionLink" });
        var garbageLinks = [];
        dimensionLinks.iterator.each(function (link) { if (link.data.to.includes(searchPhrase)) garbageLinks.push(link); });
        for (var i = 0; i < garbageLinks.length; i++) { this.diagram.remove(garbageLinks[i]); }
        this.diagram.remove(wall);
        this.doDeactivate();
    }
    go.Tool.prototype.doKeyDown.call(this);
}
 
// when the mouse moves, reshape the wall
WallBuildingTool.prototype.doMouseMove = function () {
    this.wallReshapingTool.doMouseMove();
}
 
// end transaction
WallBuildingTool.prototype.doDeactivate = function () {
    var diagram = this.diagram;
    this.diagram.currentCursor = "";
    this.diagram.isMouseCaptured = false;
 
    this.wallReshapingTool.isEnabled = false;
    this.wallReshapingTool.isBuilding = false;
    this.wallReshapingTool.adornedShape = null;
    this.wallReshapingTool.doDeactivate();
 
    this.stopTransaction(this.name);
    this.isActive = false; // Default functionality
}
 
// END OF WALLBUILDINGTOOL CLASS
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/WallReshapingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/extensions/WallReshapingTool.js

Statements: 1.32% (5 / 379)      Branches: 0% (0 / 138)      Functions: 0% (0 / 39)      Lines: 1.47% (5 / 340)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519                  1                                   2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       1                                                                                                                                                                                                             1               1                                                                
/*
* Copyright (C) 1998-2017 by Northwoods Software Corporation
* All Rights Reserved.
*
* WALL RESHAPING TOOL
* Used to reshape walls via their endpoints
*/
 
// constructor
function WallReshapingTool() {
    go.Tool.call(this);
    this.name = "WallReshaping";
 
    var h = new go.Shape();
    h.figure = "Diamond";
    h.desiredSize = new go.Size(7, 7);
    h.fill = "lightblue";
    h.stroke = "dodgerblue";
    h.cursor = "move";
    this._handleArchetype = h;
 
    this._handle = null;
    this._adornedShape = null;
    this._reshapeObjectName = 'SHAPE';
    this._angle = 0;
    this._length;
    this._isBuilding = false; // only true when a wall is first being constructed, set in WallBuildingTool's doMouseUp function
} go.Diagram.inherit(WallReshapingTool, go.Tool);
 
Object.defineProperty(WallReshapingTool.prototype, "handleArchetype", {
    get: function () { return this._handleArchetype; }
});
 
Object.defineProperty(WallReshapingTool.prototype, "handle", {
    get: function () { return this._handle; },
    set: function (val) { this._handle = val; }
});
 
Object.defineProperty(WallReshapingTool.prototype, "adornedShape", {
    get: function () { return this._adornedShape; },
    set: function (val) { this._adornedShape = val;}
});
 
Object.defineProperty(WallReshapingTool.prototype, "angle", {
    get: function () { return this._angle; },
    set: function (val) { this._angle = val; }
});
 
Object.defineProperty(WallReshapingTool.prototype, "length", {
    get: function () { return this._length; },
    set: function (val) { this._length = val; }
});
 
Object.defineProperty(WallReshapingTool.prototype, "reshapeObjectName", {
    get: function () { return this._reshapeObjectName; },
    set: function (val) { this._reshapeObjectName = val; }
});
 
Object.defineProperty(WallReshapingTool.prototype, "isBuilding", {
    get: function () { return this._isBuilding; },
    set: function (val) { this._isBuilding = val; }
});
 
// places reshape handles on either end of a wall node
WallReshapingTool.prototype.updateAdornments = function (part) {
    if (part === null || part instanceof go.Link) return;
    if (part.isSelected && !this.diagram.isReadOnly) {
        var selelt = part.findObject(this.reshapeObjectName);
        if (selelt.part.data.category === "WallGroup") {
            var adornment = part.findAdornment(this.name);
            if (adornment === null) {
                adornment = this.makeAdornment(selelt);
            }
            if (adornment !== null && selelt.geometry != null) {
                // update the position/alignment of each handle
                var geo = selelt.geometry;
                var b = geo.bounds;
                // update the size of the adornment
                adornment.findObject("BODY").desiredSize = b.size;
                adornment.elements.each(function (h) {
                    if (h.name === undefined) return;
                    var x = 0;
                    var y = 0;
                    switch (h.name) {
                        case 'sPt': x = geo.startX; y = geo.startY; break;
                        case 'ePt': x = geo.endX; y = geo.endY; break;
                    }
                    var xCheck = Math.min((x - b.x) / b.width, 1);
                    var yCheck = Math.min((y - b.y) / b.height, 1);
                    if (xCheck < 0) xCheck = 0;
                    if (yCheck < 0) yCheck = 0;
                    if (xCheck > 1) xCheck = 1;
                    if (yCheck > 1) yCheck = 1;
                    if (isNaN(xCheck)) xCheck = 0;
                    if (isNaN(yCheck)) yCheck = 0;
                    h.alignment = new go.Spot(Math.max(0, xCheck), Math.max(0, yCheck));
                });
 
                part.addAdornment(this.name, adornment);
                adornment.location = selelt.getDocumentPoint(go.Spot.Center);
                adornment.angle = selelt.getDocumentAngle();
                return;
            }
        }
    }
    part.removeAdornment(this.name);
}
 
// if the user has clicked down at a visible handle on a wall node, then the tool may start
WallReshapingTool.prototype.canStart = function () {
    if (!this.isEnabled) return false;
    var diagram = this.diagram;
    if (diagram === null || diagram.isReadOnly) return false;
    if (!diagram.allowReshape) return false;
    if (!diagram.lastInput.left) return false;
    var h = this.findToolHandleAt(diagram.firstInput.documentPoint, this.name);
    return (h !== null || this.isBuilding);
}
 
// start a new transaction for the wall reshaping
WallReshapingTool.prototype.doActivate = function () {
    var diagram = this.diagram;
    if (diagram === null) return;
    if (this.isBuilding) {
        // this.adornedShape has already been set in WallBuildingTool's doMouseDown function
        var wall = this.adornedShape.part;
        this.handle = this.findToolHandleAt(wall.data.endpoint, this.name);
    } else {
        this.handle = this.findToolHandleAt(diagram.firstInput.documentPoint, this.name);
        if (this.handle === null) return;
        var shape = this.handle.part.adornedObject;
        if (!shape) return;
        this.adornedShape = shape;
    }
 
    diagram.isMouseCaptured = true;
    this.startTransaction(this.name);
    this.isActive = true;
}
 
// adjust the handle's coordinates, along with the wall's points
WallReshapingTool.prototype.doMouseMove = function () {
    var diagram = this.diagram;
    var tool = this;
    var wall = this.handle.part.adornedPart;
 
    if (this.isActive && diagram !== null) {
        var mousePt = diagram.lastInput.documentPoint;
        tool.calcAngleAndLengthFromHandle(mousePt); // sets this.angle and this.length (useful for when SHIFT is held)
        var newpt = diagram.lastInput.documentPoint;
        setSelectionInfo(this.adornedShape.part); // update selection info window
        this.reshape(newpt);
    }
    updateWallAngles();
}
 
// does one final reshape, commits the transaction, then stops the tool
WallReshapingTool.prototype.doMouseUp = function () {
    var diagram = this.diagram;
    if (this.isActive && diagram !== null) {
        var newpt = diagram.lastInput.documentPoint;
        this.reshape(newpt);
        this.transactionResult = this.name;  // success
    }
    this.stopTool();
}
 
// end the wall reshaping transaction
WallReshapingTool.prototype.doDeactivate = function () {
    var diagram = this.diagram;
    // if you reshape a wall down to < 1 px, remove it from the diagram
    var wall = this.handle.part.adornedPart;
    var sPt = wall.data.startpoint;
    var ePt = wall.data.endpoint;
    var length = Math.sqrt(sPt.distanceSquared(ePt.x, ePt.y));
    if (length < 1) {
        diagram.remove(wall); // remove wall
        wall.memberParts.iterator.each(function (member) { diagram.remove(member); }) // remove wall's parts   
        var wallDimensionLinkPointNodes = [];
        allPointNodes.iterator.each(function (node) { if (node.data.key.includes(wall.data.key)) wallDimensionLinkPointNodes.push(node); });
        diagram.remove(wallDimensionLinkPointNodes[0]);
        diagram.remove(wallDimensionLinkPointNodes[1]);
    }
 
    // remove wall's dimension links if tool cancelled via esc key
    if (diagram.lastInput.key === "Esc") {
        var wallDimensionLinkPointNodes = [];
        allPointNodes.iterator.each(function (node) { if (node.data.key.includes(wall.data.key)) wallDimensionLinkPointNodes.push(node); });
        diagram.remove(wallDimensionLinkPointNodes[0]);
        diagram.remove(wallDimensionLinkPointNodes[1]);
    }
 
    // remove guide line points
    var glPoints = this.diagram.findNodesByExample({ category: 'GLPointNode' });
    diagram.removeParts(glPoints, true);
 
    // commit transaction, deactivate tool
    diagram.commitTransaction(this.name);
    this.isActive = false;
    updateWallDimensions();
}
 
// creates an adornment with 2 handles
WallReshapingTool.prototype.makeAdornment = function (selelt) {
    var adornment = new go.Adornment;
    adornment.type = go.Panel.Spot;
    adornment.locationObjectName = "BODY";
    adornment.locationSpot = go.Spot.Center;
    var h = new go.Shape();
    h.name = "BODY"
    h.fill = null;
    h.stroke = null;
    h.strokeWidth = 0;
    adornment.add(h);
 
    h = this.makeHandle();
    h.name = 'sPt';
    adornment.add(h);
    h = this.makeHandle();
    h.name = 'ePt';
    adornment.add(h);
 
    adornment.category = this.name;
    adornment.adornedObject = selelt;
    return adornment;
}
 
// creates a basic handle archetype
WallReshapingTool.prototype.makeHandle = function () {
    var h = this.handleArchetype;
    return h.copy();
}
 
// calculate the angle and length made from the mousepoint and the non-moving handle
// used to reshape wall when holding SHIFT
WallReshapingTool.prototype.calcAngleAndLengthFromHandle = function (mousePt) {
    var tool = this;
    var diagram = this.diagram;
    var h = this.handle;
    var otherH;
    var node = this.adornedShape.part;
    var adornments = node.adornments.iterator;
    var adornment;
    adornments.each(function (a) { if (a.category === tool.name) adornment = a; })
    adornment.elements.each(function (e) {
        if (e.name != undefined && e.name != h.name) otherH = e;
    })
 
    // calc angle from otherH against the horizontal
    var otherHandlePt = otherH.getDocumentPoint(go.Spot.Center);
 
    deltaY = mousePt.y - otherHandlePt.y
    deltaX = mousePt.x - otherHandlePt.x
    var angle = Math.atan2(deltaY, deltaX) * (180 / Math.PI);
    // because atan2 goes from -180 to +180 and we want it to be 0-360
    // so -90 becomes 270, etc.
    if (angle < 0) angle += 360;
    tool.angle = angle;
 
    var distanceBetween = Math.sqrt(mousePt.distanceSquared(otherHandlePt.x, otherHandlePt.y));
    tool.length = distanceBetween;
}
 
// takes a point -- returns a new point that is closest to the original point that conforms to the grid snap
WallReshapingTool.prototype.snapPointToGrid = function (point) {
    var diagram = this.diagram;
    var newx = diagram.model.modelData.gridSize * Math.round(point.x / diagram.model.modelData.gridSize);
    var newy = diagram.model.modelData.gridSize * Math.round(point.y / diagram.model.modelData.gridSize);
    var newPt = new go.Point(newx, newy);
    return newPt;
}
 
// reshapes the shape's geometry, updates model data
WallReshapingTool.prototype.reshape = function (newPoint) {
    var diagram = this.diagram;
    var tool = this;
    var shape = this.adornedShape;
    var node = shape.part;
 
    //if the user is holding shift, make the angle between startPoint / endPoint / the horizontal line a multiple of 45
    if (this.diagram.lastInput.shift) {
 
        var sPt; // the stationary point -- the point at the handle that is not being adjusted
        if (tool.handle.name === 'sPt') sPt = node.data.endpoint;
        else sPt = node.data.startpoint;
 
        var oldGridSize = diagram.model.modelData.gridSize;
        var gridSize = diagram.model.modelData.gridSize;
        //if gridSnapping is disabled, just set 'gridSize' var to 1 so it doesn't affect endPoint calculations
        if (!(this.diagram.toolManager.draggingTool.isGridSnapEnabled)) gridSize = 1;
 
        // these are set in mouseMove's call to calcAngleAndLengthFromHandle()
        var angle = tool.angle;
        var length = tool.length;
 
        // snap to 90 degrees
        if (angle > 67.5 && angle < 112.5) {
            var newy = sPt.y + length;
            newy = gridSize * Math.round(newy / gridSize);
            newPoint = new go.Point(sPt.x, newy);
        }
        // snap to 180 degrees
        if (angle > 112.5 && angle < 202.5) {
            var newx = sPt.x - length;
            newx = gridSize * Math.round(newx / gridSize);
            newPoint = new go.Point(newx, sPt.y);
        }
        // snap to 270 degrees
        if (angle > 247.5 && angle < 292.5) {
            var newy = sPt.y - length;
            newy = gridSize * Math.round(newy / gridSize);
            newPoint = new go.Point(sPt.x, newy);
        }
        // snap to 360 degrees
        if (angle > 337.5 || angle < 22.5) {
            var newx = sPt.x + length;
            newx = gridSize * Math.round(newx / gridSize);
            newPoint = new go.Point(newx, sPt.y);
        }
        // snap to 45 degrees
        if (angle > 22.5 && angle < 67.5) {
            var newx = (Math.sin(.785) * length);
            newx = gridSize * Math.round(newx / gridSize) + sPt.x;
            var newy = (Math.cos(.785) * length);
            newy = gridSize * Math.round(newy / gridSize) + sPt.y;
            newPoint = new go.Point(newx, newy);
        }
        // snap to 135 degrees
        if (angle > 112.5 && angle < 157.5) {
            var newx = (Math.sin(.785) * length);
            newx = sPt.x - (gridSize * Math.round(newx / gridSize));
            var newy = (Math.cos(.785) * length);
            newy = gridSize * Math.round(newy / gridSize) + sPt.y;
            newPoint = new go.Point(newx, newy);
        }
        // snap to 225 degrees
        if (angle > 202.5 && angle < 247.5) {
            var newx = (Math.sin(.785) * length);
            newx = sPt.x - (gridSize * Math.round(newx / gridSize));
            var newy = (Math.cos(.785) * length);
            newy = sPt.y - (gridSize * Math.round(newy / gridSize));
            newPoint = new go.Point(newx, newy);
        }
        // snap to 315 degrees
        if (angle > 292.5 && angle < 337.5) {
            var newx = (Math.sin(.785) * length);
            newx = sPt.x + (gridSize * Math.round(newx / gridSize));
            var newy = (Math.cos(.785) * length);
            newy = sPt.y - (gridSize * Math.round(newy / gridSize));
            newPoint = new go.Point(newx, newy);
        }
        gridSize = oldGridSize; //set gridSize back to what it used to be in case gridSnap is enabled again
    }
    if (this.diagram.toolManager.draggingTool.isGridSnapEnabled) newPoint = this.snapPointToGrid(newPoint);
    else newPoint = new go.Point(newPoint.x, newPoint.y);
 
    var type = this.handle.name;
    if (type === undefined) return;
    // set the appropriate point in the node's data to the newPoint value 
    switch (type) {
        case 'sPt':
            reshapeWall(node, node.data.endpoint, node.data.startpoint, newPoint, diagram, tool);
            break;
        case 'ePt':
            reshapeWall(node, node.data.startpoint, node.data.endpoint, newPoint, diagram, tool);
            break;
    }
    this.updateAdornments(shape.part);
    this.showMatches();
    updateWallDimensions();
}
 
// maintain position of all wallParts as best as possible when a wall is being reshaped
// position is relative to the distance a wallPart's location is from the stationaryPoint of the wall
// this is called during WallReshapingTool's reshape function
function reshapeWall(wall, stationaryPoint, movingPoint, newPoint, diagram, tool) {
    var wallParts = wall.memberParts;
    var arr = [];
    var oldAngle = wall.rotateObject.angle;
    wallParts.iterator.each(function (part) { arr.push(part); });
    // remember the distance each wall part's location was from the stationary point; store these in a Map
    var distancesMap = new go.Map("string", "number");
    var closestPart  = null; var closestDistance = Number.MAX_VALUE;
    for (var i = 0; i < arr.length; i++) {
        var part = arr[i];
        var distanceToStationaryPt = Math.sqrt(part.location.distanceSquaredPoint(stationaryPoint));        
        distancesMap.add(part.data.key, distanceToStationaryPt);
        // distanceToMovingPt is determined by whichever endpoint of the wallpart is closest to movingPoint
        var endpoints = getWallPartEndpoints(part);
        var distanceToMovingPt = Math.min(Math.sqrt(endpoints[0].distanceSquaredPoint(movingPoint)),
                                Math.sqrt(endpoints[1].distanceSquaredPoint(movingPoint)));
        // find and store the closest wallPart to the movingPt
        if (distanceToMovingPt < closestDistance) {
            closestDistance = distanceToMovingPt;
            closestPart = part;
        }
    }
    // if the proposed newPoint would make it so the wall would reshape past closestPart, set newPoint to the edge point of closest part
    if (closestPart !== null) {
        var loc = closestPart.location;
        var partLength = closestPart.data.width;
        var angle = oldAngle;
        var point1 = new go.Point((loc.x + (partLength / 2)), loc.y);
        var point2 = new go.Point((loc.x - (partLength / 2)), loc.y);
        point1.offset(-loc.x, -loc.y).rotate(angle).offset(loc.x, loc.y);
        point2.offset(-loc.x, -loc.y).rotate(angle).offset(loc.x, loc.y);
        var distance1 = Math.sqrt(stationaryPoint.distanceSquaredPoint(point1));
        var distance2 = Math.sqrt(stationaryPoint.distanceSquaredPoint(point2));
 
        var minLength; var newLoc;
        if (distance1 > distance2) {
            minLength = distance1;
            newLoc = point1;
        } else {
            minLength = distance2;
            newLoc = point2;
        }
 
        var testDistance = Math.sqrt(stationaryPoint.distanceSquaredPoint(newPoint));
        if (testDistance < minLength) newPoint = newLoc;
    }
    // reshape the wall
    if (movingPoint === wall.data.endpoint) diagram.model.setDataProperty(wall.data, "endpoint", newPoint);
    else diagram.model.setDataProperty(wall.data, "startpoint", newPoint);
    updateWall(wall);
    // calculate the new angle offset
    var newAngle = wall.rotateObject.angle;
    var angleOffset = newAngle - oldAngle;
    // for each wallPart, maintain relative distance from the stationaryPoint
    distancesMap.iterator.each(function (kvp) {
        var wallPart = diagram.findPartForKey(kvp.key);
        var distance = kvp.value;
        var wallLength = Math.sqrt(stationaryPoint.distanceSquaredPoint(movingPoint));
        var newLoc = new go.Point(stationaryPoint.x + ((distance / wallLength) * (movingPoint.x - stationaryPoint.x)),
            stationaryPoint.y + ((distance / wallLength) * (movingPoint.y - stationaryPoint.y)));
        wallPart.location = newLoc;
        wallPart.angle = (wallPart.angle + angleOffset) % 360;
    });
}
 
// show if the wall (at the adjustment handle being moved) lines up with other wall edges 
WallReshapingTool.prototype.showMatches = function () {
    //if (!(document.getElementById('wallGuidelinesCheckbox').checked)) return;
    var diagram = this.diagram;
    if (!diagram.model.modelData.preferences.showWallGuidelines) return;
    var tool = this;
    var wall = this.adornedShape.part;
    var comparePt;
    if (this.handle.name === 'sPt') comparePt = wall.data.startpoint;
    else comparePt = wall.data.endpoint;
 
    // the wall attached to the handle being manipulated
    var hWall = this.adornedShape.part;
 
    // delete any old guideline points (these are used to show guidelines, must be cleared before a new guideline can be shown)
    var glPoints = diagram.findNodesByExample({ category: 'GLPointNode' });
    diagram.removeParts(glPoints, true);
 
    var walls = this.diagram.findNodesByExample({ category: 'WallGroup' });
    walls.iterator.each(function (w) {
        if (w.data.key != hWall.data.key) {
            var shape = w.findObject('SHAPE');
            var geo = shape.geometry;
 
            var pt1 = w.data.startpoint;
            var pt2 = w.data.endpoint;
 
            tool.checkPtLinedUp(pt1, comparePt.x, pt1.x, comparePt);
            tool.checkPtLinedUp(pt1, comparePt.y, pt1.y, comparePt);
            tool.checkPtLinedUp(pt2, comparePt.x, pt2.x, comparePt);
            tool.checkPtLinedUp(pt2, comparePt.y, pt2.y, comparePt);
        }
    })
}
 
// static function -- checks if there exists a horiontal or vertical line (decided by 'coord' parameter) between pt and compare pt
// if so, draws a link between the two, letting the user know the wall they're reshaping lines up with another's edge
WallReshapingTool.prototype.checkPtLinedUp = function (pt, comparePtCoord, ptCoord, comparePt) {
    function makeGuideLinePoint() {
        var $ = go.GraphObject.make;
        return $(go.Node, "Spot", { locationSpot: go.Spot.TopLeft, locationObjectName: "SHAPE", desiredSize: new go.Size(1, 1), },
        new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
        $(go.Shape, { stroke: null, strokeWidth: 1, name: "SHAPE", fill: "black", })
      );
    }
 
    function makeGuideLineLink() {
        var $ = go.GraphObject.make;
        return $(go.Link,
        $(go.Shape, { stroke: "black", strokeWidth: 2, name: 'SHAPE', },
        new go.Binding("strokeWidth", "width"),
        new go.Binding('stroke', 'stroke')
        )
    )
    }
 
    var diagram = this.diagram;
    var errorMargin = Math.abs(comparePtCoord - ptCoord);
    if (errorMargin < 2) {
 
        var data = { category: "GLPointNode", loc: go.Point.stringify(pt) };
        var data2 = { key: 'movingPt', category: "GLPointNode", loc: go.Point.stringify(comparePt) };
        var data3 = { key: 'guideline', category: 'guideLine', from: 'movingPt', to: data.key, stroke: 'blue' };
        var GLPoint1 = makeGuideLinePoint();
        var GLPoint2 = makeGuideLinePoint();
        var GLLink = makeGuideLineLink();
        diagram.add(GLPoint1);
        diagram.add(GLPoint2);
        diagram.add(GLLink);
 
        GLPoint1.data = data;
        GLPoint2.data = data2;
        GLLink.data = data3;
        GLLink.fromNode = GLPoint1;
        GLLink.toNode = GLPoint2;
    }
}
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/intro/

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/intro/

Statements: 4.59% (5 / 109)      Branches: 0% (0 / 35)      Functions: 0% (0 / 7)      Lines: 5% (5 / 100)      Ignored: none     

All files » node-npmtest-gojs/node_modules/gojs/intro/
File Statements Branches Functions Lines
goIntro.js 4.59% (5 / 109) 0% (0 / 35) 0% (0 / 7) 5% (5 / 100)
Code coverage report for node-npmtest-gojs/node_modules/gojs/intro/goIntro.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/intro/goIntro.js

Statements: 4.59% (5 / 109)      Branches: 0% (0 / 35)      Functions: 0% (0 / 7)      Lines: 5% (5 / 100)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280      2                         1                                                                                         1                                             1                                                                                                 1                                                                                                                                                                                                                                                                                                    
/* Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved. */
 
// Load necessary scripts:
if (window.require) {
  // declare required libraries and ensure Bootstrap's dependency on jQuery
  require.config({
    paths: {
      "highlight": "../assets/js/highlight",
      "jquery": "../assets/js/jquery.min", // 1.11.3
      "bootstrap": "../assets/js/bootstrap.min" },
    shim: {
      "bootstrap": ["jquery"]
    }
  });
  require(["highlight", "jquery", "bootstrap"], function() {});
} else {
  function goLoadSrc(filenames) {
    var scripts = document.getElementsByTagName("script");
    var script = null;
    for (var i = 0; i < scripts.length; i++) {
      if (scripts[i].src.indexOf("goIntro") > 0) {
        script = scripts[i];
        break;
      }
    }
    for (var i = 0; i < arguments.length; i++) {
      var filename = arguments[i];
      if (!filename) continue;
      var selt = document.createElement("script");
      selt.async = false;
      selt.defer = false;
      selt.src = "../assets/js/" + filename;
      script.parentNode.insertBefore(selt, script.nextSibling);
      script = selt;
    }
  }
  goLoadSrc("highlight.js", (window.jQuery ? "" : "jquery.min.js"), "bootstrap.min.js");
}
 
var head = document.getElementsByTagName("head")[0];
 
var link = document.createElement("link");
link.type = "text/css";
link.rel = "stylesheet";
link.href = "../assets/css/bootstrap.min.css";
head.appendChild(link);
 
link = document.createElement("link");
link.type = "text/css";
link.rel = "stylesheet";
link.href = "../assets/css/highlight.css";
head.appendChild(link);
 
link = document.createElement("link");
link.type = "text/css";
link.rel = "stylesheet";
link.href = "../assets/css/main.css";
head.appendChild(link);
 
// Create a DIV and add it to the document just after the PRE element.
// Evaluate the JavaScript text that is in the PRE element in order to initialize the Diagram.
function goCode(pre, w, h, diagramclass, parentid) {
  if (diagramclass === undefined) diagramclass = go.Diagram;
  if (typeof pre === "string") pre = document.getElementById(pre);
  var div = document.createElement("div");
  div.style.width = w + "px";
  div.style.height = h + "px";
  div.className = "diagramStyling";
  var parent;
  if (parentid === undefined) {
    parent = pre.parentNode;
  } else {
    parent = document.getElementById(parentid);
  }
  parent.appendChild(div);
  // temporarily bind "diagram" to the main Diagram for the DIV, and "$" to go.GraphObject.make
  var f = eval("(function (diagram, $) {" + pre.textContent + "})");
  f(new diagramclass(div), go.GraphObject.make);
}
 
// Traverse the whole document and replace <a>TYPENAME</a> with:
//    <a href="../api/symbols/TYPENAME.html">TYPENAME</a>
// and <a>TYPENAME.MEMBERNAME</a> with:
//    <a href="../api/symbols/TYPENAME.html#MEMBERNAME">TYPENAME.MEMBERNAME</a>
function goIntro() {
  _traverseDOM(document);
 
  // add class to main content
  var content = document.getElementById('content');
  content.className = "col-md-10";
 
  // side navigation
  var navindex = document.createElement('div');
  navindex.id = "navindex";
  navindex.className = "col-md-2";
  navindex.innerHTML = myMenu;
  var container = document.getElementById('container');
  container.insertBefore(navindex, content);
 
 
  // top navbar
  var navbar = document.createElement('div');
  navbar.innerHTML = myNavbar;
  document.body.insertBefore(navbar, container);
 
  // footer
  var footer = document.createElement("div");
  footer.className = "footer";
  var msg = "Copyright &copy; 1998-2017 by Northwoods Software Corporation.";
  if (go && go.version) {
    msg = "GoJS&reg; version " + go.version + ". " + msg;
  }
  footer.innerHTML = msg;
  content.appendChild(footer);
 
 
  // When the page loads, change the class of li's to highlight the current page
  var url = window.location.href;
  var lindex = url.lastIndexOf('/');
  url = url.slice(lindex+1).toLowerCase();
  var lis = document.getElementById("sections").getElementsByTagName("li");
  var l = lis.length;
  for (var i = 0; i < l; i++) {
    var lowerhref = lis[i].childNodes[0].href.toLowerCase();
    if (lowerhref.indexOf('intro') === -1) continue;
    if (lowerhref.indexOf('/' + url) !== -1) {
      lis[i].childNodes[0].className = "selected";
      return;
    }
  }
 
}
 
function _traverseDOM(node) {
  if (node.nodeType === 1 && node.nodeName === "A" && !node.getAttribute("href")) {
    var text = node.innerHTML.split(".");
    if (text.length === 1) {
      node.setAttribute("href", "../api/symbols/" + text[0] + ".html");
      node.setAttribute("target", "api");
    } else if (text.length === 2) {
      node.setAttribute("href", "../api/symbols/" + text[0] + ".html" + "#" + text[1]);
      node.setAttribute("target", "api");
    } else {
      alert("Unknown API reference: " + node.innerHTML);
    }
  }
  for (var i = 0; i < node.childNodes.length; i++) {
    _traverseDOM(node.childNodes[i]);
  }
}
 
 
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
 
ga('create', 'UA-1506307-5', 'auto');
ga('send', 'pageview');
 
 
 
//<![CDATA[
var myMenu = '\
  <div class="sidebar-nav">\
  <div class="navbar navbar-default" role="navigation">\
    <div class="navbar-header">\
      <div class="navheader-container">\
        <div class="navheader-collapse" data-toggle="collapse" data-target="#DiagramNavbar">\
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#DiagramNavbar">\
            <span class="sr-only">Toggle navigation</span>\
            <span class="icon-bar"></span>\
            <span class="icon-bar"></span>\
            <span class="icon-bar"></span>\
          </button>\
        </div>\
        <span class="navbar-brand">Introduction</span>\
      </div>\
    </div>\
    <div id="DiagramNavbar" class="navbar-collapse collapse sidebar-navbar-collapse">\
    <ul id="sections" class="classList nav navbar-nav">\
      <li><a href="index.html">Basics</a></li>\
      <li><a href="buildingObjects.html">Building Parts</a></li>\
      <li><a href="textBlocks.html">TextBlocks</a></li>\
      <li><a href="shapes.html">Shapes</a></li>\
      <li><a href="pictures.html">Pictures</a></li>\
      <li><a href="panels.html">Panels</a></li>\
      <li><a href="tablePanels.html">Table Panels</a></li>\
      <li><a href="brush.html">Brushes</a></li>\
      <li><a href="sizing.html">Sizing Objects</a></li>\
      <li><a href="usingModels.html">Using Models</a></li>\
      <li><a href="dataBinding.html">Data Binding</a></li>\
      <li><a href="itemArrays.html">Item Arrays</a></li>\
      <li><a href="changedEvents.html">Changed Events</a></li>\
      <li><a href="transactions.html">Transactions</a></li>\
      <li><a href="viewport.html">Coordinates</a></li>\
      <li><a href="initialView.html">Initial View</a></li>\
      <li><a href="collections.html">Collections</a></li>\
      <li><a href="links.html">Links</a></li>\
      <li><a href="linkLabels.html">Link Labels</a></li>\
      <li><a href="connectionPoints.html">Link Points</a></li>\
      <li><a href="ports.html">Ports</a></li>\
      <li><a href="nodes.html">Nodes</a></li>\
      <li><a href="layouts.html">Layouts</a></li>\
      <li><a href="trees.html">Trees</a></li>\
      <li><a href="subtrees.html">SubTrees</a></li>\
      <li><a href="groups.html">Groups</a></li>\
      <li><a href="subgraphs.html">SubGraphs</a></li>\
      <li><a href="sizedGroups.html">Sized Groups</a></li>\
      <li><a href="selection.html">Selection</a></li>\
      <li><a href="highlighting.html">Highlighting</a></li>\
      <li><a href="toolTips.html">ToolTips</a></li>\
      <li><a href="contextmenus.html">Context Menus</a></li>\
      <li><a href="events.html">Diagram Events</a></li>\
      <li><a href="tools.html">Tools</a></li>\
      <li><a href="commands.html">Commands</a></li>\
      <li><a href="permissions.html">Permissions</a></li>\
      <li><a href="validation.html">Validation</a></li>\
      <li><a href="HTMLInteraction.html">HTML Interaction</a></li>\
      <li><a href="layers.html">Layers &amp; Z-ordering</a></li>\
      <li><a href="palette.html">Palette</a></li>\
      <li><a href="overview.html">Overview</a></li>\
      <li><a href="resizing.html">Resizing Diagrams</a></li>\
      <li><a href="buttons.html">Buttons</a></li>\
      <li><a href="templateMaps.html">Template Maps</a></li>\
      <li><a href="legends.html">Legends and Titles</a></li>\
      <li><a href="extensions.html">Extensions</a></li>\
      <li><a href="geometry.html">Geometry Strings</a></li>\
      <li><a href="grids.html">Grid Patterns</a></li>\
      <li><a href="graduatedPanels.html">Graduated Panels</a></li>\
      <li><a href="makingImages.html">Diagram Images</a></li>\
      <li><a href="makingSVG.html">Diagram SVG</a></li>\
      <li><a href="printing.html">Printing</a></li>\
      <li><a href="serverSideImages.html">Server-side Images</a></li>\
      <li><a href="performance.html">Performance</a></li>\
      <li><a href="deployment.html">Deployment</a></li>\
    </ul>\
    </div>\
  </div>\
  </div>';
//]]>
 
 
//<![CDATA[
var myNavbar = '\
  <!-- non-fixed navbar -->\
  <nav id="non-fixed-nav" class="navbar navbar-inverse navbar-top">\
    <div class="container-fluid">\
      <div class="navbar-header">\
        <div class="navheader-container">\
          <div class="navheader-collapse" data-toggle="collapse" data-target="#navbar">\
            <a id="toplogo" class="navbar-brand" href="../index.html">GoJS</a>\
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">\
              <span class="sr-only">Toggle navigation</span>\
              <span class="icon-bar"></span>\
              <span class="icon-bar"></span>\
              <span class="icon-bar"></span>\
            </button>\
          </div>\
        </div>\
      </div>\
      <div id="navbar" class="navbar-collapse collapse">\
        <ul class="nav navbar-nav navbar-right">\
          <li><a href="../index.html">Home</a></li>\
          <li><a href="../learn/index.html">Learn</a></li>\
          <li><a href="../samples/index.html">Samples</a></li>\
          <li><a href="../intro/index.html">Intro</a></li>\
          <li><a href="../api/index.html" target="api">API</a></li>\
          <li><a href="https://www.nwoods.com/components/evalform.htm">Register</a></li>\
          <li><a href="../doc/download.html">Download</a></li>\
          <li><a href="https://forum.nwoods.com/c/gojs">Forum</a></li>\
          <li><a href="https://www.nwoods.com/contact.html" onclick="ga(\'send\',\'event\',\'Outbound Link\',\'click\',\'contact\');">Contact</a></li>\
          <li class="buy"><a href="https://www.nwoods.com/sales/index.html" onclick="ga(\'send\',\'event\',\'Outbound Link\',\'click\',\'buy\');">Buy</a></li>\
          <li class="activate"><a href="https://www.nwoods.com/app/activate.aspx?sku=gojs">Activate</a></li>\
        </ul>\
      </div><!--/.nav-collapse -->\
    </div>\
  </nav>';
//]]>
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/projects/electron-circuit/

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/projects/electron-circuit/

Statements: 3.7% (3 / 81)      Branches: 0% (0 / 33)      Functions: 0% (0 / 13)      Lines: 4.17% (3 / 72)      Ignored: none     

All files » node-npmtest-gojs/node_modules/gojs/projects/electron-circuit/
File Statements Branches Functions Lines
PortShiftingTool.js 2.99% (2 / 67) 0% (0 / 31) 0% (0 / 10) 3.45% (2 / 58)
main.js 7.14% (1 / 14) 0% (0 / 2) 0% (0 / 3) 7.14% (1 / 14)
Code coverage report for node-npmtest-gojs/node_modules/gojs/projects/electron-circuit/PortShiftingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/projects/electron-circuit/PortShiftingTool.js

Statements: 2.99% (2 / 67)      Branches: 0% (0 / 31)      Functions: 0% (0 / 10)      Lines: 3.45% (2 / 58)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153                                1                 2                                                                                                                                                                                                                                                              
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom Tool for moving a port on a Node
 
/**
* @constructor
* @extends Tool
* @class
* This tool only works when the Node has a port (any GraphObject) marked with
* a non-null and non-empty portId that is positioned in a Spot Panel,
* and the user holds down the Shift key.
* It works by modifying that port's GraphObject.alignment property.
*/
function PortShiftingTool() {
  go.Tool.call(this);
  this.name = "NodeLabelDragging";
 
  /** @type {GraphObject} */
  this.port = null;
  /** @type {Point} */
  this._originalAlignment = null;
}
go.Diagram.inherit(PortShiftingTool, go.Tool);
 
/**
* This tool can only start if the mouse has moved enough so that it is not a click,
* and if the mouse down point is on a GraphObject "port" in a Spot Panel,
* as determined by findPort().
* @this {PortShiftingTool}
* @return {boolean}
*/
PortShiftingTool.prototype.canStart = function() {
  if (!go.Tool.prototype.canStart.call(this)) return false;
  var diagram = this.diagram;
  if (diagram === null) return false;
  // require left button & that it has moved far enough away from the mouse down point, so it isn't a click
  var e = diagram.lastInput;
  if (!e.left || !e.shift) return false;
  if (!this.isBeyondDragSize()) return false;
 
  return this.findPort() !== null;
}
 
/**
* From the GraphObject at the mouse point, search up the visual tree until we get to
* an object that has the portId property set to a non-empty string, that is in a Spot Panel,
* and that is not the main element of the panel (typically the first element).
* @this {PortShiftingTool}
* @return {GraphObject} This returns null if no such port is at the mouse down point.
*/
PortShiftingTool.prototype.findPort = function() {
  var diagram = this.diagram;
  var e = diagram.firstInput;
  var elt = diagram.findObjectAt(e.documentPoint, null, null);
 
  if (elt === null || !(elt.part instanceof go.Node)) return null;
  while (elt.panel !== null && elt.panel.type === go.Panel.Spot && elt.panel.findMainElement() !== elt) {
    if (elt.portId !== null && elt.portId !== "") return elt;
    elt = elt.panel;
  }
  return null;
};
 
/**
* Start a transaction, call findPort and remember it as the "port" property,
* and remember the original value for the port's alignment property.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.doActivate = function() {
  this.startTransaction("Shifted Label");
  this.port = this.findPort();
  if (this.port !== null) {
    this._originalAlignment = this.port.alignment.copy();
    var main = this.port.panel.findMainElement();
  }
  go.Tool.prototype.doActivate.call(this);
}
 
/**
* Stop any ongoing transaction.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.doDeactivate = function() {
  go.Tool.prototype.doDeactivate.call(this);
  this.stopTransaction();
}
 
/**
* Clear any reference to a port element.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.doStop = function() {
  this.port = null;
  go.Tool.prototype.doStop.call(this);
}
 
/**
* Restore the port's original value for GraphObject.alignment.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.doCancel = function() {
  if (this.port !== null) {
    this.port.alignment = this._originalAlignment;
  }
  go.Tool.prototype.doCancel.call(this);
}
 
/**
* During the drag, call updateAlignment in order to set the GraphObject.alignment of the port.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.doMouseMove = function() {
  if (!this.isActive) return;
  this.updateAlignment();
}
 
/**
* At the end of the drag, update the alignment of the port and finish the tool,
* completing a transaction.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.doMouseUp = function() {
  if (!this.isActive) return;
  this.updateAlignment();
  this.transactionResult = "Shifted Label";
  this.stopTool();
}
 
/**
* Save the port's GraphObject.alignment as a fractional Spot in the Spot Panel
* that the port is in.  Thus if the main element changes size, the relative positions
* of the ports will be maintained.  But that does assume that the port must remain
* inside the main element -- it cannot wander away from the node.
* This does not modify the port's GraphObject.alignmentFocus property.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.updateAlignment = function() {
  if (this.port === null) return;
  var last = this.diagram.lastInput.documentPoint;
  var main = this.port.panel.findMainElement();
  var tl = main.getDocumentPoint(go.Spot.TopLeft);
  var br = main.getDocumentPoint(go.Spot.BottomRight);
  var x = Math.max(0, Math.min((last.x - tl.x) / (br.x - tl.x), 1));
  var y = Math.max(0, Math.min((last.y - tl.y) / (br.y - tl.y), 1));
  this.port.alignment = new go.Spot(x, y);
}
 
module.exports = PortShiftingTool;  // for use in CommonJS environment
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/projects/electron-circuit/main.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/projects/electron-circuit/main.js

Statements: 7.14% (1 / 14)      Branches: 0% (0 / 2)      Functions: 0% (0 / 3)      Lines: 7.14% (1 / 14)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 422                                                                                  
const electron = require('electron');
const app = electron.app;  // Module to control application life.
const BrowserWindow = electron.BrowserWindow;  // Module to create native browser window.
 
// Report crashes to our server.
electron.crashReporter.start();
 
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
var mainWindow = null;
 
// Quit when all windows are closed.
app.on('window-all-closed', function () {
  // On OS X it is common for applications and their menu bar
  // to stay active until the user quits explicitly with Cmd + Q
  if (process.platform != 'darwin') {
    app.quit();
  }
});
 
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
app.on('ready', function () {
  // Create the browser window.
  mainWindow = new BrowserWindow({ width: 1600, height: 900 });
 
  // and load the index.html of the app.
  mainWindow.loadURL('file://' + __dirname + '/logicCircuit.html');
 
  // Open the DevTools.
  mainWindow.webContents.openDevTools();
 
  // Emitted when the window is closed.
  mainWindow.on('closed', function () {
    // Dereference the window object, usually you would store windows
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    mainWindow = null;
  });
});
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/projects/nw-circuit/

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/projects/nw-circuit/

Statements: 3.03% (2 / 66)      Branches: 0% (0 / 31)      Functions: 0% (0 / 10)      Lines: 3.51% (2 / 57)      Ignored: none     

All files » node-npmtest-gojs/node_modules/gojs/projects/nw-circuit/
File Statements Branches Functions Lines
PortShiftingTool.js 3.03% (2 / 66) 0% (0 / 31) 0% (0 / 10) 3.51% (2 / 57)
Code coverage report for node-npmtest-gojs/node_modules/gojs/projects/nw-circuit/PortShiftingTool.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/projects/nw-circuit/PortShiftingTool.js

Statements: 3.03% (2 / 66)      Branches: 0% (0 / 31)      Functions: 0% (0 / 10)      Lines: 3.51% (2 / 57)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151                                1                 2                                                                                                                                                                                                                                                          
"use strict";
/*
*  Copyright (C) 1998-2017 by Northwoods Software Corporation. All Rights Reserved.
*/
 
// A custom Tool for moving a port on a Node
 
/**
* @constructor
* @extends Tool
* @class
* This tool only works when the Node has a port (any GraphObject) marked with
* a non-null and non-empty portId that is positioned in a Spot Panel,
* and the user holds down the Shift key.
* It works by modifying that port's GraphObject.alignment property.
*/
function PortShiftingTool() {
  go.Tool.call(this);
  this.name = "NodeLabelDragging";
 
  /** @type {GraphObject} */
  this.port = null;
  /** @type {Point} */
  this._originalAlignment = null;
}
go.Diagram.inherit(PortShiftingTool, go.Tool);
 
/**
* This tool can only start if the mouse has moved enough so that it is not a click,
* and if the mouse down point is on a GraphObject "port" in a Spot Panel,
* as determined by findPort().
* @this {PortShiftingTool}
* @return {boolean}
*/
PortShiftingTool.prototype.canStart = function() {
  if (!go.Tool.prototype.canStart.call(this)) return false;
  var diagram = this.diagram;
  if (diagram === null) return false;
  // require left button & that it has moved far enough away from the mouse down point, so it isn't a click
  var e = diagram.lastInput;
  if (!e.left || !e.shift) return false;
  if (!this.isBeyondDragSize()) return false;
 
  return this.findPort() !== null;
}
 
/**
* From the GraphObject at the mouse point, search up the visual tree until we get to
* an object that has the portId property set to a non-empty string, that is in a Spot Panel,
* and that is not the main element of the panel (typically the first element).
* @this {PortShiftingTool}
* @return {GraphObject} This returns null if no such port is at the mouse down point.
*/
PortShiftingTool.prototype.findPort = function() {
  var diagram = this.diagram;
  var e = diagram.firstInput;
  var elt = diagram.findObjectAt(e.documentPoint, null, null);
 
  if (elt === null || !(elt.part instanceof go.Node)) return null;
  while (elt.panel !== null && elt.panel.type === go.Panel.Spot && elt.panel.findMainElement() !== elt) {
    if (elt.portId !== null && elt.portId !== "") return elt;
    elt = elt.panel;
  }
  return null;
};
 
/**
* Start a transaction, call findPort and remember it as the "port" property,
* and remember the original value for the port's alignment property.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.doActivate = function() {
  this.startTransaction("Shifted Label");
  this.port = this.findPort();
  if (this.port !== null) {
    this._originalAlignment = this.port.alignment.copy();
    var main = this.port.panel.findMainElement();
  }
  go.Tool.prototype.doActivate.call(this);
}
 
/**
* Stop any ongoing transaction.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.doDeactivate = function() {
  go.Tool.prototype.doDeactivate.call(this);
  this.stopTransaction();
}
 
/**
* Clear any reference to a port element.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.doStop = function() {
  this.port = null;
  go.Tool.prototype.doStop.call(this);
}
 
/**
* Restore the port's original value for GraphObject.alignment.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.doCancel = function() {
  if (this.port !== null) {
    this.port.alignment = this._originalAlignment;
  }
  go.Tool.prototype.doCancel.call(this);
}
 
/**
* During the drag, call updateAlignment in order to set the GraphObject.alignment of the port.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.doMouseMove = function() {
  if (!this.isActive) return;
  this.updateAlignment();
}
 
/**
* At the end of the drag, update the alignment of the port and finish the tool,
* completing a transaction.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.doMouseUp = function() {
  if (!this.isActive) return;
  this.updateAlignment();
  this.transactionResult = "Shifted Label";
  this.stopTool();
}
 
/**
* Save the port's GraphObject.alignment as a fractional Spot in the Spot Panel
* that the port is in.  Thus if the main element changes size, the relative positions
* of the ports will be maintained.  But that does assume that the port must remain
* inside the main element -- it cannot wander away from the node.
* This does not modify the port's GraphObject.alignmentFocus property.
* @this {PortShiftingTool}
*/
PortShiftingTool.prototype.updateAlignment = function() {
  if (this.port === null) return;
  var last = this.diagram.lastInput.documentPoint;
  var main = this.port.panel.findMainElement();
  var tl = main.getDocumentPoint(go.Spot.TopLeft);
  var br = main.getDocumentPoint(go.Spot.BottomRight);
  var x = Math.max(0, Math.min((last.x - tl.x) / (br.x - tl.x), 1));
  var y = Math.max(0, Math.min((last.y - tl.y) / (br.y - tl.y), 1));
  this.port.alignment = new go.Spot(x, y);
}
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/projects/phantom-circuit/

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/projects/phantom-circuit/

Statements: 13.45% (16 / 119)      Branches: 0% (0 / 33)      Functions: 0% (0 / 28)      Lines: 15.24% (16 / 105)      Ignored: none     

All files » node-npmtest-gojs/node_modules/gojs/projects/phantom-circuit/
File Statements Branches Functions Lines
logicCircuit.js 13.45% (16 / 119) 0% (0 / 33) 0% (0 / 28) 15.24% (16 / 105)
Code coverage report for node-npmtest-gojs/node_modules/gojs/projects/phantom-circuit/logicCircuit.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/projects/phantom-circuit/logicCircuit.js

Statements: 13.45% (16 / 119)      Branches: 0% (0 / 33)      Functions: 0% (0 / 28)      Lines: 15.24% (16 / 105)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348            2                                                                                                 1                     1                   1                                                                                                                                                                                                                                                                                                               1                                                     1         1             1         1       1       1         1       1         1           1             1                                                                                
// Example of (server-side or headless) image creation using PhantomJS
// PhantomJS can be found at: http://phantomjs.org/
 
// Our page will contain nothing but a div tag and an img tag.
// We will create our Diagram on the div and use Diagram.makeImageData to give the img a source.
// Then we will render only the image created.
var page = require('webpage').create();
 
page.onConsoleMessage = function(msg) {  // show console messages from WebKit
  console.log('--- ' + msg);
};
 
page.content = '<html><body style="margin:0px"><div id="myDiagram"></div><img id="myImg" /></body></html>';
 
// We include go.js before acting on our page, assuming it is in the same directory
page.injectJs('./node_modules/gojs/release/go.js');
 
page.onLoadFinished = function(status) {
  page.evaluate(function() {
    // GoJS and the skeleton page are loaded, now we set up a diagram and make the image we want
 
    // This example GoJS code is taken from the logicCircuit.html sample.
    // Note that much of the interactivity customizations have been excised:
    // tools, tooltips, palette, undo, the Save and Load buttons and model textarea,
    // and continuous updating of the state.
 
    var red = "orangered";  // 0 or false
    var green = "forestgreen";  // 1 or true
 
    var $ = go.GraphObject.make;  // for conciseness in defining templates
 
    myDiagram =
      $(go.Diagram, "myDiagram",  // create a new Diagram in the HTML DIV element "myDiagram"
        {
          initialContentAlignment: go.Spot.Center,
          hasHorizontalScrollbar: false,
          hasVerticalScrollbar: false
        });
 
    // creates relinkable Links that will avoid crossing Nodes when possible and will jump over other Links in their paths
    myDiagram.linkTemplate =
      $(go.Link,
        {
          routing: go.Link.AvoidsNodes,
          curve: go.Link.JumpOver,
          corner: 3,
          relinkableFrom: true, relinkableTo: true,
          selectionAdorned: false, // Links are not adorned when selected so that their color remains visible.
          shadowOffset: new go.Point(0, 0), shadowBlur: 5, shadowColor: "blue",
        },
        new go.Binding("isShadowed", "isSelected").ofObject(),
        $(go.Shape,
          { name: "SHAPE", strokeWidth: 2, stroke: red }));
 
    // define some common property settings
    function nodeStyle() {
      return [new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
              new go.Binding("isShadowed", "isSelected").ofObject(),
              {
                selectionAdorned: false,
                shadowOffset: new go.Point(0, 0),
                shadowBlur: 15,
                shadowColor: "blue"
              }];
    }
 
    function shapeStyle() {
      return {
        name: "NODESHAPE",
        fill: "lightgray",
        stroke: "darkslategray",
        desiredSize: new go.Size(40, 40),
        strokeWidth: 2
      };
    }
 
    function portStyle(input) {
      return {
        desiredSize: new go.Size(6, 6),
        fill: "black",
        fromSpot: go.Spot.Right,
        fromLinkable: !input,
        toSpot: go.Spot.Left,
        toLinkable: input,
        toMaxLinks: 1,
        cursor: "pointer"
      };
    }
 
    // define templates for each type of node
    var inputTemplate =
      $(go.Node, "Spot", nodeStyle(),
        $(go.Shape, "Circle", shapeStyle(),
          { fill: red }),  // override the default fill (from shapeStyle()) to be red
        $(go.Shape, "Rectangle", portStyle(false),  // the only port
          { portId: "", alignment: new go.Spot(1, 0.5) }),
        { // if double-clicked, an input node will change its value, represented by the color.
          doubleClick: function(e, obj) {
            e.diagram.startTransaction("Toggle Input");
            var shp = obj.findObject("NODESHAPE");
            shp.fill = (shp.fill === green) ? red : green;
            updateStates();
            e.diagram.commitTransaction("Toggle Input");
          }
        }
      );
 
    var outputTemplate =
      $(go.Node, "Spot", nodeStyle(),
        $(go.Shape, "Rectangle", shapeStyle(),
          { fill: green }),  // override the default fill (from shapeStyle()) to be green
        $(go.Shape, "Rectangle", portStyle(true),  // the only port
          { portId: "", alignment: new go.Spot(0, 0.5) })
      );
 
    var andTemplate =
      $(go.Node, "Spot", nodeStyle(),
        $(go.Shape, "AndGate", shapeStyle()),
        $(go.Shape, "Rectangle", portStyle(true),
          { portId: "in1", alignment: new go.Spot(0, 0.3) }),
        $(go.Shape, "Rectangle", portStyle(true),
          { portId: "in2", alignment: new go.Spot(0, 0.7) }),
        $(go.Shape, "Rectangle", portStyle(false),
          { portId: "out", alignment: new go.Spot(1, 0.5) })
      );
 
    var orTemplate =
      $(go.Node, "Spot", nodeStyle(),
        $(go.Shape, "OrGate", shapeStyle()),
        $(go.Shape, "Rectangle", portStyle(true),
          { portId: "in1", alignment: new go.Spot(0.16, 0.3) }),
        $(go.Shape, "Rectangle", portStyle(true),
          { portId: "in2", alignment: new go.Spot(0.16, 0.7) }),
        $(go.Shape, "Rectangle", portStyle(false),
          { portId: "out", alignment: new go.Spot(1, 0.5) })
      );
 
    var xorTemplate =
      $(go.Node, "Spot", nodeStyle(),
        $(go.Shape, "XorGate", shapeStyle()),
        $(go.Shape, "Rectangle", portStyle(true),
          { portId: "in1", alignment: new go.Spot(0.26, 0.3) }),
        $(go.Shape, "Rectangle", portStyle(true),
          { portId: "in2", alignment: new go.Spot(0.26, 0.7) }),
        $(go.Shape, "Rectangle", portStyle(false),
          { portId: "out", alignment: new go.Spot(1, 0.5) })
      );
 
    var norTemplate =
      $(go.Node, "Spot", nodeStyle(),
        $(go.Shape, "NorGate", shapeStyle()),
        $(go.Shape, "Rectangle", portStyle(true),
          { portId: "in1", alignment: new go.Spot(0.16, 0.3) }),
        $(go.Shape, "Rectangle", portStyle(true),
          { portId: "in2", alignment: new go.Spot(0.16, 0.7) }),
        $(go.Shape, "Rectangle", portStyle(false),
          { portId: "out", alignment: new go.Spot(1, 0.5) })
      );
 
    var xnorTemplate =
      $(go.Node, "Spot", nodeStyle(),
        $(go.Shape, "XnorGate", shapeStyle()),
        $(go.Shape, "Rectangle", portStyle(true),
          { portId: "in1", alignment: new go.Spot(0.26, 0.3) }),
        $(go.Shape, "Rectangle", portStyle(true),
          { portId: "in2", alignment: new go.Spot(0.26, 0.7) }),
        $(go.Shape, "Rectangle", portStyle(false),
          { portId: "out", alignment: new go.Spot(1, 0.5) })
      );
 
    var nandTemplate =
      $(go.Node, "Spot", nodeStyle(),
        $(go.Shape, "NandGate", shapeStyle()),
        $(go.Shape, "Rectangle", portStyle(true),
          { portId: "in1", alignment: new go.Spot(0, 0.3) }),
        $(go.Shape, "Rectangle", portStyle(true),
          { portId: "in2", alignment: new go.Spot(0, 0.7) }),
        $(go.Shape, "Rectangle", portStyle(false),
          { portId: "out", alignment: new go.Spot(1, 0.5) })
      );
 
    var notTemplate =
      $(go.Node, "Spot", nodeStyle(),
        $(go.Shape, "Inverter", shapeStyle()),
        $(go.Shape, "Rectangle", portStyle(true),
          { portId: "in", alignment: new go.Spot(0, 0.5) }),
        $(go.Shape, "Rectangle", portStyle(false),
          { portId: "out", alignment: new go.Spot(1, 0.5) })
      );
 
    // add the templates created above to myDiagram and palette
    myDiagram.nodeTemplateMap.add("input", inputTemplate);
    myDiagram.nodeTemplateMap.add("output", outputTemplate);
    myDiagram.nodeTemplateMap.add("and", andTemplate);
    myDiagram.nodeTemplateMap.add("or", orTemplate);
    myDiagram.nodeTemplateMap.add("xor", xorTemplate);
    myDiagram.nodeTemplateMap.add("not", notTemplate);
    myDiagram.nodeTemplateMap.add("nand", nandTemplate);
    myDiagram.nodeTemplateMap.add("nor", norTemplate);
    myDiagram.nodeTemplateMap.add("xnor", xnorTemplate);
 
    // load the initial diagram directly from a string
    myDiagram.model = go.Model.fromJson('\
{ "class": "go.GraphLinksModel",\
  "linkFromPortIdProperty": "fromPort",\
  "linkToPortIdProperty": "toPort",\
  "nodeDataArray": [\
{"category":"input", "key":"input1", "loc":"-150 -80" },\
{"category":"or", "key":"or1", "loc":"-70 0" },\
{"category":"not", "key":"not1", "loc":"10 0" },\
{"category":"xor", "key":"xor1", "loc":"100 0" },\
{"category":"or", "key":"or2", "loc":"200 0" },\
{"category":"output", "key":"output1", "loc":"200 -100" }\
  ],\
  "linkDataArray": [\
{"from":"input1", "fromPort":"out", "to":"or1", "toPort":"in1"},\
{"from":"or1", "fromPort":"out", "to":"not1", "toPort":"in"},\
{"from":"not1", "fromPort":"out", "to":"or1", "toPort":"in2"},\
{"from":"not1", "fromPort":"out", "to":"xor1", "toPort":"in1"},\
{"from":"xor1", "fromPort":"out", "to":"or2", "toPort":"in1"},\
{"from":"or2", "fromPort":"out", "to":"xor1", "toPort":"in2"},\
{"from":"xor1", "fromPort":"out", "to":"output1", "toPort":""}\
  ]}');
 
    // update the diagram only once
    updateStates();
 
    // update the value and appearance of each node according to its type and input values
    function updateStates() {
      var oldskip = myDiagram.skipsUndoManager;
      myDiagram.skipsUndoManager = true;
      // do all "input" nodes first
      myDiagram.nodes.each(function(node) {
        if (node.category === "input") {
          doInput(node);
        }
      });
      // now we can do all other kinds of nodes
      myDiagram.nodes.each(function(node) {
        switch (node.category) {
          case "and": doAnd(node); break;
          case "or": doOr(node); break;
          case "xor": doXor(node); break;
          case "not": doNot(node); break;
          case "nand": doNand(node); break;
          case "nor": doNor(node); break;
          case "xnor": doXnor(node); break;
          case "output": doOutput(node); break;
          case "input": break;  // doInput already called, above
        }
      });
      myDiagram.skipsUndoManager = oldskip;
    }
 
    // helper predicate
    function linkIsTrue(link) {  // assume the given Link has a Shape named "SHAPE"
      return link.findObject("SHAPE").stroke === green;
    }
 
    // helper function for propagating results
    function setOutputLinks(node, color) {
      node.findLinksOutOf().each(function(link) { link.findObject("SHAPE").stroke = color; });
    }
 
    // update nodes by the specific function for its type
    // determine the color of links coming out of this node based on those coming in and node type
 
    function doInput(node) {
      // the output is just the node's Shape.fill
      setOutputLinks(node, node.findObject("NODESHAPE").fill);
    }
 
    function doAnd(node) {
      var color = node.findLinksInto().all(linkIsTrue) ? green : red;
      setOutputLinks(node, color);
    }
    function doNand(node) {
      var color = !node.findLinksInto().all(linkIsTrue) ? green : red;
      setOutputLinks(node, color);
    }
    function doNot(node) {
      var color = !node.findLinksInto().all(linkIsTrue) ? green : red;
      setOutputLinks(node, color);
    }
 
    function doOr(node) {
      var color = node.findLinksInto().any(linkIsTrue) ? green : red;
      setOutputLinks(node, color);
    }
    function doNor(node) {
      var color = !node.findLinksInto().any(linkIsTrue) ? green : red;
      setOutputLinks(node, color);
    }
 
    function doXor(node) {
      var truecount = 0;
      node.findLinksInto().each(function(link) { if (linkIsTrue(link)) truecount++; });
      var color = truecount % 2 === 0 ? green : red;
      setOutputLinks(node, color);
    }
    function doXnor(node) {
      var truecount = 0;
      node.findLinksInto().each(function(link) { if (linkIsTrue(link)) truecount++; });
      var color = truecount % 2 !== 0 ? green : red;
      setOutputLinks(node, color);
    }
 
    function doOutput(node) {
      // assume there is just one input link
      // we just need to update the node's Shape.fill
      node.linksConnected.each(function(link) { node.findObject("NODESHAPE").fill = link.findObject("SHAPE").stroke; });
    }
    // end of code from logicCircuit.html sample
    
    var img = document.getElementById('myImg');
    img.src = myDiagram.makeImageData({
      scale: 1,
      // PhantomJS tends to handle transparency poorly in the images it renders,
      // so we prefer to use a white background:
      background: "white"
    })
  });  // end onLoadFinished
 
  // We want to ensure that the image is done loading before we render
  setInterval(function() {
    var imgComplete = page.evaluate(function() {
      return document.getElementById('myImg').complete;
    });
 
    if (imgComplete) {
      // PhantomJS renders the entire page, and we just want to output the <img>,
      // so we must clip to its bounding rect:
      var clipRect = page.evaluate(function() {
        return document.getElementById('myImg').getBoundingClientRect();
      });
      page.clipRect = {
        top: clipRect.top,
        left: clipRect.left,
        width: clipRect.width,
        height: clipRect.height
      }
      page.render('logicCircuit.png');
      phantom.exit();
    }
  }, 100);
};
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/release/

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/release/

Statements: 1.96% (1201 / 61158)      Branches: 0% (0 / 51623)      Functions: 0% (0 / 8622)      Lines: 23.34% (965 / 4135)      Ignored: none     

All files » node-npmtest-gojs/node_modules/gojs/release/
File Statements Branches Functions Lines
go-debug.js 1.95% (603 / 30977) 0% (0 / 26618) 0% (0 / 4346) 22.93% (485 / 2115)
go.js 1.98% (598 / 30181) 0% (0 / 25005) 0% (0 / 4276) 23.76% (480 / 2020)
Code coverage report for node-npmtest-gojs/node_modules/gojs/release/go-debug.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/release/go-debug.js

Statements: 1.95% (603 / 30977)      Branches: 0% (0 / 26618)      Functions: 0% (0 / 4346)      Lines: 22.93% (485 / 2115)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152              2 1                                                           1                   1 1 1 1   1     1         1           1                         1         1                 1       1       1       1 1       1   1                 1             1       1       1           1 1         1     1   1   1 1                 1           1                   1   1 1                     1 1   1                   1 1   1   1 1 1     1   1                         1 1 1 1 1 1 1 1   1   1 1 1 1 1 1 1 1 1 1       1         1         1     1                 1         1       1       1               1               1 1               1                   1 1                 1       1   1 1                               1 1     1       1         1     1         1 1 1 1     1               1                                                                   1 1 1                           1                     1           1         1     1         1             1               1     1                                   1                                 1             1                 1                 1 1 1 1 1 1 1 1 1     1 1   1 1 1 1 1 1               1 1 1                           1   1 1 1                   1               1 1                   1         1                                       1             1 1     1     1 1 1 1   1   1 1       1           1           1     1   1               1   1   1             1                   1             1 1 1 1 1 1 1   1   1 1 1 1   1                       1     1 1                     1                       1     1         1     1 1 1 1       1   1 1     1   1       1 1 1 1         1 1   1 1   1 1   1       1   1     1 1           1 1                   1     1                             1   1 1                                                                         1     1             1 1 1 1 1       1 1 1   1 1 1 1       1                         1             1 1     1   1     1 1 1       1 1         1           1 1       1                     1 1   1             1 1   1 1 1                       1     1 1 1         1 1   1 1                   1         1                     1 1       1 1 1 1 1 1                 1 1                         1 1                                       1                                 1 1 1                                                   1 1   1 1                                                                                               1                                     1 1 1             1     1       1                       1 1           1   1 1       1     1 1                           1     1     1                             1               1             1 1     1 1                             1                   1                                         1   1 1 1       1 1 1         1                     1 1 1 1 1 1 1 1                                                                                                                                                                                                                                               1 1               1     1           1 1       1   1 1 1 1       1                         1                     1 1     1     1       1   1 1   1                         1 1 1         1         1 1     1 1       1                                     1 1                                           1                   1   1         1                                                   1 1                   1 1 1 1     1 1 1 1 1         1 1   1     1   1 1 1 1   1   1         1 1 1           1 1             1 1 1       1         1                 1     1             1     1     1   1 1                       1   1                           1                   1 1 1 1     1 1 1   1 1                     1 1 1 1 1             1 1 1 1   1 1   1   1 1 1                     1 1 1                       1   1 1       1   1   1 1 1 1   1 1     1   1 1         1   1         1 1     1   1 1 1 1     1                                                   1 1             1 1 1   1         1   1 1 1   1 1   1     1 1                                 1             1     1   1 1 1 1 1 1 1         1 1   1       1       1 1                                                   1 1       1                 1              
/*
 * GoJS v1.7.7 JavaScript Library for HTML Diagrams
 * Northwoods Software, https://www.nwoods.com/
 * GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation.
 * Copyright (C) 1998-2017 by Northwoods Software Corporation.  All Rights Reserved.
 * THIS SOFTWARE IS LICENSED.  THE LICENSE AGREEMENT IS AT: https://gojs.net/1.7.7/doc/license.html.
 */
(function(window) { var f,aa={};if(!window.document||void 0===window.document.createElement("canvas").getContext)throw window.console&&window.console.log("The HTML Canvas element is not supported in this browser,or this browser is in Compatibility mode."),Error("The HTML Canvas element is not supported in this browser,or this browser is in Compatibility mode.");if(!Object.defineProperty)throw Error("GoJS requires a newer version of JavaScript");
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return g.apply(a,e.concat(d.call(arguments)))}function c(){}var d=Array.prototype.slice,e=d.call(arguments,1),g=this;c.prototype=this.prototype;b.prototype=new c;return b});
(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(b){var c=(new Date).getTime(),g=Math.max(8,16-(c-a)),h=window.setTimeout(function(){b(c+g)},g);a=c+g;return h});window.cancelAnimationFrame||(window.cancelAnimationFrame=
function(a){window.clearTimeout(a)})})();
var v={zj:!1,EA:!1,gF:!1,AI:!1,ZL:!1,FF:!1,bu:null,enableBoundsInfo:function(a){v.zj=!0;a&&a.Hq()},disableBoundsInfo:function(a){v.zj=!1;a&&(a.md.Be(!0),a.Hq())},dF:function(a,b){void 0===a&&(a=v.bu);void 0===b&&(b=a.jm("").pb);var c=b.length,d=a.md;d.fillStyle="rgba(255,255,0,.3)";for(var e=0;e<c;e++){var g=b.ea(e),h=g.$;if(g instanceof x)v.dF(a,g.xa);else{var k=g.Li.copy();k.lB(g.Hc);d.save();d.transform(k.m11,k.m12,k.m21,k.m22,k.dx,k.dy);d.fillRect(h.x,h.y,h.width,h.height);d.restore()}}},eF:function(a,
b){a||(a=v.bu);b||(b=a.jm("").pb);var c=a.md,d=b.length;c.fillStyle="rgba(0,0,255,.3)";for(var e=0;e<d;e++){var g=b.ea(e),h=g.Ga,k=g.Li;g instanceof x?v.eF(a,g.xa):(c.save(),c.transform(k.m11,k.m12,k.m21,k.m22,k.dx,k.dy),c.fillRect(h.x,h.y,h.width,h.height),c.restore())}},vI:function(a,b){a||(a=v.bu);b||(b=a.jm("").pb);var c=a.md,d=b.length;c.fillStyle="rgba(0,0,255,.3)";for(var e=0;e<d;e++){var g=b.ea(e),h=g.Fa,k=g.Li;g instanceof x?v.vI(a,g.xa):(c.save(),c.transform(k.m11,k.m12,k.m21,k.m22,k.dx,
k.dy),c.fillRect(h.x||0,h.y||0,h.width,h.height),c.restore())}},wL:function(){v.eF();v.dF()},xL:function(a){a||(a=v.bu);var b=a.cd;a=a.md;a.strokeStyle="rgba(0,255,0,.9)";a.rect(b.x,b.y,b.width,b.height);a.stroke()},fF:function(a,b){b.fillStyle="red";b.fillRect(0,0,8,8);b.lineWidth=8;b.strokeStyle="rgba(255,255,0,.6)";var c=a.xb;b.rect(c.x,c.y,c.width,c.height);b.stroke();b.fillStyle="rgba(0,255,0,.2)";b.fillRect(a.cd.x,a.cd.y,a.cd.width,a.cd.height)},wI:function(a,b){b instanceof da||(a.lineWidth=
2,a.strokeStyle="rgba(255,0,0,.5)",a.rect(b.ac.x,b.ac.y,b.ac.width,b.ac.height),a.stroke(),b instanceof z&&(a.strokeStyle=b.stroke,a.lineWidth=b.jb),null!==b.Q&&b.Q.type===ea&&(a.lineWidth=1,a.strokeStyle="rgba(10,200,10,.6)",b instanceof z&&(a.strokeStyle=b.stroke,a.lineWidth=b.jb)))},xI:function(a,b){a.lineWidth=1;a.strokeStyle="rgba(0,0,255,.5)";a.rect(b.Ga.x,b.Ga.y,b.Ga.width,b.Ga.height);a.stroke();void 0!==b.stroke&&(a.strokeStyle=b.stroke);void 0!==b.Ng&&(a.lineWidth=b.Ng)},DA:function(a,b,
c){a.setTransform(1,0,0,1,0,0);a.scale(b.od,b.od);a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy);c=b.bc.length;for(var d=0;d<c;d++)for(var e=b.bc.ea(d),g=e.pb.length,h=0;h<g;h++){var k=e.pb.ea(h);if(void 0!==k.location&&null!==k.location){if(k.location.F()){var l=k.location.x,m=k.location.y;a.beginPath();a.strokeStyle="limegreen";a.lineWidth=2;a.moveTo(l,m+6);a.lineTo(l,m);a.lineTo(l+6,m);a.moveTo(l,m);a.lineTo(l+10,m+20);a.stroke()}l=k.position.x;m=k.position.y;a.beginPath();a.strokeStyle="red";
a.lineWidth=2;a.moveTo(l,m+6);a.lineTo(l,m);a.lineTo(l+6,m);a.moveTo(l,m);a.lineTo(l+20,m+10);a.stroke()}}a.setTransform(1,0,0,1,0,0)},yL:function(a,b,c){var d=a.length;b.fillStyle="rgba(255,0,0,.1)";for(var e=0;e<d;e++){var g,h=a[e];g=c.Hc;var k=h.x,l=h.y,m=k+h.width,n=l+h.height,p=g.m11,q=g.m12,r=g.m21,s=g.m22,u=g.dx,t=g.dy,y=k*p+l*r+u,h=k*q+l*s+t;g=m*p+l*r+u;var l=m*q+l*s+t,w=k*p+n*r+u,k=k*q+n*s+t,p=m*p+n*r+u,m=m*q+n*s+t,n=y,q=h,n=Math.min(n,g),y=Math.max(y,g),q=Math.min(q,l),h=Math.max(h,l),n=
Math.min(n,w),y=Math.max(y,w),q=Math.min(q,k),h=Math.max(h,k),n=Math.min(n,p),y=Math.max(y,p),q=Math.min(q,m),h=Math.max(h,m);g=new B(n,q,y-n,h-q);b.fillRect(g.x,g.y,g.width,g.height)}},yI:function(a,b,c,d,e){a.fillStyle="rgba(0,255,0,.2)";a.fillRect(b,c,d,e)},zI:function(a,b,c){a.save();var d=b.Hc;d.reset();1!==b.scale&&d.scale(b.scale);b=b.position;0===b.x&&0===b.y||d.translate(-b.x,-b.y);a.setTransform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);c=c.ad.o;d=c.length;for(b=0;b<d;b++){var e=c[b];a.beginPath();
a.moveTo(e.x-4,e.y);a.lineTo(e.x+4,e.y);a.moveTo(e.x,e.y-4);a.lineTo(e.x,e.y+4);a.lineWidth=2;a.strokeStyle="rgba(255,0,0,.9)";a.stroke()}a.restore()},uL:function(a){a||(a=v.bu);for(a=a.ao;a.next();)D.trace(a.value.toString())},mM:function(a,b){var c=b.ep(a),d=b.Tb;d.qe=b.TB(c);d.ha=c;return ga(b,d,a)},hM:function(a,b){b.Ge(a.ha)&&(b.md.fillStyle="lime",b.md.fillRect(a.qe.x,a.qe.y,1*b.scale,1*b.scale))},iM:function(a){var b=ha(a,!1,null,null);if(!b.vq){a=a.md;for(var c=0;c<=b.yn;c++)for(var d=0;d<=
b.zn;d++){var e=b.wd[c][d];if(0!==e){var g=c*b.ce+b.Vf,h=d*b.Md+b.Wf;0!==e&&(a.fillStyle="rgba(255, 0, 0, .2)",a.fillRect(g,h,b.ce,b.Md));999999<=e||(e%=10,a.fillStyle="blue",a.fillText(e.toString(),g,h+b.Md))}}}},dumpReferences:function(a){if(a instanceof E)for(a=a.ao;a.next();){var b=a.value;D.trace(b.toString());for(b=b.Gi;b.next();)v.dumpReferences(b.value)}else if(a instanceof F){D.trace("References for "+a);null!==a.layer&&D.trace("  "+a.layer.toString()+' LayerName: "'+a.Jf+'"');a.ro!==a&&
D.trace("  SelectionObject: "+a.ro.toString()+' SelectionObjectName: "'+a.Cy+'"');a.uf!==a&&D.trace("  LocationObject: "+a.uf.toString()+' LocationObjectName: "'+a.iy+'"');if(a.mh){for(var b="",c=a.mh.j;c.next();)b+=c.key+" ";D.trace("  Adornments: "+b)}null!==a.Pa&&D.trace("  ContainingGroup: "+a.Pa.toString());if(a instanceof G){if(0<a.Gd.count){b="";for(c=a.Gd;c.next();)b+=c.value.toString()+", ";D.trace("  Links: "+b)}null!==a.zc&&D.trace("  LabeledLink: "+a.zc.toString());if(a instanceof I){D.trace("  Placeholder: "+
a.placeholder);b="";for(c=a.Mc;c.next();)b+=c.value.toString()+", ";D.trace("  Members: "+b);b="";for(c=a.en.j;c.next();)b+=c.value.toString()+", ";D.trace("  NestedGroups: "+b);D.trace("  Layout: "+a.Vb)}}else if(a instanceof J){D.trace("  Path: "+a.path);D.trace("  From: "+a.aa+" "+a.dd+' "'+a.cg+'"');D.trace("  To: "+a.da+" "+a.Ld+' "'+a.jh+'"');b="";for(a=a.If;a.next();)b+=a.value.toString()+", ";D.trace("  LabelNodes: "+b)}}},dumpVisualTree:function(a){if(a instanceof E)for(a=a.ao;a.next();){var b=
a.value;D.trace(b.toString());for(b=b.Gi;b.next();)v.dumpVisualTree(b.value)}else a instanceof F&&(b=" ",a.UE&&(b+="c"),a.YE&&(b+="d"),a.DF&&(b+="g"),a.gG&&(b+="m"),a.zG&&(b+="h"),a.AG&&(b+="z"),a.FG&&(b+="o"),a.$k&&(b+="s"),a.XG&&(b+="t"),a.MG&&(b+="A"),a.Ux&&(b+="B"),a.$A&&(b+="L"),a.hb&&(b+="S"),a.Wk&&(b+="H"),v.XC(a,1,b))},XC:function(a,b,c){for(var d="",e=0;e<b;e++)d+="  ";d+=a.toString();c&&(d+=c);c=a.name?' "'+a.name+'" ':" ";c=a.visible?c+"v":c+"!v";c=a.pg?c+"p":c+"!p";a.Gf&&(c+="m");a.tu&&
(c+="a");d+=c;if(0!==a.Zb||0!==a.column)d+=" ["+a.Zb+","+a.column+"]";d+=" "+a.$.toString();a.Ea.F()&&(d+=" d:"+a.Ea.toString());a.Ga.F()&&(d+=" n:"+a.Ga.toString());1!==a.scale&&(d+=" s:"+a.scale);0!==a.angle&&(d+=" a:"+a.angle);null!==a.background&&(d+=" b:"+a.background.toString());null!==a.Zl&&(d+=" a:"+a.background.toString());a instanceof x&&(d+=" elts:"+a.xa.count,a.isEnabled||(d+=" !ENABLED"),a.yq&&(d+=" CLIPPING"),0!==a.cH&&(d+=" top:"+a.cH),0!==a.$F&&(d+=" left:"+a.$F),null!==a.Xk&&(d+=
" itemArray#:"+D.cb(a.Xk)),a.WF&&(d+=" cat:"+a.WF),null!==a.data&&(d+=" data:"+a.data));null!==a.sd&&(d+=' portId: "'+a.sd+'"');D.trace(d);if(a instanceof x)for(a=a.elements;a.next();)v.XC(a.value,b+1,"")},AL:function(a){D.trace("DelayedReferences ("+a.vg.count+")");for(a=a.vg.j;a.next();){for(var b="",c=a.value.j;c.next();)b+=ja(c.value)+", ";D.trace("  "+a.key+": "+b)}},LE:function(a,b){if(!D.Ta(b)||b instanceof Element||b instanceof CanvasRenderingContext2D||b instanceof ka||b instanceof la)return"";
var c="",d;for(d in b)if("string"!==typeof d)""===c&&(c=b+"\n"),c+="  "+d+" is not a string property\n";else if("_"!==d.charAt(0)&&!(2>=d.length)){var e=D.ub(b,d);if(null!==e&&"function"!==typeof e){if(b.hasOwnProperty(d)){var g=Object.getPrototypeOf(b);if(g&&g.Dw&&g.Dw[d])continue}else if(D.Px(b,d))continue;""===c&&(c=b+"\n");c+='  unknown property "'+d+'" has value: '+e+" at "+a+"\n"}}return c},sx:function(a,b){if(null!==b&&void 0!==b&&"number"!==typeof b&&"string"!==typeof b&&"boolean"!==typeof b&&
"function"!==typeof b)if(void 0!==D.Fd(b)){if(!v.Qw.contains(b))if(v.Qw.add(b),v.sw.add(v.LE(a,b)),b instanceof K||b instanceof L||b instanceof ma)for(var c=b.j;c.next();)v.sx(a+"["+c.key+"]",c.value);else for(c in b){var d=D.ub(b,c);if(void 0!==d&&null!==d&&D.Ta(d)&&d!==b.Dw){if(b instanceof na){if(d===b.gi)continue}else if(b instanceof x){if("data"===c||d===b.Nd)continue;if("itemArray"===c||d===b.cj)continue;if(b instanceof F&&d===b.Jl)continue}else if(!(b instanceof E))if(b instanceof oa){if("archetypeGroupData"===
c||d===b.Zy)continue}else if(b instanceof ra){if("archetypeLinkData"===c||d===b.az)continue;if("archetypeLabelNodeData"===c||d===b.$y)continue}else if(b instanceof ta){if("archetypeNodeData"===c||d===b.ol)continue}else if(b instanceof M){if("nodeDataArray"===c||d===b.we)continue;if("linkDataArray"===c||d===b.bf||d===b.hi)continue;if(d===b.Ec)continue;if(d===b.vg)continue}else if(b instanceof va||b instanceof wa||b instanceof xa)continue;v.sx(a+"."+c,d)}}}else if(Array.isArray(b))for(c=0;c<b.length;c++)v.sx(a+
"["+c+"]",b[c]);else v.sw.add(v.LE(a,b))},checkProperties:function(a){void 0===v.Qw?v.Qw=new L(Object):v.Qw.clear();v.sw=new ya;v.sx("",a);a=v.sw.toString();v.sw=null;return a}};aa.Debug=v;
var D={ud:1,Yc:2,ld:4,kd:8,Xn:void 0!==window.navigator&&0<window.navigator.userAgent.indexOf("534.30")&&0<window.navigator.userAgent.indexOf("Android"),gJ:void 0!==window.navigator&&0<window.navigator.userAgent.indexOf("MSIE 9.0"),OF:void 0!==window.navigator&&0<window.navigator.userAgent.indexOf("MSIE 10.0"),PF:void 0!==window.navigator&&0<window.navigator.userAgent.indexOf("Trident/7"),HL:void 0!==window.navigator&&0<window.navigator.userAgent.indexOf("Edge/"),Vk:void 0!==window.navigator&&void 0!==
window.navigator.platform&&0<=window.navigator.platform.toUpperCase().indexOf("MAC"),QF:void 0!==window.navigator&&void 0!==window.navigator.platform&&null!==window.navigator.platform.match(/(iPhone|iPod|iPad)/i),VE:function(a,b,c){var d=-1;return function(){var e=this,g=arguments;-1!==d&&D.clearTimeout(d);d=D.setTimeout(function(){d=-1;c||a.apply(e,g)},b);c&&!d&&a.apply(e,g)}},setTimeout:function(a,b){return window.setTimeout(a,b)},clearTimeout:function(a){window.clearTimeout(a)},createElement:function(a){return window.document.createElement(a)},
k:function(a){throw Error(a);},pa:function(a,b){var c="The object is frozen, so its properties cannot be set: "+a.toString();void 0!==b&&(c+="  to value: "+b);D.k(c)},l:function(a,b,c,d){a instanceof b||(c=D.getTypeName(c),void 0!==d&&(c+="."+d),D.gc(a,b,c))},h:function(a,b,c,d){typeof a!==b&&(c=D.getTypeName(c),void 0!==d&&(c+="."+d),D.gc(a,b,c))},p:function(a,b,c){"number"===typeof a&&isFinite(a)||(b=D.getTypeName(b),void 0!==c&&(b+="."+c),D.k(b+" must be a real number type, and not NaN or Infinity: "+
a))},Ca:function(a,b,c,d){a instanceof za&&a.Ne===b||(c=D.getTypeName(c),void 0!==d&&(c+="."+d),D.gc(a,"a constant of class "+D.qf(b),c))},Yt:function(a,b){"string"===typeof a?Aa(a)||D.k('Color "'+a+'" is not a valid color string for '+b):a instanceof Ba||D.k("Value for "+b+" must be a color string or a Brush, not "+a)},gc:function(a,b,c,d){b=D.getTypeName(b);c=D.getTypeName(c);void 0!==d&&(c+="."+d);"string"===typeof a?D.k(c+" value is not an instance of "+b+': "'+a+'"'):D.k(c+" value is not an instance of "+
b+": "+a)},ua:function(a,b,c,d){c=D.getTypeName(c);void 0!==d&&(c+="."+d);D.k(c+" is not in the range "+b+": "+a)},td:function(a){D.k(D.qf(a)+" constructor cannot take any arguments.")},Va:function(a){D.k("Collection was modified during iteration: "+a.toString()+"\n  Perhaps you should iterate over a copy of the collection,\n  or you could collect items to be removed from the collection after the iteration.")},Xj:function(a,b){D.k("No property to set for this enum value: "+b+" on "+a.toString())},
trace:function(a){window.console&&window.console.log(a)},Bx:{},Nn:function(a,b){!0!==D.Bx[a]&&(D.Bx[a]=!0,window.console&&window.console.log(a+" is deprecated in "+b+", see the GoJS change log for more information."))},Ta:function(a){return"object"===typeof a&&null!==a},isArray:function(a){return Array.isArray(a)||a instanceof NodeList||a instanceof HTMLCollection},hJ:function(a){return Array.isArray(a)},Xt:function(a,b,c){D.isArray(a)||D.gc(a,"Array or NodeList or HTMLCollection",b,c)},cb:function(a){return a.length},
cm:function(a){return Array.prototype.slice.call(a)},La:function(a,b){Array.isArray(a);return a[b]},JE:function(a,b,c){Array.isArray(a)?a[b]=c:D.k("Cannot replace an object in an HTMLCollection or NodeList at "+b)},$l:function(a,b){if(Array.isArray(a))return a.indexOf(b);for(var c=a.length,d=0;d<c;d++)if(a[d]===b)return d;return-1},Ih:function(a,b,c){Array.isArray(a)?b>=a.length?a.push(c):a.splice(b,0,c):D.k("Cannot insert an object into an HTMLCollection or NodeList: "+c+" at "+b)},Sg:function(a,
b){Array.isArray(a)?b>=a.length?a.pop():a.splice(b,1):D.k("Cannot remove an object from an HTMLCollection or NodeList at "+b)},Ry:[],P:function(){var a=D.Ry.pop();return void 0===a?new O:a},Fb:function(a,b){var c=D.Ry.pop();if(void 0===c)return new O(a,b);c.x=a;c.y=b;return c},A:function(a){D.Ry.push(a)},hC:[],Cm:function(){var a=D.hC.pop();return void 0===a?new Ca:a},Rk:function(a){D.hC.push(a)},Sy:[],Nf:function(){var a=D.Sy.pop();return void 0===a?new B:a},gh:function(a,b,c,d){var e=D.Sy.pop();
if(void 0===e)return new B(a,b,c,d);e.x=a;e.y=b;e.width=c;e.height=d;return e},Mb:function(a){D.Sy.push(a)},iC:[],Of:function(){var a=D.iC.pop();return void 0===a?new Da:a},He:function(a){D.iC.push(a)},Ty:null,v:function(){var a=D.Ty;return null!==a?(D.Ty=null,a):new Ea},u:function(a){a.reset();D.Ty=a},gC:[],tb:function(){var a=D.gC.pop();return void 0===a?[]:a},Aa:function(a){a.length=0;D.gC.push(a)},Co:Object.freeze([]),Gm:1,tc:function(a){a.__gohashid=D.Gm++},sq:function(a){var b=a.__gohashid;
void 0===b&&(b=D.Gm++,a.__gohashid=b);return b},Fd:function(a){return a.__gohashid},ja:function(a,b){b.fz=a;aa[a]=b},Sa:function(a,b){function c(){}c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a},Ai:function(a){a.BH=!0},defineProperty:function(a,b,c,d,e){D.h(a,"function","Util.defineProperty:classfunc");D.h(b,"object","Util.defineProperty:propobj");D.h(c,"function","Util.defineProperty:getter");D.h(d,"function","Util.defineProperty:setter");for(var g in b){b=b[g];c={get:c,set:d,
enumerable:!0};if(void 0!==e)for(var h in e)c[h]=e[h];Object.defineProperty(a.prototype,g,c);e=Object.getOwnPropertyDescriptor(a.prototype,g);b&&e&&Object.defineProperty(a.prototype,b,e);break}},CK:!1,w:function(a,b,c,d){D.h(a,"function","Util.defineReadOnlyProperty:classfunc");D.h(b,"object","Util.defineReadOnlyProperty:propobj");D.h(c,"function","Util.defineReadOnlyProperty:getter");for(var e in b){var g=b[e];b={get:c,set:function(a){D.k('The property "'+g+'" is read-only and cannot be set to '+
a)},enumerable:!0};if(void 0!==d)for(var h in d)b[h]=d[h];Object.defineProperty(a.prototype,e,b);d=Object.getOwnPropertyDescriptor(a.prototype,e);g&&d&&Object.defineProperty(a.prototype,g,d);break}},ke:function(a,b){for(var c in b)b[c]=!0;a.prototype.Dw=b},getTypeName:function(a){return void 0===a?"":"string"===typeof a?a:"function"===typeof a?D.qf(a):null===a?"*":""},qf:function(a){if("function"===typeof a){if(a.fz)return a.fz;if(a.name)return a.name;var b=a.toString(),c=b.indexOf("("),b=b.substring(9,
c).trim();if(""!==b)return a.fz=b}else if("object"===typeof a&&a.constructor)return D.qf(a.constructor);return typeof a},s:function(a,b,c){D.h(a,"function","Util.defineEnumValue:classfunc");D.h(b,"string","Util.defineEnumValue:name");D.h(c,"number","Util.defineEnumValue:num");c=new za(a,b,c);Object.freeze(c);a[b]=c;var d=a.lv;d instanceof ma||(d=new ma("string",za),a.lv=d);d.add(b,c);return c},ub:function(a,b){if(!a||!b)return null;var c=void 0;try{"function"===typeof b?c=b(a):"function"===typeof a.getAttribute?
(c=a.getAttribute(b),null===c&&(c=void 0)):c=a[b]}catch(d){v&&D.trace("property get error: "+d.toString())}return c},Ua:function(a,b,c){if(a&&b)try{"function"===typeof b?b(a,c):"function"===typeof a.setAttribute?a.setAttribute(b,c):a[b]=c}catch(d){v&&D.trace("property set error: "+d.toString())}},Zu:function(a,b){D.h(a,"object","Setting properties requires Objects as arguments");D.h(b,"object","Setting properties requires Objects as arguments");var c=a instanceof x,d=a instanceof E,e;for(e in b){""===
e&&D.k("Setting properties requires non-empty property names");var g=a,h=e;if(c||d){var k=e.indexOf(".");if(0<k){var l=e.substring(0,k);if(c)g=a.Ed(l);else if(g=a[l],void 0===g||null===g)g=a.kb[l];D.Ta(g)?h=e.substr(k+1):D.k("Unable to find object named: "+l+" in "+a.toString()+" when trying to set property: "+e)}}if("_"!==h[0]&&!D.Px(g,h))if(d&&"ModelChanged"===h){a.NH(b[h]);continue}else if(d&&"Changed"===h){a.An(b[h]);continue}else if(d&&D.Px(a.kb,h))g=a.kb;else if(d&&Ga(a,h)){a.mA(h,b[h]);continue}else if(a instanceof
M&&"Changed"===h){a.An(b[h]);continue}else D.k('Trying to set undefined property "'+h+'" on object: '+g.toString());g[h]=b[e];"_"===h[0]&&g instanceof P&&g.KH(h)}},Px:function(a,b){if(a.hasOwnProperty(b))return!0;for(var c=Object.getPrototypeOf(a);c&&c!==Function;){if(c.hasOwnProperty(b))return!0;var d=c.Dw;if(d&&d[b])return!0;c=Object.getPrototypeOf(c)}return!1},SJ:function(a){for(var b=[],c=0;256>c;c++)b[c]=c;for(var d=0,e=0,c=0;256>c;c++)d=(d+b[c]+119)%256,e=b[c],b[c]=b[d],b[d]=e;for(var d=c=0,
g="",h=0;h<a.length;h++)c=(c+1)%256,d=(d+b[c])%256,e=b[c],b[c]=b[d],b[d]=e,g+=String.fromCharCode(a.charCodeAt(h)^b[(b[c]+b[d])%256]);return g},VI:function(a){for(var b={},c=0;256>c;c++)b["0123456789abcdef".charAt(c>>4)+"0123456789abcdef".charAt(c&15)]=String.fromCharCode(c);a.length%2&&(a="0"+a);for(var d=[],e=0,c=0;c<a.length;c+=2)d[e++]=b[a.substr(c,2)];a=d.join("");return""===a?"0":a},Tg:function(a){return D.SJ(D.VI(a))},Em:null,adym:"7da71ca0ad381e90",vfo:"2be641fdb4",$H:"@COLOR1",aI:"@COLOR2",
WE:!1,$t:null,au:null};
D.Em=function(){var a=window.document.createElement("canvas"),b=a.getContext("2d");b[D.Tg("7ca11abfd022028846")]=D.Tg("398c3597c01238");for(var c=["5da73c80a3330d854f9e5e671d6633","32ab5ff3b26f42dc0ed90f22422913b54ae6247590da4bb21c324ba3a84e385776","54a702f3e53909c447824c6706603faf4cfb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387","74bf19bce72555874c86"],d=1;5>d;d++)b[D.Tg("7ca11abfd7330390")](D.Tg(c[d-1]),10,15*d+0);b[D.Tg("7ca11abfd022028846")]=D.Tg("39f046ebb36e4b");for(d=1;5>d;d++)b[D.Tg("7ca11abfd7330390")](D.Tg(c[d-
1]),10,15*d+0);if(4!==c.length||"5"!==c[0][0]||"7"!==c[3][0])D.s=function(a,b){var c=new za(a,b,2);Object.freeze(c);a[b]=c;var d=a.lv;d instanceof ma||(d=new ma("string",za),a.lv=d);d.add(b,c);return c};return a}();function za(a,b,c){D.tc(this);this.rC=a;this.Xb=b;this.FH=c}D.ja("EnumValue",za);za.prototype.toString=function(){return D.qf(this.rC)+"."+this.Xb};D.w(za,{Ne:"classType"},function(){return this.rC});D.w(za,{name:"name"},function(){return this.Xb});D.w(za,{value:"value"},function(){return this.FH});
var Ha;za.findName=Ha=function(a,b){if(void 0===b||null===b||""===b)return null;D.h(a,"function","findName:classfunc");D.h(b,"string","EnumValue.findName:name");var c=a.lv;return c instanceof ma?c.oa(b):null};function ya(){this.qC=[]}ya.prototype.toString=function(){return this.qC.join("")};ya.prototype.add=function(a){""!==a&&this.qC.push(a)};function la(){}
function Ia(a){void 0===a&&(a=42);this.seed=a;this.Ny=48271;this.kv=2147483647;this.fC=this.kv/this.Ny;this.nH=this.kv%this.Ny;this.mH=1/this.kv;this.random()}Ia.prototype.random=function(){var a=this.seed%this.fC*this.Ny-this.seed/this.fC*this.nH;this.seed=0<a?a:a+this.kv;return this.seed*this.mH};function Ja(){}D.w(Ja,{j:"iterator"},function(){return this});Ja.prototype.reset=Ja.prototype.reset=function(){};Ja.prototype.next=Ja.prototype.next=function(){return!1};Ja.prototype.hasNext=function(){return!1};
Ja.prototype.first=Ja.prototype.first=function(){return null};Ja.prototype.any=function(){return!1};Ja.prototype.all=function(){return!0};Ja.prototype.each=function(){return this};Ja.prototype.map=function(){return this};Ja.prototype.filter=function(){return this};Ja.prototype.concat=function(a){return a.j};D.w(Ja,{count:"count"},function(){return 0});Ja.prototype.Qf=function(){};Ja.prototype.toString=function(){return"EmptyIterator"};var Ka=new Ja;function La(a){this.key=-1;this.value=a}
D.ke(La,{key:!0,value:!0});D.w(La,{j:"iterator"},function(){return this});La.prototype.reset=La.prototype.reset=function(){this.key=-1};La.prototype.next=La.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};La.prototype.hasNext=function(){return this.next()};La.prototype.first=La.prototype.first=function(){this.key=0;return this.value};La.prototype.any=function(a){this.key=-1;return a(this.value)};La.prototype.all=function(a){this.key=-1;return a(this.value)};
La.prototype.each=function(a){this.key=-1;a(this.value);return this};La.prototype.map=function(a){return new La(a(this.value))};La.prototype.filter=function(a){return a(this.value)?new La(this.value):Ka};La.prototype.concat=function(a){return new Ma(this,a.j)};D.w(La,{count:"count"},function(){return 1});La.prototype.Qf=function(){this.value=null};La.prototype.toString=function(){return"SingletonIterator("+this.value+")"};function Ma(a,b){this.Bl=a;this.Cl=b;this.mv=!1}D.ke(Ma,{key:!0,value:!0});
D.w(Ma,{j:"iterator"},function(){return this});Ma.prototype.reset=Ma.prototype.reset=function(){this.Bl.reset();this.Cl.reset();this.mv=!1};Ma.prototype.next=Ma.prototype.next=function(){if(!this.mv){var a=this.Bl;if(a.next())return this.key=a.key,this.value=a.value,!0;this.mv=!0}return this.mv&&(a=this.Cl,a.next())?(this.key=a.key,this.value=a.value,!0):!1};Ma.prototype.hasNext=function(){return this.next()};
Ma.prototype.first=Ma.prototype.first=function(){this.reset();return this.next()?this.value:null};Ma.prototype.any=function(a){return this.Bl.any(a)||this.Cl.any(a)?!0:!1};Ma.prototype.all=function(a){return this.Bl.all(a)&&this.Cl.all(a)?!0:!1};Ma.prototype.each=function(a){this.Bl.each(a);this.Cl.each(a);return this};Ma.prototype.map=function(a){return new Ma(this.Bl.map(a),this.Cl.map(a))};Ma.prototype.filter=function(a){return new Ma(this.Bl.filter(a),this.Cl.filter(a))};
Ma.prototype.concat=function(a){return new Ma(this,a.j)};D.w(Ma,{count:"count"},function(){return this.Bl.count+this.Cl.count});Ma.prototype.Qf=function(){this.value=this.key=null};Ma.prototype.toString=function(){return"ConcatIterator()"};function Na(a){this.Dc=a;this.mi=null;a.Wb=null;this.$a=a.G;this.Cc=-1}D.ke(Na,{key:!0,value:!0});D.w(Na,{j:"iterator"},function(){return this});D.defineProperty(Na,{Fq:"predicate"},function(){return this.mi},function(a){this.mi=a});
Na.prototype.reset=Na.prototype.reset=function(){var a=this.Dc;a.Wb=null;this.$a=a.G;this.Cc=-1};Na.prototype.next=Na.prototype.next=function(){var a=this.Dc;if(a.G!==this.$a){if(0>this.key)return!1;D.Va(a)}var a=a.o,b=a.length,c=++this.Cc,d=this.mi;if(null!==d)for(;c<b;){var e=a[c];if(d(e))return this.key=this.Cc=c,this.value=e,!0;c++}else{if(c<b)return this.key=c,this.value=a[c],!0;this.Qf()}return!1};Na.prototype.hasNext=function(){return this.next()};
Na.prototype.first=Na.prototype.first=function(){var a=this.Dc;this.$a=a.G;this.Cc=0;var a=a.o,b=a.length,c=this.mi;if(null!==c){for(var d=0;d<b;){var e=a[d];if(c(e))return this.key=this.Cc=d,this.value=e;d++}return null}return 0<b?(e=a[0],this.key=0,this.value=e):null};Na.prototype.any=function(a){var b=this.Dc;b.Wb=null;var c=b.G;this.Cc=-1;for(var d=b.o,e=d.length,g=this.mi,h=0;h<e;h++){var k=d[h];if(null===g||g(k)){if(a(k))return!0;b.G!==c&&D.Va(b)}}return!1};
Na.prototype.all=function(a){var b=this.Dc;b.Wb=null;var c=b.G;this.Cc=-1;for(var d=b.o,e=d.length,g=this.mi,h=0;h<e;h++){var k=d[h];if(null===g||g(k)){if(!a(k))return!1;b.G!==c&&D.Va(b)}}return!0};Na.prototype.each=function(a){var b=this.Dc;b.Wb=null;var c=b.G;this.Cc=-1;for(var d=b.o,e=d.length,g=this.mi,h=0;h<e;h++){var k=d[h];if(null===g||g(k))a(k),b.G!==c&&D.Va(b)}return this};
Na.prototype.map=function(a){var b=this.Dc;b.Wb=null;var c=b.G;this.Cc=-1;for(var d=[],e=b.o,g=e.length,h=this.mi,k=0;k<g;k++){var l=e[k];if(null===h||h(l))d.push(a(l)),b.G!==c&&D.Va(b)}a=new K;a.o=d;a.Qc();return a.j};Na.prototype.filter=function(a){var b=this.Dc;b.Wb=null;var c=b.G;this.Cc=-1;for(var d=[],e=b.o,g=e.length,h=this.mi,k=0;k<g;k++){var l=e[k];if(null===h||h(l))a(l)&&d.push(l),b.G!==c&&D.Va(b)}a=new K(b.ca);a.o=d;a.Qc();return a.j};
Na.prototype.concat=function(a){this.Dc.Wb=null;return new Ma(this,a.j)};D.w(Na,{count:"count"},function(){var a=this.mi;if(null!==a){for(var b=0,c=this.Dc.o,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.Dc.o.length});Na.prototype.Qf=function(){this.key=-1;this.value=null;this.$a=-1;this.mi=null;this.Dc.Wb=this};Na.prototype.toString=function(){return"ListIterator@"+this.Cc+"/"+this.Dc.count};function Pa(a){this.Dc=a;a.dj=null;this.$a=a.G;this.Cc=a.o.length}D.ke(Pa,{key:!0,value:!0});
D.w(Pa,{j:"iterator"},function(){return this});Pa.prototype.reset=Pa.prototype.reset=function(){var a=this.Dc;a.dj=null;this.$a=a.G;this.Cc=a.o.length};Pa.prototype.next=Pa.prototype.next=function(){var a=this.Dc;if(a.G!==this.$a){if(0>this.key)return!1;D.Va(a)}var b=--this.Cc;if(0<=b)return this.key=b,this.value=a.o[b],!0;this.Qf();return!1};Pa.prototype.hasNext=function(){return this.next()};
Pa.prototype.first=Pa.prototype.first=function(){var a=this.Dc;this.$a=a.G;var b=a.o;this.Cc=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};Pa.prototype.any=function(a){var b=this.Dc;b.dj=null;var c=b.G,d=b.o,e=d.length;this.Cc=e;for(e-=1;0<=e;e--){if(a(d[e]))return!0;b.G!==c&&D.Va(b)}return!1};Pa.prototype.all=function(a){var b=this.Dc;b.dj=null;var c=b.G,d=b.o,e=d.length;this.Cc=e;for(e-=1;0<=e;e--){if(!a(d[e]))return!1;b.G!==c&&D.Va(b)}return!0};
Pa.prototype.each=function(a){var b=this.Dc;b.dj=null;var c=b.G,d=b.o,e=d.length;this.Cc=e;for(e-=1;0<=e;e--)a(d[e]),b.G!==c&&D.Va(b);return this};Pa.prototype.map=function(a){var b=this.Dc;b.dj=null;var c=b.G,d=[],e=b.o,g=e.length;this.Cc=g;for(g-=1;0<=g;g--)d.push(a(e[g])),b.G!==c&&D.Va(b);a=new K;a.o=d;a.Qc();return a.j};
Pa.prototype.filter=function(a){var b=this.Dc;b.dj=null;var c=b.G,d=[],e=b.o,g=e.length;this.Cc=g;for(g-=1;0<=g;g--){var h=e[g];a(h)&&d.push(h);b.G!==c&&D.Va(b)}a=new K(b.ca);a.o=d;a.Qc();return a.j};Pa.prototype.concat=function(a){this.Dc.dj=null;return new Ma(this,a.j)};D.w(Pa,{count:"count"},function(){return this.Dc.o.length});Pa.prototype.Qf=function(){this.key=-1;this.value=null;this.$a=-1;this.Dc.dj=this};
Pa.prototype.toString=function(){return"ListIteratorBackwards("+this.Cc+"/"+this.Dc.count+")"};
function K(a){D.tc(this);this.J=!1;this.o=[];this.G=0;this.dj=this.Wb=null;void 0===a||null===a?this.ca=null:"string"===typeof a?"object"===a||"string"===a||"number"===a||"boolean"===a||"function"===a?this.ca=a:D.ua(a,"the string 'object', 'number', 'string', 'boolean', or 'function'","List constructor: type"):"function"===typeof a?this.ca=a===Object?"object":a===String?"string":a===Number?"number":a===Boolean?"boolean":a===Function?"function":a:D.ua(a,"null, a primitive type name, or a class type",
"List constructor: type")}D.ja("List",K);K.prototype.oh=function(a){null!==this.ca&&("string"===typeof this.ca?typeof a===this.ca&&null!==a||D.gc(a,this.ca):a instanceof this.ca||D.gc(a,this.ca))};K.prototype.Qc=function(){var a=this.G;a++;999999999<a&&(a=0);this.G=a};K.prototype.freeze=K.prototype.freeze=function(){this.J=!0;return this};K.prototype.thaw=K.prototype.Ya=function(){this.J=!1;return this};K.prototype.toString=function(){return"List("+D.getTypeName(this.ca)+")#"+D.Fd(this)};
K.prototype.add=K.prototype.add=function(a){null!==a&&(v&&this.oh(a),this.J&&D.pa(this,a),this.o.push(a),this.Qc())};K.prototype.push=K.prototype.push=function(a){this.add(a)};K.prototype.addAll=K.prototype.Rc=function(a){if(null===a)return this;this.J&&D.pa(this);var b=this.o;if(D.isArray(a))for(var c=D.cb(a),d=0;d<c;d++){var e=D.La(a,d);v&&this.oh(e);b.push(e)}else for(a=a.j;a.next();)e=a.value,v&&this.oh(e),b.push(e);this.Qc();return this};
K.prototype.clear=K.prototype.clear=function(){this.J&&D.pa(this);this.o.length=0;this.Qc()};K.prototype.contains=K.prototype.contains=function(a){if(null===a)return!1;v&&this.oh(a);return-1!==this.o.indexOf(a)};K.prototype.has=K.prototype.has=function(a){return this.contains(a)};K.prototype.indexOf=K.prototype.indexOf=function(a){if(null===a)return-1;v&&this.oh(a);return this.o.indexOf(a)};
K.prototype.elt=K.prototype.ea=function(a){v&&D.p(a,K,"elt:i");var b=this.o;(0>a||a>=b.length)&&D.ua(a,"0 <= i < length",K,"elt:i");return b[a]};K.prototype.get=K.prototype.get=function(a){return this.ea(a)};K.prototype.setElt=K.prototype.qg=function(a,b){v&&(this.oh(b),D.p(a,K,"setElt:i"));var c=this.o;(0>a||a>=c.length)&&D.ua(a,"0 <= i < length",K,"setElt:i");this.J&&D.pa(this,a);c[a]=b};K.prototype.set=K.prototype.set=function(a,b){this.qg(a,b)};
K.prototype.first=K.prototype.first=function(){var a=this.o;return 0===a.length?null:a[0]};K.prototype.last=K.prototype.pe=function(){var a=this.o,b=a.length;return 0<b?a[b-1]:null};K.prototype.pop=K.prototype.pop=function(){this.J&&D.pa(this);var a=this.o;return 0<a.length?a.pop():null};K.prototype.any=function(a){for(var b=this.o,c=this.G,d=b.length,e=0;e<d;e++){if(a(b[e]))return!0;this.G!==c&&D.Va(this)}return!1};
K.prototype.all=function(a){for(var b=this.o,c=this.G,d=b.length,e=0;e<d;e++){if(!a(b[e]))return!1;this.G!==c&&D.Va(this)}return!0};K.prototype.each=function(a){for(var b=this.o,c=this.G,d=b.length,e=0;e<d;e++)a(b[e]),this.G!==c&&D.Va(this);return this};K.prototype.map=function(a){for(var b=new K,c=[],d=this.o,e=this.G,g=d.length,h=0;h<g;h++)c.push(a(d[h])),this.G!==e&&D.Va(this);b.o=c;b.Qc();return b};
K.prototype.filter=function(a){for(var b=new K(this.ca),c=[],d=this.o,e=this.G,g=d.length,h=0;h<g;h++){var k=d[h];a(k)&&c.push(k);this.G!==e&&D.Va(this)}b.o=c;b.Qc();return b};K.prototype.concat=function(a){return this.copy().Rc(a)};K.prototype.insertAt=K.prototype.Xd=function(a,b){v&&(this.oh(b),D.p(a,K,"insertAt:i"));0>a&&D.ua(a,">= 0",K,"insertAt:i");this.J&&D.pa(this,a);var c=this.o;a>=c.length?c.push(b):c.splice(a,0,b);this.Qc();return!0};
K.prototype.remove=K.prototype.remove=function(a){if(null===a)return!1;v&&this.oh(a);this.J&&D.pa(this,a);var b=this.o;a=b.indexOf(a);if(-1===a)return!1;a===b.length-1?b.pop():b.splice(a,1);this.Qc();return!0};K.prototype["delete"]=K.prototype.delete=function(a){return this.remove(a)};K.prototype.removeAt=K.prototype.jd=function(a){v&&D.p(a,K,"removeAt:i");var b=this.o;(0>a||a>=b.length)&&D.ua(a,"0 <= i < length",K,"removeAt:i");this.J&&D.pa(this,a);a===b.length-1?b.pop():b.splice(a,1);this.Qc()};
K.prototype.removeRange=K.prototype.removeRange=function(a,b){v&&(D.p(a,K,"removeRange:from"),D.p(b,K,"removeRange:to"));var c=this.o,d=c.length;if(0>a)a=0;else if(a>=d)return this;if(0>b)return this;b>=d&&(b=d-1);if(a>b)return this;this.J&&D.pa(this);for(var e=a,g=b+1;g<d;)c[e++]=c[g++];c.length=d-(b-a+1);this.Qc();return this};K.prototype.copy=function(){var a=new K(this.ca),b=this.o;0<b.length&&(a.o=Array.prototype.slice.call(b));return a};
K.prototype.toArray=K.prototype.lc=function(){for(var a=this.o,b=this.count,c=Array(b),d=0;d<b;d++)c[d]=a[d];return c};K.prototype.toSet=K.prototype.bH=function(){for(var a=new L(this.ca),b=this.o,c=this.count,d=0;d<c;d++)a.add(b[d]);return a};K.prototype.sort=K.prototype.sort=function(a){v&&D.h(a,"function",K,"sort:sortfunc");this.J&&D.pa(this);this.o.sort(a);this.Qc();return this};
K.prototype.sortRange=K.prototype.Uq=function(a,b,c){var d=this.o,e=d.length;void 0===b&&(b=0);void 0===c&&(c=e);v&&(D.h(a,"function",K,"sortRange:sortfunc"),D.p(b,K,"sortRange:from"),D.p(c,K,"sortRange:to"));this.J&&D.pa(this);var g=c-b;if(1>=g)return this;(0>b||b>=e-1)&&D.ua(b,"0 <= from < length",K,"sortRange:from");if(2===g)return c=d[b],e=d[b+1],0<a(c,e)&&(d[b]=e,d[b+1]=c,this.Qc()),this;if(0===b)if(c>=e)d.sort(a);else for(g=d.slice(0,c),g.sort(a),a=0;a<c;a++)d[a]=g[a];else if(c>=e)for(g=d.slice(b),
g.sort(a),a=b;a<e;a++)d[a]=g[a-b];else for(g=d.slice(b,c),g.sort(a),a=b;a<c;a++)d[a]=g[a-b];this.Qc();return this};K.prototype.reverse=K.prototype.reverse=function(){this.J&&D.pa(this);this.o.reverse();this.Qc();return this};D.w(K,{count:"count"},function(){return this.o.length});D.w(K,{size:"size"},function(){return this.o.length});D.w(K,{length:"length"},function(){return this.o.length});D.w(K,{j:"iterator"},function(){if(0>=this.o.length)return Ka;var a=this.Wb;return null!==a?(a.reset(),a):new Na(this)});
D.w(K,{$n:"iteratorBackwards"},function(){if(0>=this.o.length)return Ka;var a=this.dj;return null!==a?(a.reset(),a):new Pa(this)});function Qa(a){this.oi=a;a.Wb=null;this.$a=a.G;this.bb=null}D.ke(Qa,{key:!0,value:!0});D.w(Qa,{j:"iterator"},function(){return this});Qa.prototype.reset=Qa.prototype.reset=function(){var a=this.oi;a.Wb=null;this.$a=a.G;this.bb=null};
Qa.prototype.next=Qa.prototype.next=function(){var a=this.oi;if(a.G!==this.$a){if(null===this.key)return!1;D.Va(a)}var b=this.bb,b=null===b?a.Ka:b.fb;if(null!==b)return this.bb=b,this.value=b.value,this.key=b.key,!0;this.Qf();return!1};Qa.prototype.hasNext=function(){return this.next()};Qa.prototype.first=Qa.prototype.first=function(){var a=this.oi;this.$a=a.G;a=a.Ka;if(null!==a){this.bb=a;var b=a.value;this.key=a.key;return this.value=b}return null};
Qa.prototype.any=function(a){var b=this.oi;b.Wb=null;var c=b.G;this.bb=null;for(var d=b.Ka;null!==d;){if(a(d.value))return!0;b.G!==c&&D.Va(b);d=d.fb}return!1};Qa.prototype.all=function(a){var b=this.oi;b.Wb=null;var c=b.G;this.bb=null;for(var d=b.Ka;null!==d;){if(!a(d.value))return!1;b.G!==c&&D.Va(b);d=d.fb}return!0};Qa.prototype.each=function(a){var b=this.oi;b.Wb=null;var c=b.G;this.bb=null;for(var d=b.Ka;null!==d;)a(d.value),b.G!==c&&D.Va(b),d=d.fb;return this};
Qa.prototype.map=function(a){var b=this.oi;b.Wb=null;for(var c=new K,d=b.G,e=b.Ka;null!==e;)c.add(a(e.value)),b.G!==d&&D.Va(b),e=e.fb;return c.j};Qa.prototype.filter=function(a){var b=this.oi;b.Wb=null;for(var c=new K(b.ca),d=b.G,e=b.Ka;null!==e;){var g=e.value;a(g)&&c.add(g);b.G!==d&&D.Va(b);e=e.fb}return c.j};Qa.prototype.concat=function(a){this.oi.Wb=null;return new Ma(this,a.j)};D.w(Qa,{count:"count"},function(){return this.oi.xd});
Qa.prototype.Qf=function(){this.value=this.key=null;this.$a=-1;this.oi.Wb=this};Qa.prototype.toString=function(){return null!==this.bb?"SetIterator@"+this.bb.value:"SetIterator"};
function L(a){D.tc(this);this.J=!1;void 0===a||null===a?this.ca=null:"string"===typeof a?"object"===a||"string"===a||"number"===a?this.ca=a:D.ua(a,"the string 'object', 'number' or 'string'","Set constructor: type"):"function"===typeof a?this.ca=a===Object?"object":a===String?"string":a===Number?"number":a:D.ua(a,"null, a primitive type name, or a class type","Set constructor: type");this.yd={};this.xd=0;this.Wb=null;this.G=0;this.fi=this.Ka=null}D.ja("Set",L);
L.prototype.oh=function(a){null!==this.ca&&("string"===typeof this.ca?typeof a===this.ca&&null!==a||D.gc(a,this.ca):a instanceof this.ca||D.gc(a,this.ca))};L.prototype.Qc=function(){var a=this.G;a++;999999999<a&&(a=0);this.G=a};L.prototype.freeze=L.prototype.freeze=function(){this.J=!0;return this};L.prototype.thaw=L.prototype.Ya=function(){this.J=!1;return this};L.prototype.toString=function(){return"Set("+D.getTypeName(this.ca)+")#"+D.Fd(this)};
L.prototype.add=L.prototype.add=function(a){if(null===a)return!1;v&&this.oh(a);this.J&&D.pa(this,a);var b=a;D.Ta(a)&&(b=D.sq(a));return void 0===this.yd[b]?(this.xd++,a=new Ra(a,a),this.yd[b]=a,b=this.fi,null===b?this.Ka=a:(a.Fp=b,b.fb=a),this.fi=a,this.Qc(),!0):!1};L.prototype.addAll=L.prototype.Rc=function(a){if(null===a)return this;this.J&&D.pa(this);if(D.isArray(a))for(var b=D.cb(a),c=0;c<b;c++)this.add(D.La(a,c));else for(a=a.j;a.next();)this.add(a.value);return this};
L.prototype.contains=L.prototype.contains=function(a){if(null===a)return!1;v&&this.oh(a);var b=a;return D.Ta(a)&&(b=D.Fd(a),void 0===b)?!1:void 0!==this.yd[b]};L.prototype.has=L.prototype.has=function(a){return this.contains(a)};L.prototype.containsAll=function(a){if(null===a)return!0;for(a=a.j;a.next();)if(!this.contains(a.value))return!1;return!0};L.prototype.containsAny=function(a){if(null===a)return!0;for(a=a.j;a.next();)if(this.contains(a.value))return!0;return!1};
L.prototype.first=L.prototype.first=function(){var a=this.Ka;return null===a?null:a.value};L.prototype.any=function(a){for(var b=this.G,c=this.Ka;null!==c;){if(a(c.value))return!0;this.G!==b&&D.Va(this);c=c.fb}return!1};L.prototype.all=function(a){for(var b=this.G,c=this.Ka;null!==c;){if(!a(c.value))return!1;this.G!==b&&D.Va(this);c=c.fb}return!0};L.prototype.each=function(a){for(var b=this.G,c=this.Ka;null!==c;)a(c.value),this.G!==b&&D.Va(this),c=c.fb;return this};
L.prototype.map=function(a){for(var b=new L,c=this.G,d=this.Ka;null!==d;)b.add(a(d.value)),this.G!==c&&D.Va(this),d=d.fb;return b};L.prototype.filter=function(a){for(var b=new L(this.ca),c=this.G,d=this.Ka;null!==d;){var e=d.value;a(e)&&b.add(e);this.G!==c&&D.Va(this);d=d.fb}return b};L.prototype.concat=function(a){return this.copy().Rc(a)};
L.prototype.remove=L.prototype.remove=function(a){if(null===a)return!1;v&&this.oh(a);this.J&&D.pa(this,a);var b=a;if(D.Ta(a)&&(b=D.Fd(a),void 0===b))return!1;a=this.yd[b];if(void 0===a)return!1;var c=a.fb,d=a.Fp;null!==c&&(c.Fp=d);null!==d&&(d.fb=c);this.Ka===a&&(this.Ka=c);this.fi===a&&(this.fi=d);delete this.yd[b];this.xd--;this.Qc();return!0};L.prototype["delete"]=L.prototype.delete=function(a){return this.remove(a)};
L.prototype.removeAll=L.prototype.wy=function(a){if(null===a)return this;this.J&&D.pa(this);if(D.isArray(a))for(var b=D.cb(a),c=0;c<b;c++)this.remove(D.La(a,c));else for(a=a.j;a.next();)this.remove(a.value);return this};L.prototype.retainAll=function(a){if(null===a||0===this.count)return this;this.J&&D.pa(this);var b=new L(this.ca);b.Rc(a);a=[];for(var c=this.j;c.next();){var d=c.value;b.contains(d)||a.push(d)}this.wy(a);return this};
L.prototype.clear=L.prototype.clear=function(){this.J&&D.pa(this);this.yd={};this.xd=0;this.fi=this.Ka=null;this.Qc()};L.prototype.copy=function(){var a=new L(this.ca),b=this.yd,c;for(c in b)a.add(b[c].value);return a};L.prototype.toArray=L.prototype.lc=function(){var a=Array(this.xd),b=this.yd,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};L.prototype.toList=function(){var a=new K(this.ca),b=this.yd,c;for(c in b)a.add(b[c].value);return a};D.w(L,{count:"count"},function(){return this.xd});
D.w(L,{size:"size"},function(){return this.xd});D.w(L,{j:"iterator"},function(){if(0>=this.xd)return Ka;var a=this.Wb;return null!==a?(a.reset(),a):new Qa(this)});function Sa(a){this.Ma=a;this.$a=a.G;this.bb=null}D.ke(Sa,{key:!0,value:!0});D.w(Sa,{j:"iterator"},function(){return this});Sa.prototype.reset=Sa.prototype.reset=function(){this.$a=this.Ma.G;this.bb=null};
Sa.prototype.next=Sa.prototype.next=function(){var a=this.Ma;if(a.G!==this.$a){if(null===this.key)return!1;D.Va(a)}var b=this.bb,b=null===b?a.Ka:b.fb;if(null!==b)return this.bb=b,this.value=this.key=a=b.key,!0;this.Qf();return!1};Sa.prototype.hasNext=function(){return this.next()};Sa.prototype.first=Sa.prototype.first=function(){var a=this.Ma;this.$a=a.G;a=a.Ka;return null!==a?(this.bb=a,this.value=this.key=a=a.key):null};
Sa.prototype.any=function(a){var b=this.Ma,c=b.G;this.bb=null;for(var d=b.Ka;null!==d;){if(a(d.key))return!0;b.G!==c&&D.Va(b);d=d.fb}return!1};Sa.prototype.all=function(a){var b=this.Ma,c=b.G;this.bb=null;for(var d=b.Ka;null!==d;){if(!a(d.key))return!1;b.G!==c&&D.Va(b);d=d.fb}return!0};Sa.prototype.each=function(a){var b=this.Ma,c=b.G;this.bb=null;for(var d=b.Ka;null!==d;)a(d.key),b.G!==c&&D.Va(b),d=d.fb;return this};
Sa.prototype.map=function(a){var b=this.Ma,c=b.G;this.bb=null;for(var d=new K,e=b.Ka;null!==e;)d.add(a(e.key)),b.G!==c&&D.Va(b),e=e.fb;return d.j};Sa.prototype.filter=function(a){var b=this.Ma,c=b.G;this.bb=null;for(var d=new K(b.af),e=b.Ka;null!==e;){var g=e.key;a(g)&&d.add(g);b.G!==c&&D.Va(b);e=e.fb}return d.j};Sa.prototype.concat=function(a){return new Ma(this,a.j)};D.w(Sa,{count:"count"},function(){return this.Ma.xd});Sa.prototype.Qf=function(){this.value=this.key=null;this.$a=-1};
Sa.prototype.toString=function(){return null!==this.bb?"MapKeySetIterator@"+this.bb.value:"MapKeySetIterator"};function Ta(a){D.tc(this);this.J=!0;this.Ma=a}D.Sa(Ta,L);Ta.prototype.freeze=function(){return this};Ta.prototype.Ya=function(){return this};Ta.prototype.toString=function(){return"MapKeySet("+this.Ma.toString()+")"};Ta.prototype.add=Ta.prototype.add=function(){D.k("This Set is read-only: "+this.toString());return!1};
Ta.prototype.set=Ta.prototype.set=function(){D.k("This Set is read-only: "+this.toString());return!1};Ta.prototype.contains=Ta.prototype.contains=function(a){return this.Ma.contains(a)};Ta.prototype.has=Ta.prototype.has=function(a){return this.contains(a)};Ta.prototype.remove=Ta.prototype.remove=function(){D.k("This Set is read-only: "+this.toString());return!1};Ta.prototype["delete"]=Ta.prototype.delete=function(){return this.remove()};
Ta.prototype.clear=Ta.prototype.clear=function(){D.k("This Set is read-only: "+this.toString())};Ta.prototype.first=Ta.prototype.first=function(){var a=this.Ma.Ka;return null!==a?a.key:null};Ta.prototype.any=function(a){for(var b=this.Ma.Ka;null!==b;){if(a(b.key))return!0;b=b.fb}return!1};Ta.prototype.all=function(a){for(var b=this.Ma.Ka;null!==b;){if(!a(b.key))return!1;b=b.fb}return!0};Ta.prototype.each=function(a){for(var b=this.Ma.Ka;null!==b;)a(b.key),b=b.fb;return this};
Ta.prototype.map=function(a){for(var b=new L,c=this.Ma.Ka;null!==c;)b.add(a(c.key)),c=c.fb;return b};Ta.prototype.filter=function(a){for(var b=new L(this.Ma.af),c=this.Ma.Ka;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.fb}return b};Ta.prototype.concat=function(a){return this.bH().Rc(a)};Ta.prototype.copy=function(){return new Ta(this.Ma)};Ta.prototype.toSet=Ta.prototype.bH=function(){var a=new L(this.Ma.af),b=this.Ma.yd,c;for(c in b)a.add(b[c].key);return a};
Ta.prototype.toArray=Ta.prototype.lc=function(){var a=this.Ma.yd,b=Array(this.Ma.xd),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};Ta.prototype.toList=function(){var a=new K(this.Ma.af),b=this.Ma.yd,c;for(c in b)a.add(b[c].key);return a};D.w(Ta,{count:"count"},function(){return this.Ma.xd});D.w(Ta,{size:"size"},function(){return this.Ma.xd});D.w(Ta,{j:"iterator"},function(){return 0>=this.Ma.xd?Ka:new Sa(this.Ma)});function $a(a){this.Ma=a;a.ej=null;this.$a=a.G;this.bb=null}D.ke($a,{key:!0,value:!0});
D.w($a,{j:"iterator"},function(){return this});$a.prototype.reset=$a.prototype.reset=function(){var a=this.Ma;a.ej=null;this.$a=a.G;this.bb=null};$a.prototype.next=$a.prototype.next=function(){var a=this.Ma;if(a.G!==this.$a){if(null===this.key)return!1;D.Va(a)}var b=this.bb,b=null===b?a.Ka:b.fb;if(null!==b)return this.bb=b,this.value=b.value,this.key=b.key,!0;this.Qf();return!1};$a.prototype.hasNext=function(){return this.next()};
$a.prototype.first=$a.prototype.first=function(){var a=this.Ma;this.$a=a.G;a=a.Ka;if(null!==a){this.bb=a;var b=a.value;this.key=a.key;return this.value=b}return null};$a.prototype.any=function(a){var b=this.Ma;b.ej=null;var c=b.G;this.bb=null;for(var d=b.Ka;null!==d;){if(a(d.value))return!0;b.G!==c&&D.Va(b);d=d.fb}return!1};$a.prototype.all=function(a){var b=this.Ma;b.ej=null;var c=b.G;this.bb=null;for(var d=b.Ka;null!==d;){if(!a(d.value))return!1;b.G!==c&&D.Va(b);d=d.fb}return!0};
$a.prototype.each=function(a){var b=this.Ma;b.ej=null;var c=b.G;this.bb=null;for(var d=b.Ka;null!==d;)a(d.value),b.G!==c&&D.Va(b),d=d.fb;return this};$a.prototype.map=function(a){var b=this.Ma;b.ej=null;var c=b.G;this.bb=null;for(var d=new K,e=b.Ka;null!==e;)d.add(a(e.value)),b.G!==c&&D.Va(b),e=e.fb;return d.j};$a.prototype.filter=function(a){var b=this.Ma;b.ej=null;var c=b.G;this.bb=null;for(var d=new K(b.af),e=b.Ka;null!==e;){var g=e.value;a(g)&&d.add(g);b.G!==c&&D.Va(b);e=e.fb}return d.j};
$a.prototype.concat=function(a){this.Ma.ej=null;return new Ma(this,a.j)};D.w($a,{count:"count"},function(){return this.Ma.xd});$a.prototype.Qf=function(){this.value=this.key=null;this.$a=-1;this.Ma.ej=this};$a.prototype.toString=function(){return null!==this.bb?"MapValueSetIterator@"+this.bb.value:"MapValueSetIterator"};function Ra(a,b){this.key=a;this.value=b;this.Fp=this.fb=null}D.ke(Ra,{key:!0,value:!0});Ra.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};
function bb(a){this.Ma=a;a.Wb=null;this.$a=a.G;this.bb=null}D.ke(bb,{key:!0,value:!0});D.w(bb,{j:"iterator"},function(){return this});bb.prototype.reset=bb.prototype.reset=function(){var a=this.Ma;a.Wb=null;this.$a=a.G;this.bb=null};bb.prototype.next=bb.prototype.next=function(){var a=this.Ma;if(a.G!==this.$a){if(null===this.key)return!1;D.Va(a)}var b=this.bb,b=null===b?a.Ka:b.fb;if(null!==b)return this.bb=b,this.key=b.key,this.value=b.value,!0;this.Qf();return!1};bb.prototype.hasNext=function(){return this.next()};
bb.prototype.first=bb.prototype.first=function(){var a=this.Ma;this.$a=a.G;a=a.Ka;return null!==a?(this.bb=a,this.key=a.key,this.value=a.value,a):null};bb.prototype.any=function(a){var b=this.Ma;b.Wb=null;var c=b.G;this.bb=null;for(var d=b.Ka;null!==d;){if(a(d))return!0;b.G!==c&&D.Va(b);d=d.fb}return!1};bb.prototype.all=function(a){var b=this.Ma;b.Wb=null;var c=b.G;this.bb=null;for(var d=b.Ka;null!==d;){if(!a(d))return!1;b.G!==c&&D.Va(b);d=d.fb}return!0};
bb.prototype.each=function(a){var b=this.Ma;b.Wb=null;var c=b.G;this.bb=null;for(var d=b.Ka;null!==d;)a(d),b.G!==c&&D.Va(b),d=d.fb;return this};bb.prototype.map=function(a){var b=this.Ma;b.Wb=null;var c=b.G;this.bb=null;for(var d=new K,e=b.Ka;null!==e;)d.add(a(e)),b.G!==c&&D.Va(b),e=e.fb;return d.j};bb.prototype.filter=function(a){var b=this.Ma;b.Wb=null;var c=b.G;this.bb=null;for(var d=new K,e=b.Ka;null!==e;)a(e)&&d.add(e),b.G!==c&&D.Va(b),e=e.fb;return d.j};
bb.prototype.concat=function(a){this.Ma.Wb=null;return new Ma(this,a.j)};D.w(bb,{count:"count"},function(){return this.Ma.xd});bb.prototype.Qf=function(){this.value=this.key=null;this.$a=-1;this.Ma.Wb=this};bb.prototype.toString=function(){return null!==this.bb?"MapIterator@"+this.bb:"MapIterator"};
function ma(a,b){D.tc(this);this.J=!1;void 0===a||null===a?this.af=null:"string"===typeof a?"object"===a||"string"===a||"number"===a?this.af=a:D.ua(a,"the string 'object', 'number' or 'string'","Map constructor: keytype"):"function"===typeof a?this.af=a===Object?"object":a===String?"string":a===Number?"number":a:D.ua(a,"null, a primitive type name, or a class type","Map constructor: keytype");void 0===b||null===b?this.yi=null:"string"===typeof b?"object"===b||"string"===b||"boolean"===b||"number"===
b||"function"===b?this.yi=b:D.ua(b,"the string 'object', 'number', 'string', 'boolean', or 'function'","Map constructor: valtype"):"function"===typeof b?this.yi=b===Object?"object":b===String?"string":b===Number?"number":b===Boolean?"boolean":b===Function?"function":b:D.ua(b,"null, a primitive type name, or a class type","Map constructor: valtype");this.yd={};this.xd=0;this.ej=this.Wb=null;this.G=0;this.fi=this.Ka=null}D.ja("Map",ma);
function cb(a,b){null!==a.af&&("string"===typeof a.af?typeof b===a.af&&null!==b||D.gc(b,a.af):b instanceof a.af||D.gc(b,a.af))}ma.prototype.Qc=function(){var a=this.G;a++;999999999<a&&(a=0);this.G=a};ma.prototype.freeze=ma.prototype.freeze=function(){this.J=!0;return this};ma.prototype.thaw=ma.prototype.Ya=function(){this.J=!1;return this};ma.prototype.toString=function(){return"Map("+D.getTypeName(this.af)+","+D.getTypeName(this.yi)+")#"+D.Fd(this)};
ma.prototype.add=ma.prototype.add=function(a,b){v&&(cb(this,a),null!==this.yi&&("string"===typeof this.yi?typeof b===this.yi&&null!==b||D.gc(b,this.yi):b instanceof this.yi||D.gc(b,this.yi)));this.J&&D.pa(this,a);var c=a;D.Ta(a)&&(c=D.sq(a));var d=this.yd[c];if(void 0===d)return this.xd++,d=new Ra(a,b),this.yd[c]=d,c=this.fi,null===c?this.Ka=d:(d.Fp=c,c.fb=d),this.fi=d,this.Qc(),!0;d.value=b;return!1};ma.prototype.set=ma.prototype.set=function(a,b){return this.add(a,b)};
ma.prototype.addAll=ma.prototype.Rc=function(a){if(null===a)return this;if(D.isArray(a))for(var b=D.cb(a),c=0;c<b;c++){var d=D.La(a,c);this.add(d.key,d.value)}else for(a=a.j;a.next();)this.add(a.key,a.value);return this};ma.prototype.first=ma.prototype.first=function(){return this.Ka};ma.prototype.any=function(a){for(var b=this.G,c=this.Ka;null!==c;){if(a(c))return!0;this.G!==b&&D.Va(this);c=c.fb}return!1};
ma.prototype.all=function(a){for(var b=this.G,c=this.Ka;null!==c;){if(!a(c))return!1;this.G!==b&&D.Va(this);c=c.fb}return!0};ma.prototype.each=function(a){for(var b=this.G,c=this.Ka;null!==c;)a(c),this.G!==b&&D.Va(this),c=c.fb;return this};ma.prototype.map=function(a){for(var b=new ma(this.af),c=this.G,d=this.Ka;null!==d;)b.add(d.key,a(d)),this.G!==c&&D.Va(this),d=d.fb;return b};
ma.prototype.filter=function(a){for(var b=new ma(this.af,this.yi),c=this.G,d=this.Ka;null!==d;)a(d)&&b.add(d.key,d.value),this.G!==c&&D.Va(this),d=d.fb;return b};ma.prototype.concat=function(a){return this.copy().Rc(a)};ma.prototype.contains=ma.prototype.contains=function(a){v&&cb(this,a);var b=a;return D.Ta(a)&&(b=D.Fd(a),void 0===b)?!1:void 0!==this.yd[b]};ma.prototype.has=ma.prototype.has=function(a){return this.contains(a)};
ma.prototype.getValue=ma.prototype.oa=function(a){v&&cb(this,a);var b=a;if(D.Ta(a)&&(b=D.Fd(a),void 0===b))return null;a=this.yd[b];return void 0===a?null:a.value};ma.prototype.get=ma.prototype.get=function(a){return this.oa(a)};
ma.prototype.remove=ma.prototype.remove=function(a){if(null===a)return!1;v&&cb(this,a);this.J&&D.pa(this,a);var b=a;if(D.Ta(a)&&(b=D.Fd(a),void 0===b))return!1;a=this.yd[b];if(void 0===a)return!1;var c=a.fb,d=a.Fp;null!==c&&(c.Fp=d);null!==d&&(d.fb=c);this.Ka===a&&(this.Ka=c);this.fi===a&&(this.fi=d);delete this.yd[b];this.xd--;this.Qc();return!0};ma.prototype["delete"]=ma.prototype.delete=function(a){return this.remove(a)};
ma.prototype.clear=ma.prototype.clear=function(){this.J&&D.pa(this);this.yd={};this.xd=0;this.fi=this.Ka=null;this.Qc()};ma.prototype.copy=function(){var a=new ma(this.af,this.yi),b=this.yd,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};ma.prototype.toArray=ma.prototype.lc=function(){var a=this.yd,b=Array(this.xd),c=0,d;for(d in a){var e=a[d];b[c]=new Ra(e.key,e.value);c++}return b};ma.prototype.toKeySet=ma.prototype.Yj=function(){return new Ta(this)};D.w(ma,{count:"count"},function(){return this.xd});
D.w(ma,{size:"size"},function(){return this.xd});D.w(ma,{j:"iterator"},function(){if(0>=this.count)return Ka;var a=this.Wb;return null!==a?(a.reset(),a):new bb(this)});D.w(ma,{XF:"iteratorKeys"},function(){return 0>=this.count?Ka:new Sa(this)});D.w(ma,{YF:"iteratorValues"},function(){if(0>=this.count)return Ka;var a=this.ej;return null!==a?(a.reset(),a):new $a(this)});
function O(a,b){void 0===a?this.M=this.L=0:"number"===typeof a&&"number"===typeof b?(this.L=a,this.M=b):D.k("Invalid arguments to Point constructor: "+a+", "+b);this.J=!1}D.ja("Point",O);D.Ai(O);D.ke(O,{x:!0,y:!0});O.prototype.assign=function(a){this.L=a.L;this.M=a.M};O.prototype.setTo=O.prototype.m=function(a,b){v&&(D.h(a,"number",O,"setTo:x"),D.h(b,"number",O,"setTo:y"));this.L=a;this.M=b;return this};
O.prototype.set=O.prototype.set=function(a){v&&D.l(a,O,O,"set:p");this.Ra();this.L=a.L;this.M=a.M;return this};O.prototype.copy=function(){var a=new O;a.L=this.L;a.M=this.M;return a};f=O.prototype;f.Na=function(){this.J=!0;Object.freeze(this);return this};f.V=function(){return Object.isFrozen(this)?this:this.copy().freeze()};f.freeze=function(){this.J=!0;return this};f.Ya=function(){Object.isFrozen(this)&&D.k("cannot thaw constant: "+this);this.J=!1;return this};
f.Ra=function(a){if(this.J){var b="The Point is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);D.k(b)}};O.parse=function(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new O(c,e)}return new O};O.stringify=function(a){v&&D.l(a,O);return a.x.toString()+" "+a.y.toString()};
O.prototype.toString=function(){return"Point("+this.x+","+this.y+")"};O.prototype.equals=O.prototype.O=function(a){return a instanceof O?this.L===a.x&&this.M===a.y:!1};O.prototype.equalTo=O.prototype.Ex=function(a,b){return this.L===a&&this.M===b};O.prototype.equalsApprox=O.prototype.Sc=function(a){return Q(this.L,a.x)&&Q(this.M,a.y)};O.prototype.add=O.prototype.add=function(a){v&&D.l(a,O,O,"add:p");this.Ra();this.L+=a.x;this.M+=a.y;return this};
O.prototype.subtract=O.prototype.vo=function(a){v&&D.l(a,O,O,"subtract:p");this.Ra();this.L-=a.x;this.M-=a.y;return this};O.prototype.offset=O.prototype.offset=function(a,b){v&&(D.p(a,O,"offset:dx"),D.p(b,O,"offset:dy"));this.Ra();this.L+=a;this.M+=b;return this};
O.prototype.rotate=O.prototype.rotate=function(a){v&&D.p(a,O,"rotate:angle");this.Ra();if(0===a)return this;var b=this.L,c=this.M;if(0===b&&0===c)return this;var d=0,e=0;360<=a?a-=360:0>a&&(a+=360);90===a?(d=0,e=1):180===a?(d=-1,e=0):270===a?(d=0,e=-1):(a=a*Math.PI/180,d=Math.cos(a),e=Math.sin(a));this.L=d*b-e*c;this.M=e*b+d*c;return this};O.prototype.scale=O.prototype.scale=function(a,b){v&&(D.p(a,O,"scale:sx"),D.p(b,O,"scale:sy"));this.L*=a;this.M*=b;return this};
O.prototype.distanceSquaredPoint=O.prototype.Cf=function(a){v&&D.l(a,O,O,"distanceSquaredPoint:p");var b=a.x-this.L;a=a.y-this.M;return b*b+a*a};O.prototype.distanceSquared=O.prototype.mq=function(a,b){v&&(D.p(a,O,"distanceSquared:px"),D.p(b,O,"distanceSquared:py"));var c=a-this.L,d=b-this.M;return c*c+d*d};O.prototype.normalize=O.prototype.normalize=function(){this.Ra();var a=this.L,b=this.M,c=Math.sqrt(a*a+b*b);0<c&&(this.L=a/c,this.M=b/c);return this};
O.prototype.directionPoint=O.prototype.Jc=function(a){v&&D.l(a,O,O,"directionPoint:p");return db(a.x-this.L,a.y-this.M)};O.prototype.direction=O.prototype.direction=function(a,b){v&&(D.p(a,O,"direction:px"),D.p(b,O,"direction:py"));return db(a-this.L,b-this.M)};function db(a,b){if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;var c=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?c=0>b?c+180:180-c:0>b&&(c=360-c);return c}
O.prototype.projectOntoLineSegment=function(a,b,c,d){v&&(D.p(a,O,"projectOntoLineSegment:px"),D.p(b,O,"projectOntoLineSegment:py"),D.p(c,O,"projectOntoLineSegment:qx"),D.p(d,O,"projectOntoLineSegment:qy"));fb(a,b,c,d,this.L,this.M,this);return this};O.prototype.projectOntoLineSegmentPoint=function(a,b){v&&(D.l(a,O,O,"projectOntoLineSegmentPoint:p"),D.l(b,O,O,"projectOntoLineSegmentPoint:q"));fb(a.x,a.y,b.x,b.y,this.L,this.M,this);return this};
O.prototype.snapToGrid=function(a,b,c,d){v&&(D.p(a,O,"snapToGrid:originx"),D.p(b,O,"snapToGrid:originy"),D.p(c,O,"snapToGrid:cellwidth"),D.p(d,O,"snapToGrid:cellheight"));gb(this.L,this.M,a,b,c,d,this);return this};O.prototype.snapToGridPoint=function(a,b){v&&(D.l(a,O,O,"snapToGridPoint:p"),D.l(b,Ca,O,"snapToGridPoint:q"));gb(this.L,this.M,a.x,a.y,b.width,b.height,this);return this};
O.prototype.setRectSpot=O.prototype.so=function(a,b){v&&(D.l(a,B,O,"setRectSpot:r"),D.l(b,R,O,"setRectSpot:spot"));this.Ra();this.L=a.x+b.x*a.width+b.offsetX;this.M=a.y+b.y*a.height+b.offsetY;return this};
O.prototype.setSpot=O.prototype.av=function(a,b,c,d,e){v&&(D.p(a,O,"setSpot:x"),D.p(b,O,"setSpot:y"),D.p(c,O,"setSpot:w"),D.p(d,O,"setSpot:h"),(0>c||0>d)&&D.k("Point.setSpot:Width and height cannot be negative"),D.l(e,R,O,"setSpot:spot"));this.Ra();this.L=a+e.x*c+e.offsetX;this.M=b+e.y*d+e.offsetY;return this};O.prototype.transform=function(a){v&&D.l(a,Da,O,"transform:t");a.vb(this);return this};function hb(a,b){v&&D.l(b,Da,O,"transformInverted:t");b.Ci(a);return a}var jb;
O.distanceLineSegmentSquared=jb=function(a,b,c,d,e,g){v&&(D.p(a,O,"distanceLineSegmentSquared:px"),D.p(b,O,"distanceLineSegmentSquared:py"),D.p(c,O,"distanceLineSegmentSquared:ax"),D.p(d,O,"distanceLineSegmentSquared:ay"),D.p(e,O,"distanceLineSegmentSquared:bx"),D.p(g,O,"distanceLineSegmentSquared:by"));var h=e-c,k=g-d,l=h*h+k*k;c-=a;d-=b;var m=-c*h-d*k;if(0>=m||m>=l)return h=e-a,k=g-b,Math.min(c*c+d*d,h*h+k*k);a=h*d-k*c;return a*a/l};var kb;
O.distanceSquared=kb=function(a,b,c,d){v&&(D.p(a,O,"distanceSquared:px"),D.p(b,O,"distanceSquared:py"),D.p(c,O,"distanceSquared:qx"),D.p(d,O,"distanceSquared:qy"));a=c-a;b=d-b;return a*a+b*b};var sb;
O.direction=sb=function(a,b,c,d){v&&(D.p(a,O,"direction:px"),D.p(b,O,"direction:py"),D.p(c,O,"direction:qx"),D.p(d,O,"direction:qy"));a=c-a;b=d-b;if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;d=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?d=0>b?d+180:180-d:0>b&&(d=360-d);return d};D.defineProperty(O,{x:"x"},function(){return this.L},function(a){this.Ra(a);v&&D.h(a,"number",O,"x");this.L=a});
D.defineProperty(O,{y:"y"},function(){return this.M},function(a){this.Ra(a);v&&D.h(a,"number",O,"y");this.M=a});O.prototype.isReal=O.prototype.F=function(){return isFinite(this.x)&&isFinite(this.y)};function Ca(a,b){void 0===a?this.Ha=this.Ia=0:"number"===typeof a&&(0<=a||isNaN(a))&&"number"===typeof b&&(0<=b||isNaN(b))?(this.Ia=a,this.Ha=b):D.k("Invalid arguments to Size constructor: "+a+", "+b);this.J=!1}D.ja("Size",Ca);D.Ai(Ca);D.ke(Ca,{width:!0,height:!0});
Ca.prototype.assign=function(a){this.Ia=a.Ia;this.Ha=a.Ha};Ca.prototype.setTo=Ca.prototype.m=function(a,b){v&&(D.h(a,"number",Ca,"setTo:w"),D.h(b,"number",Ca,"setTo:h"),0>a&&D.ua(a,">= 0",Ca,"setTo:w"),0>b&&D.ua(b,">= 0",Ca,"setTo:h"));this.Ia=a;this.Ha=b;return this};Ca.prototype.set=Ca.prototype.set=function(a){v&&D.l(a,Ca,Ca,"set:s");this.Ra();this.Ia=a.Ia;this.Ha=a.Ha;return this};Ca.prototype.copy=function(){var a=new Ca;a.Ia=this.Ia;a.Ha=this.Ha;return a};f=Ca.prototype;
f.Na=function(){this.J=!0;Object.freeze(this);return this};f.V=function(){return Object.isFrozen(this)?this:this.copy().freeze()};f.freeze=function(){this.J=!0;return this};f.Ya=function(){Object.isFrozen(this)&&D.k("cannot thaw constant: "+this);this.J=!1;return this};f.Ra=function(a){if(this.J){var b="The Size is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);D.k(b)}};
Ca.parse=function(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new Ca(c,e)}return new Ca};Ca.stringify=function(a){v&&D.l(a,Ca);return a.width.toString()+" "+a.height.toString()};Ca.prototype.toString=function(){return"Size("+this.width+","+this.height+")"};Ca.prototype.equals=Ca.prototype.O=function(a){return a instanceof Ca?this.Ia===a.width&&this.Ha===a.height:!1};
Ca.prototype.equalTo=Ca.prototype.Ex=function(a,b){return this.Ia===a&&this.Ha===b};Ca.prototype.equalsApprox=Ca.prototype.Sc=function(a){return Q(this.Ia,a.width)&&Q(this.Ha,a.height)};D.defineProperty(Ca,{width:"width"},function(){return this.Ia},function(a){this.Ra(a);v&&D.h(a,"number",Ca,"width");0>a&&D.ua(a,">= 0",Ca,"width");this.Ia=a});
D.defineProperty(Ca,{height:"height"},function(){return this.Ha},function(a){this.Ra(a);v&&D.h(a,"number",Ca,"height");0>a&&D.ua(a,">= 0",Ca,"height");this.Ha=a});Ca.prototype.isReal=Ca.prototype.F=function(){return isFinite(this.width)&&isFinite(this.height)};
function B(a,b,c,d){void 0===a?this.Ha=this.Ia=this.M=this.L=0:a instanceof O?b instanceof O?(this.L=Math.min(a.L,b.L),this.M=Math.min(a.M,b.M),this.Ia=Math.abs(a.L-b.L),this.Ha=Math.abs(a.M-b.M)):b instanceof Ca?(this.L=a.L,this.M=a.M,this.Ia=b.Ia,this.Ha=b.Ha):D.k("Incorrect arguments supplied to Rect constructor"):"number"===typeof a&&"number"===typeof b&&"number"===typeof c&&(0<=c||isNaN(c))&&"number"===typeof d&&(0<=d||isNaN(d))?(this.L=a,this.M=b,this.Ia=c,this.Ha=d):D.k("Invalid arguments to Rect constructor: "+
a+", "+b+", "+c+", "+d);this.J=!1}D.ja("Rect",B);D.Ai(B);D.ke(B,{x:!0,y:!0,width:!0,height:!0});B.prototype.assign=function(a){this.L=a.L;this.M=a.M;this.Ia=a.Ia;this.Ha=a.Ha};function wb(a,b,c){a.Ia=b;a.Ha=c}B.prototype.setTo=B.prototype.m=function(a,b,c,d){v&&(D.h(a,"number",B,"setTo:x"),D.h(b,"number",B,"setTo:y"),D.h(c,"number",B,"setTo:w"),D.h(d,"number",B,"setTo:h"),0>c&&D.ua(c,">= 0",B,"setTo:w"),0>d&&D.ua(d,">= 0",B,"setTo:h"));this.L=a;this.M=b;this.Ia=c;this.Ha=d;return this};
B.prototype.set=B.prototype.set=function(a){v&&D.l(a,B,B,"set:r");this.Ra();this.L=a.L;this.M=a.M;this.Ia=a.Ia;this.Ha=a.Ha;return this};B.prototype.setPoint=B.prototype.eh=function(a){v&&D.l(a,O,B,"setPoint:p");this.Ra();this.L=a.L;this.M=a.M;return this};B.prototype.setSize=function(a){v&&D.l(a,Ca,B,"setSize:s");this.Ra();this.Ia=a.Ia;this.Ha=a.Ha;return this};B.prototype.copy=function(){var a=new B;a.L=this.L;a.M=this.M;a.Ia=this.Ia;a.Ha=this.Ha;return a};f=B.prototype;
f.Na=function(){this.J=!0;Object.freeze(this);return this};f.V=function(){return Object.isFrozen(this)?this:this.copy().freeze()};f.freeze=function(){this.J=!0;return this};f.Ya=function(){Object.isFrozen(this)&&D.k("cannot thaw constant: "+this);this.J=!1;return this};f.Ra=function(a){if(this.J){var b="The Rect is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);D.k(b)}};
B.parse=function(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));for(var g=0;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));for(var h=0;""===a[b];)b++;(d=a[b++])&&(h=parseFloat(d));return new B(c,e,g,h)}return new B};B.stringify=function(a){v&&D.l(a,B);return a.x.toString()+" "+a.y.toString()+" "+a.width.toString()+" "+a.height.toString()};
B.prototype.toString=function(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"};B.prototype.equals=B.prototype.O=function(a){return a instanceof B?this.L===a.x&&this.M===a.y&&this.Ia===a.width&&this.Ha===a.height:!1};B.prototype.equalTo=B.prototype.Ex=function(a,b,c,d){return this.L===a&&this.M===b&&this.Ia===c&&this.Ha===d};B.prototype.equalsApprox=B.prototype.Sc=function(a){return Q(this.L,a.x)&&Q(this.M,a.y)&&Q(this.Ia,a.width)&&Q(this.Ha,a.height)};
function xb(a,b){return yb(a.L,b.x)&&yb(a.M,b.y)&&yb(a.Ia,b.width)&&yb(a.Ha,b.height)}B.prototype.containsPoint=B.prototype.Oa=function(a){v&&D.l(a,O,B,"containsPoint:p");return this.L<=a.x&&this.L+this.Ia>=a.x&&this.M<=a.y&&this.M+this.Ha>=a.y};B.prototype.containsRect=B.prototype.Nk=function(a){v&&D.l(a,B,B,"containsRect:r");return this.L<=a.x&&a.x+a.width<=this.L+this.Ia&&this.M<=a.y&&a.y+a.height<=this.M+this.Ha};
B.prototype.contains=B.prototype.contains=function(a,b,c,d){v?(D.p(a,B,"contains:x"),D.p(b,B,"contains:y"),void 0===c?c=0:D.p(c,B,"contains:w"),void 0===d?d=0:D.p(d,B,"contains:h"),(0>c||0>d)&&D.k("Rect.contains:Width and height cannot be negative")):(void 0===c&&(c=0),void 0===d&&(d=0));return this.L<=a&&a+c<=this.L+this.Ia&&this.M<=b&&b+d<=this.M+this.Ha};B.prototype.reset=function(){this.Ra();this.Ha=this.Ia=this.M=this.L=0};
B.prototype.offset=B.prototype.offset=function(a,b){v&&(D.p(a,B,"offset:dx"),D.p(b,B,"offset:dy"));this.Ra();this.L+=a;this.M+=b;return this};B.prototype.inflate=B.prototype.eg=function(a,b){v&&(D.p(a,B,"inflate:w"),D.p(b,B,"inflate:h"));return Bb(this,b,a,b,a)};B.prototype.addMargin=B.prototype.ix=function(a){v&&D.l(a,Hb,B,"addMargin:m");return Bb(this,a.top,a.right,a.bottom,a.left)};
B.prototype.subtractMargin=B.prototype.oK=function(a){v&&D.l(a,Hb,B,"subtractMargin:m");return Bb(this,-a.top,-a.right,-a.bottom,-a.left)};B.prototype.grow=function(a,b,c,d){v&&(D.p(a,B,"grow:t"),D.p(b,B,"grow:r"),D.p(c,B,"grow:b"),D.p(d,B,"grow:l"));return Bb(this,a,b,c,d)};function Bb(a,b,c,d,e){a.Ra();var g=a.Ia;c+e<=-g?(a.L+=g/2,a.Ia=0):(a.L-=e,a.Ia+=c+e);c=a.Ha;b+d<=-c?(a.M+=c/2,a.Ha=0):(a.M-=b,a.Ha+=b+d);return a}
B.prototype.intersectRect=function(a){v&&D.l(a,B,B,"intersectRect:r");return Kb(this,a.x,a.y,a.width,a.height)};B.prototype.intersect=B.prototype.HF=function(a,b,c,d){v&&(D.p(a,B,"intersect:x"),D.p(b,B,"intersect:y"),D.p(c,B,"intersect:w"),D.p(d,B,"intersect:h"),(0>c||0>d)&&D.k("Rect.intersect:Width and height cannot be negative"));return Kb(this,a,b,c,d)};
function Kb(a,b,c,d,e){a.Ra();var g=Math.max(a.L,b),h=Math.max(a.M,c);b=Math.min(a.L+a.Ia,b+d);c=Math.min(a.M+a.Ha,c+e);a.L=g;a.M=h;a.Ia=Math.max(0,b-g);a.Ha=Math.max(0,c-h);return a}B.prototype.intersectsRect=B.prototype.Wg=function(a){v&&D.l(a,B,B,"intersectsRect:r");return this.IF(a.x,a.y,a.width,a.height)};
B.prototype.intersects=B.prototype.IF=function(a,b,c,d){v&&(D.p(a,B,"intersects:x"),D.p(b,B,"intersects:y"),D.p(a,B,"intersects:w"),D.p(b,B,"intersects:h"),(0>c||0>d)&&D.k("Rect.intersects:Width and height cannot be negative"));var e=this.Ia,g=this.L;if(Infinity!==e&&Infinity!==c&&(e+=g,c+=a,isNaN(c)||isNaN(e)||g>c||a>e))return!1;a=this.Ha;c=this.M;return Infinity!==a&&Infinity!==d&&(a+=c,d+=b,isNaN(d)||isNaN(a)||c>d||b>a)?!1:!0};
function Lb(a,b){var c=a.Ia,d=b.width+10+10,e=a.L,g=b.x-10;if(e>d+g||g>c+e)return!1;c=a.Ha;d=b.height+10+10;e=a.M;g=b.y-10;return e>d+g||g>c+e?!1:!0}B.prototype.unionPoint=B.prototype.Ki=function(a){v&&D.l(a,O,B,"unionPoint:p");return Ob(this,a.x,a.y,0,0)};B.prototype.unionRect=B.prototype.Wh=function(a){v&&D.l(a,B,B,"unionRect:r");return Ob(this,a.L,a.M,a.Ia,a.Ha)};
B.prototype.union=B.prototype.gH=function(a,b,c,d){this.Ra();v?(D.p(a,B,"union:x"),D.p(b,B,"union:y"),void 0===c?c=0:D.p(c,B,"union:w"),void 0===d?d=0:D.p(d,B,"union:h"),(0>c||0>d)&&D.k("Rect.union:Width and height cannot be negative")):(void 0===c&&(c=0),void 0===d&&(d=0));return Ob(this,a,b,c,d)};function Ob(a,b,c,d,e){var g=Math.min(a.L,b),h=Math.min(a.M,c);b=Math.max(a.L+a.Ia,b+d);c=Math.max(a.M+a.Ha,c+e);a.L=g;a.M=h;a.Ia=b-g;a.Ha=c-h;return a}
B.prototype.setSpot=B.prototype.av=function(a,b,c){v&&(D.p(a,B,"setSpot:x"),D.p(b,B,"setSpot:y"),D.l(c,R,B,"setSpot:spot"));this.Ra();this.L=a-c.offsetX-c.x*this.Ia;this.M=b-c.offsetY-c.y*this.Ha;return this};var Pb;
B.contains=Pb=function(a,b,c,d,e,g,h,k){v?(D.p(a,B,"contains:rx"),D.p(b,B,"contains:ry"),D.p(c,B,"contains:rw"),D.p(d,B,"contains:rh"),D.p(e,B,"contains:x"),D.p(g,B,"contains:y"),void 0===h?h=0:D.p(h,B,"contains:w"),void 0===k?k=0:D.p(k,B,"contains:h"),(0>c||0>d||0>h||0>k)&&D.k("Rect.contains:Width and height cannot be negative")):(void 0===h&&(h=0),void 0===k&&(k=0));return a<=e&&e+h<=a+c&&b<=g&&g+k<=b+d};
B.intersects=function(a,b,c,d,e,g,h,k){v&&(D.p(a,B,"intersects:rx"),D.p(b,B,"intersects:ry"),D.p(c,B,"intersects:rw"),D.p(d,B,"intersects:rh"),D.p(e,B,"intersects:x"),D.p(g,B,"intersects:y"),D.p(h,B,"intersects:w"),D.p(k,B,"intersects:h"),(0>c||0>d||0>h||0>k)&&D.k("Rect.intersects:Width and height cannot be negative"));c+=a;h+=e;if(a>h||e>c)return!1;a=d+b;k+=g;return b>k||g>a?!1:!0};D.defineProperty(B,{x:"x"},function(){return this.L},function(a){this.Ra(a);v&&D.h(a,"number",B,"x");this.L=a});
D.defineProperty(B,{y:"y"},function(){return this.M},function(a){this.Ra(a);v&&D.h(a,"number",B,"y");this.M=a});D.defineProperty(B,{width:"width"},function(){return this.Ia},function(a){this.Ra(a);v&&D.h(a,"number",B,"width");0>a&&D.ua(a,">= 0",B,"width");this.Ia=a});D.defineProperty(B,{height:"height"},function(){return this.Ha},function(a){this.Ra(a);v&&D.h(a,"number",B,"height");0>a&&D.ua(a,">= 0",B,"height");this.Ha=a});
D.defineProperty(B,{left:"left"},function(){return this.L},function(a){this.Ra(a);v&&D.h(a,"number",B,"left");this.L=a});D.defineProperty(B,{top:"top"},function(){return this.M},function(a){this.Ra(a);v&&D.h(a,"number",B,"top");this.M=a});D.defineProperty(B,{right:"right"},function(){return this.L+this.Ia},function(a){this.Ra(a);v&&D.p(a,B,"right");this.L+=a-(this.L+this.Ia)});
D.defineProperty(B,{bottom:"bottom"},function(){return this.M+this.Ha},function(a){this.Ra(a);v&&D.p(a,B,"top");this.M+=a-(this.M+this.Ha)});D.defineProperty(B,{position:"position"},function(){return new O(this.L,this.M)},function(a){this.Ra(a);v&&D.l(a,O,B,"position");this.L=a.x;this.M=a.y});D.defineProperty(B,{size:"size"},function(){return new Ca(this.Ia,this.Ha)},function(a){this.Ra(a);v&&D.l(a,Ca,B,"size");this.Ia=a.width;this.Ha=a.height});
D.defineProperty(B,{bm:"center"},function(){return new O(this.L+this.Ia/2,this.M+this.Ha/2)},function(a){this.Ra(a);v&&D.l(a,O,B,"center");this.L=a.x-this.Ia/2;this.M=a.y-this.Ha/2});D.defineProperty(B,{na:"centerX"},function(){return this.L+this.Ia/2},function(a){this.Ra(a);v&&D.p(a,B,"centerX");this.L=a-this.Ia/2});D.defineProperty(B,{va:"centerY"},function(){return this.M+this.Ha/2},function(a){this.Ra(a);v&&D.p(a,B,"centerY");this.M=a-this.Ha/2});
B.prototype.isReal=B.prototype.F=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)};B.prototype.isEmpty=function(){return 0===this.width&&0===this.height};
function Hb(a,b,c,d){void 0===a?this.uh=this.nh=this.Dh=this.Eh=0:void 0===b?this.left=this.bottom=this.right=this.top=a:void 0===c?(d=b,this.top=a,this.right=b,this.bottom=a,this.left=d):void 0!==d?(this.top=a,this.right=b,this.bottom=c,this.left=d):D.k("Invalid arguments to Margin constructor: "+a+", "+b+", "+c+", "+d);this.J=!1}D.ja("Margin",Hb);D.Ai(Hb);D.ke(Hb,{top:!0,right:!0,bottom:!0,left:!0});Hb.prototype.assign=function(a){this.Eh=a.Eh;this.Dh=a.Dh;this.nh=a.nh;this.uh=a.uh};
Hb.prototype.setTo=Hb.prototype.m=function(a,b,c,d){v&&(D.h(a,"number",Hb,"setTo:t"),D.h(b,"number",Hb,"setTo:r"),D.h(c,"number",Hb,"setTo:b"),D.h(d,"number",Hb,"setTo:l"));this.Ra();this.Eh=a;this.Dh=b;this.nh=c;this.uh=d;return this};Hb.prototype.set=Hb.prototype.set=function(a){v&&D.l(a,Hb,Hb,"assign:m");this.Ra();this.Eh=a.Eh;this.Dh=a.Dh;this.nh=a.nh;this.uh=a.uh;return this};Hb.prototype.copy=function(){var a=new Hb;a.Eh=this.Eh;a.Dh=this.Dh;a.nh=this.nh;a.uh=this.uh;return a};f=Hb.prototype;
f.Na=function(){this.J=!0;Object.freeze(this);return this};f.V=function(){return Object.isFrozen(this)?this:this.copy().freeze()};f.freeze=function(){this.J=!0;return this};f.Ya=function(){Object.isFrozen(this)&&D.k("cannot thaw constant: "+this);this.J=!1;return this};f.Ra=function(a){if(this.J){var b="The Margin is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);D.k(b)}};
Hb.parse=function(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=NaN;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));if(isNaN(c))return new Hb;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new Hb(c);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));if(isNaN(g))return new Hb(c,e);for(var h=NaN;""===a[b];)b++;(d=a[b++])&&(h=parseFloat(d));return isNaN(h)?new Hb(c,e):new Hb(c,e,g,h)}return new Hb};
Hb.stringify=function(a){v&&D.l(a,Hb);return a.top.toString()+" "+a.right.toString()+" "+a.bottom.toString()+" "+a.left.toString()};Hb.prototype.toString=function(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"};Hb.prototype.equals=Hb.prototype.O=function(a){return a instanceof Hb?this.Eh===a.top&&this.Dh===a.right&&this.nh===a.bottom&&this.uh===a.left:!1};Hb.prototype.equalTo=Hb.prototype.Ex=function(a,b,c,d){return this.Eh===a&&this.Dh===b&&this.nh===c&&this.uh===d};
Hb.prototype.equalsApprox=Hb.prototype.Sc=function(a){return Q(this.Eh,a.top)&&Q(this.Dh,a.right)&&Q(this.nh,a.bottom)&&Q(this.uh,a.left)};D.defineProperty(Hb,{top:"top"},function(){return this.Eh},function(a){this.Ra(a);v&&D.p(a,Hb,"top");this.Eh=a});D.defineProperty(Hb,{right:"right"},function(){return this.Dh},function(a){this.Ra(a);v&&D.p(a,Hb,"right");this.Dh=a});D.defineProperty(Hb,{bottom:"bottom"},function(){return this.nh},function(a){this.Ra(a);v&&D.p(a,Hb,"bottom");this.nh=a});
D.defineProperty(Hb,{left:"left"},function(){return this.uh},function(a){this.Ra(a);v&&D.p(a,Hb,"left");this.uh=a});Hb.prototype.isReal=Hb.prototype.F=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};function Da(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0}D.Ai(Da);D.ke(Da,{m11:!0,m12:!0,m21:!0,m22:!0,dx:!0,dy:!0});
Da.prototype.set=Da.prototype.set=function(a){v&&D.l(a,Da,Da,"set:t");this.m11=a.m11;this.m12=a.m12;this.m21=a.m21;this.m22=a.m22;this.dx=a.dx;this.dy=a.dy;return this};Da.prototype.copy=function(){var a=new Da;a.m11=this.m11;a.m12=this.m12;a.m21=this.m21;a.m22=this.m22;a.dx=this.dx;a.dy=this.dy;return a};Da.prototype.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};
Da.prototype.equals=Da.prototype.O=function(a){return a instanceof Da?this.m11===a.m11&&this.m12===a.m12&&this.m21===a.m21&&this.m22===a.m22&&this.dx===a.dx&&this.dy===a.dy:!1};Da.prototype.isIdentity=Da.prototype.xu=function(){return 1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22&&0===this.dx&&0===this.dy};Da.prototype.reset=Da.prototype.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this};
Da.prototype.multiply=Da.prototype.multiply=function(a){v&&D.l(a,Da,Da,"multiply:matrix");var b=this.m12*a.m11+this.m22*a.m12,c=this.m11*a.m21+this.m21*a.m22,d=this.m12*a.m21+this.m22*a.m22,e=this.m11*a.dx+this.m21*a.dy+this.dx,g=this.m12*a.dx+this.m22*a.dy+this.dy;this.m11=this.m11*a.m11+this.m21*a.m12;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=g;return this};
Da.prototype.multiplyInverted=Da.prototype.lB=function(a){v&&D.l(a,Da,Da,"multiplyInverted:matrix");var b=1/(a.m11*a.m22-a.m12*a.m21),c=a.m22*b,d=-a.m12*b,e=-a.m21*b,g=a.m11*b,h=b*(a.m21*a.dy-a.m22*a.dx),k=b*(a.m12*a.dx-a.m11*a.dy);a=this.m12*c+this.m22*d;b=this.m11*e+this.m21*g;e=this.m12*e+this.m22*g;g=this.m11*h+this.m21*k+this.dx;h=this.m12*h+this.m22*k+this.dy;this.m11=this.m11*c+this.m21*d;this.m12=a;this.m21=b;this.m22=e;this.dx=g;this.dy=h;return this};
Da.prototype.invert=Da.prototype.Qx=function(){var a=1/(this.m11*this.m22-this.m12*this.m21),b=-this.m12*a,c=-this.m21*a,d=this.m11*a,e=a*(this.m21*this.dy-this.m22*this.dx),g=a*(this.m12*this.dx-this.m11*this.dy);this.m11=this.m22*a;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=g;return this};
Da.prototype.rotate=Da.prototype.rotate=function(a,b,c){v&&(D.p(a,Da,"rotate:angle"),D.p(b,Da,"rotate:rx"),D.p(c,Da,"rotate:ry"));360<=a?a-=360:0>a&&(a+=360);if(0===a)return this;this.translate(b,c);var d=0,e=0;90===a?(d=0,e=1):180===a?(d=-1,e=0):270===a?(d=0,e=-1):(e=a*Math.PI/180,d=Math.cos(e),e=Math.sin(e));a=this.m12*d+this.m22*e;var g=this.m11*-e+this.m21*d,h=this.m12*-e+this.m22*d;this.m11=this.m11*d+this.m21*e;this.m12=a;this.m21=g;this.m22=h;this.translate(-b,-c);return this};
Da.prototype.translate=Da.prototype.translate=function(a,b){v&&(D.p(a,Da,"translate:x"),D.p(b,Da,"translate:y"));this.dx+=this.m11*a+this.m21*b;this.dy+=this.m12*a+this.m22*b;return this};Da.prototype.scale=Da.prototype.scale=function(a,b){void 0===b&&(b=a);v&&(D.p(a,Da,"translate:sx"),D.p(b,Da,"translate:sy"));this.m11*=a;this.m12*=a;this.m21*=b;this.m22*=b;return this};
Da.prototype.transformPoint=Da.prototype.vb=function(a){v&&D.l(a,O,Da,"transformPoint:p");var b=a.L,c=a.M;a.L=b*this.m11+c*this.m21+this.dx;a.M=b*this.m12+c*this.m22+this.dy;return a};Da.prototype.invertedTransformPoint=Da.prototype.Ci=function(a){v&&D.l(a,O,Da,"invertedTransformPoint:p");var b=1/(this.m11*this.m22-this.m12*this.m21),c=-this.m12*b,d=this.m11*b,e=b*(this.m12*this.dx-this.m11*this.dy),g=a.L,h=a.M;a.L=g*this.m22*b+h*-this.m21*b+b*(this.m21*this.dy-this.m22*this.dx);a.M=g*c+h*d+e;return a};
Da.prototype.transformRect=Da.prototype.fH=function(a){v&&D.l(a,B,Da,"transformRect:rect");var b=a.L,c=a.M,d=b+a.Ia,e=c+a.Ha,g=this.m11,h=this.m12,k=this.m21,l=this.m22,m=this.dx,n=this.dy,p=b*g+c*k+m,q=b*h+c*l+n,r=d*g+c*k+m,c=d*h+c*l+n,s=b*g+e*k+m,b=b*h+e*l+n,g=d*g+e*k+m,d=d*h+e*l+n,e=p,h=q,p=Math.min(p,r),e=Math.max(e,r),h=Math.min(h,c),q=Math.max(q,c),p=Math.min(p,s),e=Math.max(e,s),h=Math.min(h,b),q=Math.max(q,b),p=Math.min(p,g),e=Math.max(e,g),h=Math.min(h,d),q=Math.max(q,d);a.L=p;a.M=h;a.Ia=
e-p;a.Ha=q-h;return a};function R(a,b,c,d){void 0===a?this.Jg=this.Ig=this.M=this.L=0:(void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),this.x=a,this.y=b,this.offsetX=c,this.offsetY=d);this.J=!1}D.ja("Spot",R);D.Ai(R);D.ke(R,{x:!0,y:!0,offsetX:!0,offsetY:!0});R.prototype.assign=function(a){this.L=a.L;this.M=a.M;this.Ig=a.Ig;this.Jg=a.Jg};
R.prototype.setTo=R.prototype.m=function(a,b,c,d){v&&(Qb(a,"setTo:x"),Qb(b,"setTo:y"),Ub(c,"setTo:offx"),Ub(d,"setTo:offy"));this.Ra();this.L=a;this.M=b;this.Ig=c;this.Jg=d;return this};R.prototype.set=R.prototype.set=function(a){v&&D.l(a,R,R,"set:s");this.Ra();this.L=a.L;this.M=a.M;this.Ig=a.Ig;this.Jg=a.Jg;return this};R.prototype.copy=function(){var a=new R;a.L=this.L;a.M=this.M;a.Ig=this.Ig;a.Jg=this.Jg;return a};f=R.prototype;f.Na=function(){this.J=!0;Object.freeze(this);return this};
f.V=function(){return Object.isFrozen(this)?this:this.copy().freeze()};f.freeze=function(){this.J=!0;return this};f.Ya=function(){Object.isFrozen(this)&&D.k("cannot thaw constant: "+this);this.J=!1;return this};f.Ra=function(a){if(this.J){var b="The Spot is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);D.k(b)}};function Xb(a,b){a.L=NaN;a.M=NaN;a.Ig=b;return a}function Qb(a,b){(isNaN(a)||1<a||0>a)&&D.ua(a,"0 <= "+b+" <= 1",R,b)}
function Ub(a,b){(isNaN(a)||Infinity===a||-Infinity===a)&&D.ua(a,"real number, not NaN or Infinity",R,b)}var Yb;
R.parse=Yb=function(a){if("string"===typeof a){a=a.trim();if("None"===a)return bc;if("TopLeft"===a)return cc;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return dc;if("TopRight"===a)return ec;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return fc;if("Center"===a)return gc;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return oc;if("BottomLeft"===a)return pc;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return qc;if("BottomRight"===a)return rc;if("TopSide"===a)return sc;if("LeftSide"===
a)return tc;if("RightSide"===a)return uc;if("BottomSide"===a)return yc;if("TopBottomSides"===a)return zc;if("LeftRightSides"===a)return Gc;if("TopLeftSides"===a)return Hc;if("TopRightSides"===a)return Ic;if("BottomLeftSides"===a)return Jc;if("BottomRightSides"===a)return Kc;if("NotTopSide"===a)return Lc;if("NotLeftSide"===a)return Mc;if("NotRightSide"===a)return Qc;if("NotBottomSide"===a)return Rc;if("AllSides"===a)return Sc;if("Default"===a)return Tc;a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;
var d=a[b++];void 0!==d&&0<d.length&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(e=parseFloat(d));for(var g=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(g=parseFloat(d));for(var h=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(h=parseFloat(d));return new R(c,e,g,h)}return new R};R.stringify=function(a){v&&D.l(a,R);return a.fd()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()};
R.prototype.toString=function(){return this.fd()?0===this.Ig&&0===this.Jg?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.O(bc)?"None":this.O(cc)?"TopLeft":this.O(dc)?"Top":this.O(ec)?"TopRight":this.O(fc)?"Left":this.O(gc)?"Center":this.O(oc)?"Right":this.O(pc)?"BottomLeft":this.O(qc)?"Bottom":this.O(rc)?"BottomRight":this.O(sc)?"TopSide":this.O(tc)?"LeftSide":this.O(uc)?"RightSide":this.O(yc)?"BottomSide":this.O(zc)?"TopBottomSides":this.O(Gc)?
"LeftRightSides":this.O(Hc)?"TopLeftSides":this.O(Ic)?"TopRightSides":this.O(Jc)?"BottomLeftSides":this.O(Kc)?"BottomRightSides":this.O(Lc)?"NotTopSide":this.O(Mc)?"NotLeftSide":this.O(Qc)?"NotRightSide":this.O(Rc)?"NotBottomSide":this.O(Sc)?"AllSides":this.O(Tc)?"Default":"None"};R.prototype.equals=R.prototype.O=function(a){return a instanceof R?(this.L===a.x||isNaN(this.L)&&isNaN(a.x))&&(this.M===a.y||isNaN(this.M)&&isNaN(a.y))&&this.Ig===a.offsetX&&this.Jg===a.offsetY:!1};
R.prototype.opposite=R.prototype.kG=function(){return new R(.5-(this.L-.5),.5-(this.M-.5),-this.Ig,-this.Jg)};R.prototype.includesSide=R.prototype.Ij=function(a){if(!this.Kj())return!1;if(!a.Kj())if(a.O(Uc))a=tc;else if(a.O(Vc))a=uc;else if(a.O(Wc))a=sc;else if(a.O(Xc))a=yc;else return!1;a=a.offsetY;return(this.Jg&a)===a};D.defineProperty(R,{x:"x"},function(){return this.L},function(a){this.Ra(a);v&&Qb(a,"x");this.L=a});
D.defineProperty(R,{y:"y"},function(){return this.M},function(a){this.Ra(a);v&&Qb(a,"y");this.M=a});D.defineProperty(R,{offsetX:"offsetX"},function(){return this.Ig},function(a){this.Ra(a);v&&Ub(a,"offsetX");this.Ig=a});D.defineProperty(R,{offsetY:"offsetY"},function(){return this.Jg},function(a){this.Ra(a);v&&Ub(a,"offsetY");this.Jg=a});R.prototype.isSpot=R.prototype.fd=function(){return!isNaN(this.x)&&!isNaN(this.y)};R.prototype.isNoSpot=R.prototype.Zd=function(){return isNaN(this.x)||isNaN(this.y)};
R.prototype.isSide=R.prototype.Kj=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY};R.prototype.isNone=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};R.prototype.isDefault=R.prototype.ed=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};var bc;R.None=bc=Xb(new R(0,0,0,0),0).Na();var Tc;R.Default=Tc=Xb(new R(0,0,-1,0),-1).Na();var cc;R.TopLeft=cc=(new R(0,0,0,0)).Na();var dc;
R.TopCenter=dc=(new R(.5,0,0,0)).Na();var ec;R.TopRight=ec=(new R(1,0,0,0)).Na();var fc;R.LeftCenter=fc=(new R(0,.5,0,0)).Na();var gc;R.Center=gc=(new R(.5,.5,0,0)).Na();var oc;R.RightCenter=oc=(new R(1,.5,0,0)).Na();var pc;R.BottomLeft=pc=(new R(0,1,0,0)).Na();var qc;R.BottomCenter=qc=(new R(.5,1,0,0)).Na();var rc;R.BottomRight=rc=(new R(1,1,0,0)).Na();var Yc;R.MiddleTop=Yc=dc;var ed;R.MiddleLeft=ed=fc;var fd;R.MiddleRight=fd=oc;var gd;R.MiddleBottom=gd=qc;var Wc;R.Top=Wc=dc;var Uc;R.Left=Uc=fc;
var Vc;R.Right=Vc=oc;var Xc;R.Bottom=Xc=qc;var sc;R.TopSide=sc=Xb(new R(0,0,1,D.ud),1).Na();var tc;R.LeftSide=tc=Xb(new R(0,0,1,D.Yc),1).Na();var uc;R.RightSide=uc=Xb(new R(0,0,1,D.ld),1).Na();var yc;R.BottomSide=yc=Xb(new R(0,0,1,D.kd),1).Na();var zc;R.TopBottomSides=zc=Xb(new R(0,0,1,D.ud|D.kd),1).Na();var Gc;R.LeftRightSides=Gc=Xb(new R(0,0,1,D.Yc|D.ld),1).Na();var Hc;R.TopLeftSides=Hc=Xb(new R(0,0,1,D.ud|D.Yc),1).Na();var Ic;R.TopRightSides=Ic=Xb(new R(0,0,1,D.ud|D.ld),1).Na();var Jc;
R.BottomLeftSides=Jc=Xb(new R(0,0,1,D.kd|D.Yc),1).Na();var Kc;R.BottomRightSides=Kc=Xb(new R(0,0,1,D.kd|D.ld),1).Na();var Lc;R.NotTopSide=Lc=Xb(new R(0,0,1,D.Yc|D.ld|D.kd),1).Na();var Mc;R.NotLeftSide=Mc=Xb(new R(0,0,1,D.ud|D.ld|D.kd),1).Na();var Qc;R.NotRightSide=Qc=Xb(new R(0,0,1,D.ud|D.Yc|D.kd),1).Na();var Rc;R.NotBottomSide=Rc=Xb(new R(0,0,1,D.ud|D.Yc|D.ld),1).Na();var Sc;R.AllSides=Sc=Xb(new R(0,0,1,D.ud|D.Yc|D.ld|D.kd),1).Na();function hd(){this.Yb=[1,0,0,1,0,0]}
hd.prototype.copy=function(){var a=new hd;a.Yb[0]=this.Yb[0];a.Yb[1]=this.Yb[1];a.Yb[2]=this.Yb[2];a.Yb[3]=this.Yb[3];a.Yb[4]=this.Yb[4];a.Yb[5]=this.Yb[5];return a};hd.prototype.translate=function(a,b){this.Yb[4]+=this.Yb[0]*a+this.Yb[2]*b;this.Yb[5]+=this.Yb[1]*a+this.Yb[3]*b};hd.prototype.scale=function(a,b){this.Yb[0]*=a;this.Yb[1]*=a;this.Yb[2]*=b;this.Yb[3]*=b};function id(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.NE=[];this.pattern=null}
id.prototype.addColorStop=function(a,b){this.NE.push({offset:a,color:b})};
function nd(a,b,c){this.fillStyle="#000000";this.font="10px sans-serif";this.globalAlpha=1;this.lineCap="butt";this.bo=0;this.lineJoin="miter";this.lineWidth=1;this.miterLimit=10;this.shadowBlur=0;this.shadowColor="rgba(0, 0, 0, 0)";this.shadowOffsetY=this.shadowOffsetX=0;this.strokeStyle="#000000";this.textAlign="start";this.eq=!1;this.Lg=this.tt=this.st=0;this.document=b||document;this.hF=c;this.$x=null;this.path=[];this.Mh=new hd;this.stack=[];this.Ef=[];this.Cx=a;this.NJ="http://www.w3.org/2000/svg";
this.width=this.Cx.width;this.height=this.Cx.height;this.Am=od(this,"svg",{width:this.width+"px",height:this.height+"px",FM:"0 0 "+this.Cx.width+" "+this.Cx.height});this.Am.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg");this.Am.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink");pd(this,1,0,0,1,0,0);a=D.Gm++;b=od(this,"clipPath",{id:"mainClip"+a});b.appendChild(od(this,"rect",{x:0,y:0,width:this.width,height:this.height}));
this.Am.appendChild(b);this.Ef[0].setAttributeNS(null,"clip-path","url(#mainClip"+a+")")}f=nd.prototype;f.arc=function(a,b,c,d,e,g){qd(this,a,b,c,d,e,g)};f.beginPath=function(){this.path=[]};f.bezierCurveTo=function(a,b,c,d,e,g){this.path.push(["C",a,b,c,d,e,g])};f.clearRect=function(){};f.clip=function(){rd(this,"clipPath",this.path,new hd)};f.closePath=function(){this.path.push(["z"])};f.createLinearGradient=function(a,b,c,d){var e=new id("linear");e.x1=a;e.y1=b;e.x2=c;e.y2=d;return e};
f.createPattern=function(){return null};f.createRadialGradient=function(a,b,c,d,e,g){var h=new id("radial");h.x1=a;h.y1=b;h.r1=c;h.x2=d;h.y2=e;h.r2=g;return h};
f.drawImage=function(a,b,c,d,e,g,h,k,l){var m="";a instanceof HTMLCanvasElement&&(m=a.toDataURL());a instanceof HTMLImageElement&&(m=a.src);void 0===d&&(g=b,h=c,k=d=a.naturalWidth,l=e=a.naturalHeight);d=d||0;e=e||0;g=g||0;h=h||0;k=k||0;l=l||0;m={x:0,y:0,width:a.naturalWidth,height:a.naturalHeight,href:m,preserveAspectRatio:"xMidYMid slice"};yb(d,k)&&yb(e,l)||(m.preserveAspectRatio="none");var n="";k/=d;l/=e;if(0!==g||0!==h)n+=" translate("+g+", "+h+")";if(1!==k||1!==l)n+=" scale("+k+", "+l+")";if(0!==
b||0!==c)n+=" translate("+-b+", "+-c+")";if(0!==b||0!==c||d!==a.naturalWidth||e!==a.naturalHeight)a="CLIP"+D.Gm++,g=od(this,"clipPath",{id:a}),g.appendChild(od(this,"rect",{x:b,y:c,width:d,height:e})),this.Am.appendChild(g),m["clip-path"]="url(#"+a+")";Ad(this,"image",m,this.Mh,n);this.addElement("image",m)};f.fill=function(){rd(this,"fill",this.path,this.Mh)};f.Ug=function(){this.eq?this.clip():this.fill()};f.fillRect=function(a,b,c,d){Bd(this,"fill",[a,b,c,d],this.Mh)};
f.fillText=function(a,b,c){a=[a,b,c];b=this.textAlign;"left"===b?b="start":"right"===b?b="end":"center"===b&&(b="middle");b={x:a[1],y:a[2],style:"font: "+this.font,"text-anchor":b};Ad(this,"fill",b,this.Mh);this.addElement("text",b,a[0])};f.lineTo=function(a,b){this.path.push(["L",a,b])};f.moveTo=function(a,b){this.path.push(["M",a,b])};f.quadraticCurveTo=function(a,b,c,d){this.path.push(["Q",a,b,c,d])};f.rect=function(a,b,c,d){this.path.push(["M",a,b],["L",a+c,b],["L",a+c,b+d],["L",a,b+d],["z"])};
f.restore=function(){this.Mh=this.stack.pop();this.path=this.stack.pop();var a=this.stack.pop();this.fillStyle=a.fillStyle;this.font=a.font;this.globalAlpha=a.globalAlpha;this.lineCap=a.lineCap;this.bo=a.bo;this.lineJoin=a.lineJoin;this.lineWidth=a.lineWidth;this.miterLimit=a.miterLimit;this.shadowBlur=a.shadowBlur;this.shadowColor=a.shadowColor;this.shadowOffsetX=a.shadowOffsetX;this.shadowOffsetY=a.shadowOffsetY;this.strokeStyle=a.strokeStyle;this.textAlign=a.textAlign};
f.save=function(){this.stack.push({fillStyle:this.fillStyle,font:this.font,globalAlpha:this.globalAlpha,lineCap:this.lineCap,bo:this.bo,lineJoin:this.lineJoin,lineWidth:this.lineWidth,miterLimit:this.miterLimit,shadowBlur:this.shadowBlur,shadowColor:this.shadowColor,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,strokeStyle:this.strokeStyle,textAlign:this.textAlign});for(var a=[],b=0;b<this.path.length;b++)a.push(this.path[b]);this.stack.push(a);this.stack.push(this.Mh.copy())};
f.setTransform=function(a,b,c,d,e,g){1===a&&0===b&&0===c&&1===d&&0===e&&0===g||pd(this,a,b,c,d,e,g)};f.scale=function(a,b){this.Mh.scale(a,b)};f.translate=function(a,b){this.Mh.translate(a,b)};f.transform=function(){};f.stroke=function(){rd(this,"stroke",this.path,this.Mh)};f.Vj=function(){this.eq||this.stroke()};f.strokeRect=function(a,b,c,d){Bd(this,"stroke",[a,b,c,d],this.Mh)};
function od(a,b,c,d){a=a.document.createElementNS(a.NJ,b);if(D.Ta(c))for(var e in c)a.setAttributeNS("href"===e?"http://www.w3.org/1999/xlink":"",e,c[e]);void 0!==d&&(a.textContent=d);return a}f.addElement=function(a,b,c){a=od(this,a,b,c);0<this.Ef.length?this.Ef[this.Ef.length-1].appendChild(a):this.Am.appendChild(a);return this.$x=a};
function Ad(a,b,c,d,e){1!==a.globalAlpha&&(c.opacity=a.globalAlpha);"fill"===b?(a.fillStyle instanceof id?c.fill=Cd(a,a.fillStyle):(/^rgba\(/.test(a.fillStyle)&&(b=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.fillStyle),c.fill="rgb("+b[1]+","+b[2]+","+b[3]+")",c["fill-opacity"]=b[4]),c.fill=a.fillStyle),c.stroke="none"):"stroke"===b&&(c.fill="none",a.strokeStyle instanceof id?c.stroke=Cd(a,a.strokeStyle):(/^rgba\(/.test(a.strokeStyle)&&(b=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.strokeStyle),
c.stroke="rgb("+b[1]+","+b[2]+","+b[3]+")",c["stroke-opacity"]=b[4]),c.stroke=a.strokeStyle),c["stroke-width"]=a.lineWidth,c["stroke-linecap"]=a.lineCap,c["stroke-linejoin"]=a.lineJoin,c["stroke-miterlimit"]=a.miterLimit);a=d.Yb;a="matrix("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+")";void 0!==e&&(a+=e);c.transform=a}
function Cd(a,b){var c="GRAD"+D.Gm++,d;if("linear"===b.type)d=od(a,"linearGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,id:c,gradientUnits:"userSpaceOnUse"});else if("radial"===b.type)d=od(a,"radialGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,r1:b.r1,r2:b.r2,id:c});else if("pattern"===b.type){var e=b.pattern;d={width:e.width,height:e.height,id:c,patternUnits:"userSpaceOnUse"};var g="";e instanceof HTMLCanvasElement&&(g=e.toDataURL());e instanceof HTMLImageElement&&(g=e.src);e={x:0,y:0,width:e.width,height:e.height,
href:g};d=od(a,"pattern",d);d.appendChild(od(a,"image",e))}else throw Error("invalid gradient");for(var e=b.NE,g=e.length,h=[],k=0;k<g;k++){var l=e[k],m=l.color,l={offset:l.offset,"stop-color":m};/^rgba\(/.test(m)&&(m=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(m),l["stop-color"]="rgb("+m[1]+","+m[2]+","+m[3]+")",l["stop-opacity"]=m[4]);h.push(l)}h.sort(function(a,b){return a.offset>b.offset?1:-1});for(k=0;k<g;k++)d.appendChild(od(a,"stop",h[k]));a.Am.appendChild(d);
return"url(#"+c+")"}function Bd(a,b,c,d){c={x:c[0],y:c[1],width:c[2],height:c[3]};Ad(a,b,c,d);a.addElement("rect",c)}
function rd(a,b,c,d){for(var e=[],g=0;g<c.length;g++){var h=D.cm(c[g]),k=[h.shift()];if("A"===k[0])k.push(h.shift()+","+h.shift(),h.shift(),h.shift()+","+h.shift(),h.shift()+","+h.shift());else for(;h.length;)k.push(h.shift()+","+h.shift());e.push(k.join(" "))}c={d:e.join(" ")};Ad(a,b,c,d);"clipPath"===b?(b="CLIP"+D.Gm++,d=od(a,"clipPath",{id:b}),d.appendChild(od(a,"path",c)),a.Am.appendChild(d),0<a.Ef.length&&a.Ef[a.Ef.length-1].setAttributeNS(null,"clip-path","url(#"+b+")")):a.addElement("path",
c)}function qd(a,b,c,d,e,g,h){var k=Math.abs(e-g);if(e!==g){var l=b+d*Math.cos(g);g=c+d*Math.sin(g);k>=2*Math.PI?(qd(a,b,c,d,e,e+Math.PI,h),qd(a,b,c,d,e+Math.PI,e+2*Math.PI,h),a.path.push(["M",l,g])):(b+=d*Math.cos(e),c+=d*Math.sin(e),k=180*k/Math.PI,e=h?0:1,h=180<=k===!!h?0:1,0!==a.path.length?a.path.push(["L",b,c]):a.path.push(["M",b,c]),a.path.push(["A",d,d,k,h,e,l,g]))}}function pd(a,b,c,d,e,g,h){var k=new hd;k.Yb=[b,c,d,e,g,h];b={};Ad(a,"g",b,k);k=a.addElement("g",b);a.Ef.push(k)}
f.ib=function(){if(0!==this.shadowOffsetX||0!==this.shadowOffsetY||0!==this.shadowBlur){var a="SHADOW"+D.Gm++,b=this.addElement("filter",{id:a,x:"-100%",y:"-100%",width:"300%",height:"300%"},null),c,d,e,g,h;c=od(this,"feGaussianBlur",{"in":"SourceAlpha",result:"blur",vM:this.shadowBlur/2});d=od(this,"feFlood",{"in":"blur",result:"flood","flood-color":this.shadowColor});e=od(this,"feComposite",{"in":"flood",in2:"blur",operator:"in",result:"comp"});g=od(this,"feOffset",{"in":"comp",result:"offsetBlur",
dx:this.shadowOffsetX,dy:this.shadowOffsetY});h=od(this,"feMerge",{});h.appendChild(od(this,"feMergeNode",{"in":"offsetBlur"}));h.appendChild(od(this,"feMergeNode",{"in":"SourceGraphic"}));b.appendChild(c);b.appendChild(d);b.appendChild(e);b.appendChild(g);b.appendChild(h);0<this.Ef.length&&this.Ef[this.Ef.length-1].setAttributeNS(null,"filter","url(#"+a+")")}};f.JB=function(a,b,c){this.st=a;this.tt=b;this.Lg=c};f.to=function(){this.shadowBlur=this.shadowOffsetY=this.shadowOffsetX=0};
f.uo=function(){this.shadowOffsetX=this.st;this.shadowOffsetY=this.tt;this.shadowBlur=this.Lg};f.GA=function(){return!1};f.BA=function(){};f.Be=function(){};f.Fy=function(){};nd.prototype.rotate=function(){};function ka(a,b){this.ownerDocument=void 0===b?document:b;var c=this.ownerDocument.createElement("canvas");c.tabIndex=0;this.Ud=c;this.Ok=new Dd(c);c.ba=a;Object.seal(this)}f=ka.prototype;f.toDataURL=function(a,b){return this.Ud.toDataURL(a,b)};f.getBoundingClientRect=function(){return this.Ud.getBoundingClientRect()};
f.focus=function(){return this.Ud.focus()};f.addEventListener=function(a,b,c){this.Ud.addEventListener(a,b,c)};f.removeEventListener=function(a,b,c){this.Ud.removeEventListener(a,b,c)};D.defineProperty(ka,{width:"width"},function(){return this.Ud.width},function(a){this.Ud.width=a});D.defineProperty(ka,{height:"height"},function(){return this.Ud.height},function(a){this.Ud.height=a});D.w(ka,{style:"style"},function(){return this.Ud.style});
function Dd(a){a.getContext&&a.getContext("2d")||D.k("Browser does not support HTML Canvas Element");this.Da=a.getContext("2d");this.bz=this.dz=this.cz="";this.pr=!1;this.Lg=this.tt=this.st=0;Object.seal(this)}Dd.prototype.Fy=function(a){this.Da.VA=a;this.Da.YL=a};D.defineProperty(Dd,{fillStyle:"fillStyle"},function(){return this.Da.fillStyle},function(a){this.bz!==a&&(this.bz=this.Da.fillStyle=a)});
D.defineProperty(Dd,{font:"font"},function(){return this.Da.font},function(a){this.cz!==a&&(this.cz=this.Da.font=a)});D.defineProperty(Dd,{globalAlpha:"globalAlpha"},function(){return this.Da.globalAlpha},function(a){this.Da.globalAlpha=a});D.defineProperty(Dd,{lineCap:"lineCap"},function(){return this.Da.lineCap},function(a){this.Da.lineCap=a});D.defineProperty(Dd,{bo:"lineDashOffset"},function(){return this.Da.bo},function(a){this.Da.bo=a});
D.defineProperty(Dd,{lineJoin:"lineJoin"},function(){return this.Da.lineJoin},function(a){this.Da.lineJoin=a});D.defineProperty(Dd,{lineWidth:"lineWidth"},function(){return this.Da.lineWidth},function(a){this.Da.lineWidth=a});D.defineProperty(Dd,{miterLimit:"miterLimit"},function(){return this.Da.miterLimit},function(a){this.Da.miterLimit=a});D.defineProperty(Dd,{shadowBlur:"shadowBlur"},function(){return this.Da.shadowBlur},function(a){this.Da.shadowBlur=a});
D.defineProperty(Dd,{shadowColor:"shadowColor"},function(){return this.Da.shadowColor},function(a){this.Da.shadowColor=a});D.defineProperty(Dd,{shadowOffsetX:"shadowOffsetX"},function(){return this.Da.shadowOffsetX},function(a){this.Da.shadowOffsetX=a});D.defineProperty(Dd,{shadowOffsetY:"shadowOffsetY"},function(){return this.Da.shadowOffsetY},function(a){this.Da.shadowOffsetY=a});
D.defineProperty(Dd,{strokeStyle:"strokeStyle"},function(){return this.Da.strokeStyle},function(a){this.dz!==a&&(this.dz=this.Da.strokeStyle=a)});D.defineProperty(Dd,{textAlign:"textAlign"},function(){return this.Da.textAlign},function(a){this.Da.textAlign=a});D.defineProperty(Dd,{VA:"imageSmoothingEnabled"},function(){return this.Da.VA},function(a){this.Da.VA=a});f=Dd.prototype;f.arc=function(a,b,c,d,e,g){this.Da.arc(a,b,c,d,e,g)};f.beginPath=function(){this.Da.beginPath()};
f.bezierCurveTo=function(a,b,c,d,e,g){this.Da.bezierCurveTo(a,b,c,d,e,g)};f.clearRect=function(a,b,c,d){this.Da.clearRect(a,b,c,d)};f.clip=function(){this.Da.clip()};f.closePath=function(){this.Da.closePath()};f.createLinearGradient=function(a,b,c,d){return this.Da.createLinearGradient(a,b,c,d)};f.createPattern=function(a,b){return this.Da.createPattern(a,b)};f.createRadialGradient=function(a,b,c,d,e,g){return this.Da.createRadialGradient(a,b,c,d,e,g)};
f.drawImage=function(a,b,c,d,e,g,h,k,l){void 0===d?this.Da.drawImage(a,b,c):this.Da.drawImage(a,b,c,d,e,g,h,k,l)};f.fill=function(){this.Da.fill()};f.fillRect=function(a,b,c,d){this.Da.fillRect(a,b,c,d)};f.fillText=function(a,b,c){this.Da.fillText(a,b,c)};f.getImageData=function(a,b,c,d){return this.Da.getImageData(a,b,c,d)};f.lineTo=function(a,b){this.Da.lineTo(a,b)};f.measureText=function(a){return this.Da.measureText(a)};f.moveTo=function(a,b){this.Da.moveTo(a,b)};
f.quadraticCurveTo=function(a,b,c,d){this.Da.quadraticCurveTo(a,b,c,d)};f.rect=function(a,b,c,d){this.Da.rect(a,b,c,d)};f.restore=function(){this.Da.restore()};Dd.prototype.rotate=function(a){this.Da.rotate(a)};f=Dd.prototype;f.save=function(){this.Da.save()};f.setTransform=function(a,b,c,d,e,g){this.Da.setTransform(a,b,c,d,e,g)};f.scale=function(a,b){this.Da.scale(a,b)};f.stroke=function(){this.Da.stroke()};
f.transform=function(a,b,c,d,e,g){1===a&&0===b&&0===c&&1===d&&0===e&&0===g||this.Da.transform(a,b,c,d,e,g)};f.translate=function(a,b){this.Da.translate(a,b)};f.Ug=function(a){if(a instanceof Ba&&a.type===Ed){var b=a.Mo;a=a.hz;a>b?(this.scale(b/a,1),this.translate((a-b)/2,0)):b>a&&(this.scale(1,a/b),this.translate(0,(b-a)/2));this.pr?this.clip():this.fill();a>b?(this.translate(-(a-b)/2,0),this.scale(1/(b/a),1)):b>a&&(this.translate(0,-(b-a)/2),this.scale(1,1/(a/b)))}else this.pr?this.clip():this.fill()};
f.Vj=function(){this.pr||this.stroke()};D.defineProperty(Dd,{eq:"clipInsteadOfFill"},function(){return this.pr},function(a){this.pr=a});f=Dd.prototype;f.JB=function(a,b,c){this.st=a;this.tt=b;this.Lg=c};f.to=function(){this.shadowBlur=this.shadowOffsetY=this.shadowOffsetX=0};f.uo=function(){this.shadowOffsetX=this.st;this.shadowOffsetY=this.tt;this.shadowBlur=this.Lg};
f.GA=function(a,b){var c=this.Da;if(void 0!==c.setLineDash)c.setLineDash(a),c.lineDashOffset=b;else if(void 0!==c.webkitLineDash)c.webkitLineDash=a,c.webkitLineDashOffset=b;else if(void 0!==c.mozDash)c.mozDash=a,c.mozDashOffset=b;else return!1;return!0};f.BA=function(){var a=this.Da;void 0!==a.setLineDash?(a.setLineDash(D.Co),a.lineDashOffset=0):void 0!==a.webkitLineDash?(a.webkitLineDash=D.Co,a.webkitLineDashOffset=0):void 0!==a.mozDash&&(a.mozDash=null,a.mozDashOffset=0)};
f.Be=function(a){a&&(this.cz="");this.bz=this.dz=""};
var Fd=(Math.sqrt(2)-1)/3*4,Gd=(new O(0,0)).Na(),Hd=(new B(0,0,0,0)).Na(),Ud=(new Hb(0,0,0,0)).Na(),Vd=(new Hb(2,2,2,2)).Na(),Wd=(new O(6,6)).Na(),Xd=(new O(-Infinity,-Infinity)).Na(),Yd=(new O(Infinity,Infinity)).Na(),Zd=(new Ca(0,0)).Na(),$d=(new Ca(1,1)).Na(),ae=(new Ca(6,6)).Na(),be=(new Ca(8,8)).Na(),ce=(new Ca(10,10)).Na(),ke=(new Ca(Infinity,Infinity)).Na(),le=(new O(NaN,NaN)).Na(),me=(new Ca(NaN,NaN)).Na(),ne=(new B(NaN,NaN,NaN,NaN)).Na(),oe=(new R(.156,.156)).Na(),pe=(new R(.844,.844)).Na(),
qe=new la,re=new la,se=null;function te(a){if(0>=a)return 0;var b=se;if(null===b){for(var b=[],c=0;2E3>=c;c++)b[c]=Math.sqrt(c);se=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)}function Q(a,b){var c=a-b;return.5>c&&-.5<c}function yb(a,b){var c=a-b;return 5E-8>c&&-5E-8<c}
function ue(a,b,c,d,e,g,h){0>=e&&(e=1E-6);var k=0,l=0,m=0,n=0;a<c?(l=a,k=c):(l=c,k=a);b<d?(n=b,m=d):(n=d,m=b);if(a===c)return n<=h&&h<=m&&a-e<=g&&g<=a+e;if(b===d)return l<=g&&g<=k&&b-e<=h&&h<=b+e;k+=e;l-=e;if(l<=g&&g<=k&&(m+=e,n-=e,n<=h&&h<=m))if(k-l>m-n)if(a-c>e||c-a>e){if(g=(d-b)/(c-a)*(g-a)+b,g-e<=h&&h<=g+e)return!0}else return!0;else if(b-d>e||d-b>e){if(h=(c-a)/(d-b)*(h-b)+a,h-e<=g&&g<=h+e)return!0}else return!0;return!1}
function De(a,b,c,d,e,g,h,k,l,m,n,p){if(ue(a,b,h,k,p,c,d)&&ue(a,b,h,k,p,e,g))return ue(a,b,h,k,p,m,n);var q=(a+c)/2,r=(b+d)/2,s=(c+e)/2,u=(d+g)/2;e=(e+h)/2;g=(g+k)/2;d=(q+s)/2;c=(r+u)/2;var s=(s+e)/2,u=(u+g)/2,t=(d+s)/2,y=(c+u)/2;return De(a,b,q,r,d,c,t,y,l,m,n,p)||De(t,y,s,u,e,g,h,k,l,m,n,p)}
function Ee(a,b,c,d,e,g,h,k,l,m){if(ue(a,b,h,k,l,c,d)&&ue(a,b,h,k,l,e,g))Ob(m,a,b,0,0),Ob(m,h,k,0,0);else{var n=(a+c)/2,p=(b+d)/2,q=(c+e)/2,r=(d+g)/2;e=(e+h)/2;g=(g+k)/2;d=(n+q)/2;c=(p+r)/2;var q=(q+e)/2,r=(r+g)/2,s=(d+q)/2,u=(c+r)/2;Ee(a,b,n,p,d,c,s,u,l,m);Ee(s,u,q,r,e,g,h,k,l,m)}}
function Fe(a,b,c,d,e,g,h,k,l,m){if(ue(a,b,h,k,l,c,d)&&ue(a,b,h,k,l,e,g))0===m.length&&(m.push(a),m.push(b)),m.push(h),m.push(k);else{var n=(a+c)/2,p=(b+d)/2,q=(c+e)/2,r=(d+g)/2;e=(e+h)/2;g=(g+k)/2;d=(n+q)/2;c=(p+r)/2;var q=(q+e)/2,r=(r+g)/2,s=(d+q)/2,u=(c+r)/2;Fe(a,b,n,p,d,c,s,u,l,m);Fe(s,u,q,r,e,g,h,k,l,m)}}
function Ge(a,b,c,d,e,g,h,k,l,m,n,p,q,r){var s=1-l;a=a*s+c*l;b=b*s+d*l;c=c*s+e*l;d=d*s+g*l;e=e*s+h*l;g=g*s+k*l;k=a*s+c*l;h=b*s+d*l;c=c*s+e*l;d=d*s+g*l;m.x=a;m.y=b;n.x=k;n.y=h;p.x=k*s+c*l;p.y=h*s+d*l;q.x=c;q.y=d;r.x=e;r.y=g}function He(a,b,c,d,e,g,h,k,l,m){if(ue(a,b,e,g,m,c,d))return ue(a,b,e,g,m,k,l);var n=(a+c)/2,p=(b+d)/2;c=(c+e)/2;d=(d+g)/2;var q=(n+c)/2,r=(p+d)/2;return He(a,b,n,p,q,r,h,k,l,m)||He(q,r,c,d,e,g,h,k,l,m)}
function Ie(a,b,c,d,e,g,h,k){if(ue(a,b,e,g,h,c,d))Ob(k,a,b,0,0),Ob(k,e,g,0,0);else{var l=(a+c)/2,m=(b+d)/2;c=(c+e)/2;d=(d+g)/2;var n=(l+c)/2,p=(m+d)/2;Ie(a,b,l,m,n,p,h,k);Ie(n,p,c,d,e,g,h,k)}}function Je(a,b,c,d,e,g,h,k){if(ue(a,b,e,g,h,c,d))0===k.length&&(k.push(a),k.push(b)),k.push(e),k.push(g);else{var l=(a+c)/2,m=(b+d)/2;c=(c+e)/2;d=(d+g)/2;var n=(l+c)/2,p=(m+d)/2;Je(a,b,l,m,n,p,h,k);Je(n,p,c,d,e,g,h,k)}}
function Ke(a,b,c,d,e,g,h,k,l,m,n,p,q,r){0>=q&&(q=1E-6);if(ue(a,b,h,k,q,c,d)&&ue(a,b,h,k,q,e,g)){var s=(a-h)*(m-p)-(b-k)*(l-n);if(0===s)return!1;q=((a*k-b*h)*(l-n)-(a-h)*(l*p-m*n))/s;s=((a*k-b*h)*(m-p)-(b-k)*(l*p-m*n))/s;if((l>n?l-n:n-l)<(m>p?m-p:p-m)){if(h=l=0,b<k?(l=b,h=k):(l=k,h=b),s<l||s>h)return!1}else if(a<h?l=a:(l=h,h=a),q<l||q>h)return!1;r.x=q;r.y=s;return!0}var s=(a+c)/2,u=(b+d)/2;c=(c+e)/2;d=(d+g)/2;e=(e+h)/2;g=(g+k)/2;var t=(s+c)/2,y=(u+d)/2;c=(c+e)/2;d=(d+g)/2;var w=(t+c)/2,C=(y+d)/2,
A=(n-l)*(n-l)+(p-m)*(p-m),N=!1;Ke(a,b,s,u,t,y,w,C,l,m,n,p,q,r)&&(b=(r.x-l)*(r.x-l)+(r.y-m)*(r.y-m),b<A&&(A=b,N=!0));a=r.x;s=r.y;Ke(w,C,c,d,e,g,h,k,l,m,n,p,q,r)&&(b=(r.x-l)*(r.x-l)+(r.y-m)*(r.y-m),b<A?N=!0:(r.x=a,r.y=s));return N}
function Le(a,b,c,d,e,g,h,k,l,m,n,p,q){var r=0;0>=q&&(q=1E-6);if(ue(a,b,h,k,q,c,d)&&ue(a,b,h,k,q,e,g)){q=(a-h)*(m-p)-(b-k)*(l-n);if(0===q)return r;var s=((a*k-b*h)*(l-n)-(a-h)*(l*p-m*n))/q,u=((a*k-b*h)*(m-p)-(b-k)*(l*p-m*n))/q;if(s>=n)return r;if((l>n?l-n:n-l)<(m>p?m-p:p-m)){if(a=l=0,b<k?(l=b,a=k):(l=k,a=b),u<l||u>a)return r}else if(a<h?(l=a,a=h):l=h,s<l||s>a)return r;0<q?r++:0>q&&r--}else{var s=(a+c)/2,u=(b+d)/2,t=(c+e)/2,y=(d+g)/2;e=(e+h)/2;g=(g+k)/2;d=(s+t)/2;c=(u+y)/2;var t=(t+e)/2,y=(y+g)/2,
w=(d+t)/2,C=(c+y)/2,r=r+Le(a,b,s,u,d,c,w,C,l,m,n,p,q),r=r+Le(w,C,t,y,e,g,h,k,l,m,n,p,q)}return r}
function fb(a,b,c,d,e,g,h){if(yb(a,c)){var k=0;c=0;b<d?(k=b,c=d):(k=d,c=b);d=g;if(d<k)return h.x=a,h.y=k,!1;if(d>c)return h.x=a,h.y=c,!1;h.x=a;h.y=d;return!0}if(yb(b,d)){a<c?k=a:(k=c,c=a);d=e;if(d<k)return h.x=k,h.y=b,!1;if(d>c)return h.x=c,h.y=b,!1;h.x=d;h.y=b;return!0}k=((a-e)*(a-c)+(b-g)*(b-d))/((c-a)*(c-a)+(d-b)*(d-b));if(-5E-6>k)return h.x=a,h.y=b,!1;if(1.000005<k)return h.x=c,h.y=d,!1;h.x=a+k*(c-a);h.y=b+k*(d-b);return!0}
function Me(a,b,c,d,e,g,h,k,l){if(Q(a,c)&&Q(b,d))return l.x=a,l.y=b,!1;if(yb(e,h)){if(yb(a,c))return fb(a,b,c,d,e,g,l),!1;g=(d-b)/(c-a)*(e-a)+b;return fb(a,b,c,d,e,g,l)}k=(k-g)/(h-e);if(yb(a,c)){g=k*(a-e)+g;c=h=0;b<d?(h=b,c=d):(h=d,c=b);if(g<h)return l.x=a,l.y=h,!1;if(g>c)return l.x=a,l.y=c,!1;l.x=a;l.y=g;return!0}h=(d-b)/(c-a);if(yb(k,h))return fb(a,b,c,d,e,g,l),!1;e=(h*a-k*e+g-b)/(h-k);if(yb(h,0)){a<c?h=a:(h=c,c=a);if(e<h)return l.x=h,l.y=b,!1;if(e>c)return l.x=c,l.y=b,!1;l.x=e;l.y=b;return!0}g=
h*(e-a)+b;return fb(a,b,c,d,e,g,l)}function Ne(a,b,c,d,e,g,h,k,l){var m=1E21,n=a,p=b;if(Me(a,b,a,d,e,g,h,k,l)){var q=(l.x-e)*(l.x-e)+(l.y-g)*(l.y-g);q<m&&(m=q,n=l.x,p=l.y)}Me(c,b,c,d,e,g,h,k,l)&&(q=(l.x-e)*(l.x-e)+(l.y-g)*(l.y-g),q<m&&(m=q,n=l.x,p=l.y));Me(a,b,c,b,e,g,h,k,l)&&(q=(l.x-e)*(l.x-e)+(l.y-g)*(l.y-g),q<m&&(m=q,n=l.x,p=l.y));Me(a,d,c,d,e,g,h,k,l)&&(q=(l.x-e)*(l.x-e)+(l.y-g)*(l.y-g),q<m&&(m=q,n=l.x,p=l.y));l.x=n;l.y=p;return 1E21>m}
function Ue(a,b,c,d,e,g,h,k,l){c=a-c;var m=e-h,n=h=0;0===c||0===m?0===c?(k=(g-k)/m,h=a,n=k*h+(g-k*e)):(d=(b-d)/c,h=e,n=d*h+(b-d*a)):(d=(b-d)/c,k=(g-k)/m,a=b-d*a,h=(g-k*e-a)/(d-k),n=d*h+a);l.m(h,n);return l}
function Ve(a,b,c){var d=b.x,e=b.y,g=c.x,h=c.y,k=a.left,l=a.right,m=a.top,n=a.bottom;return d===g?(g=a=0,e<h?(a=e,g=h):(a=h,g=e),k<=d&&d<=l&&a<=n&&g>=m):e===h?(d<g?a=d:(a=g,g=d),m<=e&&e<=n&&a<=l&&g>=k):a.Oa(b)||a.Oa(c)||We(k,m,l,m,d,e,g,h)||We(l,m,l,n,d,e,g,h)||We(l,n,k,n,d,e,g,h)||We(k,n,k,m,d,e,g,h)?!0:!1}function We(a,b,c,d,e,g,h,k){return 0>=Xe(a,b,c,d,e,g)*Xe(a,b,c,d,h,k)&&0>=Xe(e,g,h,k,a,b)*Xe(e,g,h,k,c,d)}
function Xe(a,b,c,d,e,g){c-=a;d-=b;a=e-a;b=g-b;g=a*d-b*c;0===g&&(g=a*c+b*d,0<g&&(g=(a-c)*c+(b-d)*d,0>g&&(g=0)));return 0>g?-1:0<g?1:0}function Ye(a){0>a&&(a+=360);360<=a&&(a-=360);return a}
function Ze(a,b,c,d){var e=Math.PI;d||(b*=e/180,c*=e/180);d=b<c?1:-1;var g=[],h=e/2,k=b;for(b=Math.min(2*e,Math.abs(c-b));1E-5<b;){c=k+d*Math.min(b,h);var e=(c-k)/2,l=a*Math.cos(e),m=a*Math.sin(e),n=-m,p=l*l+n*n,q=p+l*l+n*m,p=4/3*(Math.sqrt(2*p*q)-q)/(l*m-n*l),m=l-p*n,l=n+p*l,n=-l,p=e+k,e=Math.cos(p),p=Math.sin(p);g.push([0+a*Math.cos(k),0+a*Math.sin(k),0+m*e-l*p,0+m*p+l*e,0+m*e-n*p,0+m*p+n*e,0+a*Math.cos(c),0+a*Math.sin(c)]);b-=Math.abs(c-k);k=c}return g}
function gb(a,b,c,d,e,g,h){c=Math.floor((a-c)/e)*e+c;d=Math.floor((b-d)/g)*g+d;var k=c;c+e-a<e/2&&(k=c+e);a=d;d+g-b<g/2&&(a=d+g);h.m(k,a)}function $e(a,b){var c=Math.max(a,b),d=Math.min(a,b),e=1,g=1;do e=c%d,c=g=d,d=e;while(0<e);return g}
function af(a,b,c,d){var e=0>c,g=0>d,h=0,k=h=0;a<b?(h=1,k=0):(h=0,k=1);var l=0,m=0,n=0,p=0,l=0===h?a:b,n=0===h?c:d;if(0===h?e:g)n=-n;h=k;m=0===h?a:b;p=0===h?c:d;if(0===h?e:g)p=-p;a=a=0;if(0<p)if(0<n){b=l*l;a=m*m;l*=n;c=m*p;d=-a+c;e=-a+Math.sqrt(l*l+c*c);m=d;for(g=0;9999999999>g;++g){m=.5*(d+e);if(m===d||m===e)break;k=l/(m+b);h=c/(m+a);k=k*k+h*h-1;if(0<k)d=m;else if(0>k)e=m;else break}n=b*n/(m+b)-n;p=a*p/(m+a)-p;a=Math.sqrt(n*n+p*p)}else a=Math.abs(p-m);else p=l*l-m*m,a=l*n,a<p?(p=a/p,a=m*Math.sqrt(Math.abs(1-
p*p)),n=l*p-n,a=Math.sqrt(n*n+a*a)):a=Math.abs(n-l);return a}function bf(a){1<arguments.length&&D.k("Geometry constructor can take at most one optional argument, the Geometry type.");D.tc(this);this.J=!1;void 0===a?a=cf:v&&D.Ca(a,bf,bf,"constructor:type");this.ca=a;this.Ib=this.Ab=this.Gc=this.wc=0;this.fk=new K(df);this.Sv=this.fk.G;this.Cv=(new B).freeze();this.lb=!0;this.er=this.Fo=null;this.fr=NaN;this.ui=cc;this.vi=rc;this.kp=this.mp=NaN;this.Vi=rf}D.ja("Geometry",bf);D.Ai(bf);
bf.prototype.copy=function(){var a=new bf;a.ca=this.ca;a.wc=this.wc;a.Gc=this.Gc;a.Ab=this.Ab;a.Ib=this.Ib;for(var b=this.fk.o,c=b.length,d=a.fk,e=0;e<c;e++){var g=b[e].copy();d.add(g)}a.Sv=this.Sv;a.Cv.assign(this.Cv);a.lb=this.lb;a.Fo=this.Fo;a.er=this.er;a.fr=this.fr;a.ui=this.ui.V();a.vi=this.vi.V();a.mp=this.mp;a.kp=this.kp;a.Vi=this.Vi;return a};var sf;bf.Line=sf=D.s(bf,"Line",0);var tf;bf.Rectangle=tf=D.s(bf,"Rectangle",1);var uf;bf.Ellipse=uf=D.s(bf,"Ellipse",2);var cf;
bf.Path=cf=D.s(bf,"Path",3);bf.prototype.Na=function(){this.freeze();Object.freeze(this);return this};bf.prototype.freeze=function(){this.J=!0;var a=this.kc;a.freeze();for(var a=a.o,b=a.length,c=0;c<b;c++)a[c].freeze();return this};bf.prototype.Ya=function(){Object.isFrozen(this)&&D.k("cannot thaw constant: "+this);this.J=!1;var a=this.kc;a.Ya();for(var a=a.o,b=a.length,c=0;c<b;c++)a[c].Ya();return this};
bf.prototype.equalsApprox=bf.prototype.Sc=function(a){if(!(a instanceof bf))return!1;if(this.type!==a.type)return this.type===sf&&a.type===cf?vf(this,a):a.type===sf&&this.type===cf?vf(a,this):!1;if(this.type===cf){var b=this.kc.o;a=a.kc.o;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Sc(a[d]))return!1;return!0}return Q(this.ma,a.ma)&&Q(this.ka,a.ka)&&Q(this.H,a.H)&&Q(this.I,a.I)};
function vf(a,b){if(a.type!==sf||b.type!==cf)return!1;if(1===b.kc.count){var c=b.kc.ea(0);if(1===c.Db.count&&Q(a.ma,c.ma)&&Q(a.ka,c.ka)&&(c=c.Db.ea(0),c.type===wf&&Q(a.H,c.H)&&Q(a.I,c.I)))return!0}return!1}var xf;bf.stringify=xf=function(a){return a.toString()};bf.prototype.nc=function(a){a.Ne===bf?this.type=a:D.Xj(this,a)};
bf.prototype.toString=function(a){void 0===a&&(a=-1);switch(this.type){case sf:return 0>a?"M"+this.ma.toString()+" "+this.ka.toString()+"L"+this.H.toString()+" "+this.I.toString():"M"+this.ma.toFixed(a)+" "+this.ka.toFixed(a)+"L"+this.H.toFixed(a)+" "+this.I.toFixed(a);case tf:var b=new B(this.ma,this.ka,0,0);b.gH(this.H,this.I,0,0);return 0>a?"M"+b.x.toString()+" "+b.y.toString()+"H"+b.right.toString()+"V"+b.bottom.toString()+"H"+b.left.toString()+"z":"M"+b.x.toFixed(a)+" "+b.y.toFixed(a)+"H"+b.right.toFixed(a)+
"V"+b.bottom.toFixed(a)+"H"+b.left.toFixed(a)+"z";case uf:b=new B(this.ma,this.ka,0,0);b.gH(this.H,this.I,0,0);if(0>a){var c=b.left.toString()+" "+(b.y+b.height/2).toString(),d=b.right.toString()+" "+(b.y+b.height/2).toString();return"M"+c+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+d+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+c}c=b.left.toFixed(a)+" "+(b.y+b.height/2).toFixed(a);d=b.right.toFixed(a)+" "+(b.y+b.height/2).toFixed(a);return"M"+c+"A"+(b.width/
2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+d+"A"+(b.width/2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+c;case cf:for(var b="",c=this.kc.o,d=c.length,e=0;e<d;e++){var g=c[e];0<e&&(b+=" x ");g.wu&&(b+="F ");b+=g.toString(a)}return b;default:return this.type.toString()}};
bf.fillPath=function(a){"string"!==typeof a&&D.gc(a,"string",bf,"fillPath:str");a=a.split(/[Xx]/);for(var b=a.length,c="",d=0;d<b;d++)var e=a[d],c=null!==e.match(/[Ff]/)?0===d?c+e:c+("X"+(" "===e[0]?"":" ")+e):c+((0===d?"":"X ")+"F"+(" "===e[0]?"":" ")+e);return c};var yf;
bf.parse=yf=function(a,b){function c(){return m>=u-1?!0:null!==l[m+1].match(/[A-Za-z]/)}function d(){m++;return l[m]}function e(){var a=new O(parseFloat(d()),parseFloat(d()));n===n.toLowerCase()&&(a.x=s.x+a.x,a.y=s.y+a.y);return a}function g(){return s=e()}function h(){return r=e()}function k(){return"c"!==p.toLowerCase()&&"s"!==p.toLowerCase()?s:new O(2*s.x-r.x,2*s.y-r.y)}void 0===b&&(b=!1);"string"!==typeof a&&D.gc(a,"string",bf,"parse:str");a=a.replace(/,/gm," ");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFf])([UuBbMmZzLlHhVvCcSsQqTtAaFf])/gm,
"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFf])([UuBbMmZzLlHhVvCcSsQqTtAaFf])/gm,"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFf])([^\s])/gm,"$1 $2");a=a.replace(/([^\s])([UuBbMmZzLlHhVvCcSsQqTtAaFf])/gm,"$1 $2");a=a.replace(/([0-9])([+\-])/gm,"$1 $2");a=a.replace(/(\.[0-9]*)(\.)/gm,"$1 $2");a=a.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm,"$1 $3 $4 ");a=a.replace(/[\s\r\t\n]+/gm," ");a=a.replace(/^\s+|\s+$/g,"");for(var l=a.split(" "),m=-1,n="",p="",q=new O(0,0),r=new O(0,0),s=new O(0,
0),u=l.length,t=D.v(),y=!1,w=!1,C=!0,A=null;!(m>=u-1);)if(p=n,n=d(),""!==n)switch(n.toUpperCase()){case "X":C=!0;w=y=!1;break;case "M":A=g();null===t.cc||!0===C?(T(t,A.x,A.y,y,!1,!w),C=!1):t.moveTo(A.x,A.y);for(q=s;!c();)A=g(),t.lineTo(A.x,A.y);break;case "L":for(;!c();)A=g(),t.lineTo(A.x,A.y);break;case "H":for(;!c();)s=A=new O((n===n.toLowerCase()?s.x:0)+parseFloat(d()),s.y),t.lineTo(s.x,s.y);break;case "V":for(;!c();)s=A=new O(s.x,(n===n.toLowerCase()?s.y:0)+parseFloat(d())),t.lineTo(s.x,s.y);
break;case "C":for(;!c();){var N=e(),H=h(),A=g();V(t,N.x,N.y,H.x,H.y,A.x,A.y)}break;case "S":for(;!c();)N=k(),H=h(),A=g(),V(t,N.x,N.y,H.x,H.y,A.x,A.y);break;case "Q":for(;!c();)H=h(),A=g(),zf(t,H.x,H.y,A.x,A.y);break;case "T":for(;!c();)r=H=k(),A=g(),zf(t,H.x,H.y,A.x,A.y);break;case "B":for(;!c();){var A=parseFloat(d()),N=parseFloat(d()),H=parseFloat(d()),W=parseFloat(d()),fa=parseFloat(d()),S=fa,ba=!1;c()||(S=parseFloat(d()),c()||(ba=0!==parseFloat(d())));n===n.toLowerCase()&&(H+=s.x,W+=s.y);t.arcTo(A,
N,H,W,fa,S,ba)}break;case "A":for(;!c();)N=Math.abs(parseFloat(d())),H=Math.abs(parseFloat(d())),W=parseFloat(d()),fa=!!parseFloat(d()),S=!!parseFloat(d()),A=g(),Af(t,N,H,W,fa,S,A.x,A.y);break;case "Z":A=t.q.kc.o[t.q.kc.length-1];X(t);s=q;break;case "F":A="";for(N=1;l[m+N];)if(null!==l[m+N].match(/[Uu]/))N++;else if(null===l[m+N].match(/[A-Za-z]/))N++;else{A=l[m+N];break}A.match(/[Mm]/)?y=!0:Bf(t);break;case "U":A="";for(N=1;l[m+N];)if(null!==l[m+N].match(/[Ff]/))N++;else if(null===l[m+N].match(/[A-Za-z]/))N++;
else{A=l[m+N];break}A.match(/[Mm]/)?w=!0:t.ib(!1)}q=t.q;D.u(t);if(b)for(t=q.kc.j;t.next();)A=t.value,A.wu=!0;return q};function Cf(a,b){for(var c=a.length,d=D.P(),e=0;e<c;e++){var g=a[e];d.x=g[0];d.y=g[1];b.vb(d);g[0]=d.x;g[1]=d.y;d.x=g[2];d.y=g[3];b.vb(d);g[2]=d.x;g[3]=d.y;d.x=g[4];d.y=g[5];b.vb(d);g[4]=d.x;g[5]=d.y;d.x=g[6];d.y=g[7];b.vb(d);g[6]=d.x;g[7]=d.y}D.A(d)}
bf.prototype.Vx=function(){if(this.lb||this.Sv!==this.kc.G)return!0;for(var a=this.kc.o,b=a.length,c=0;c<b;c++)if(a[c].Vx())return!0;return!1};bf.prototype.Ly=function(){this.lb=!1;this.er=this.Fo=null;this.fr=NaN;this.Sv=this.kc.G;for(var a=this.kc.o,b=a.length,c=0;c<b;c++)a[c].Ly()};bf.prototype.Kh=function(){var a=this.Cv;a.Ya();isNaN(this.mp)||isNaN(this.kp)?a.m(0,0,0,0):a.m(0,0,this.mp,this.kp);Df(this,a,!1);Ob(a,0,0,0,0);a.freeze()};
bf.prototype.computeBoundsWithoutOrigin=bf.prototype.dI=function(){var a=new B;Df(this,a,!0);return a};
function Df(a,b,c){switch(a.type){case sf:case tf:case uf:c?b.m(a.wc,a.Gc,0,0):Ob(b,a.wc,a.Gc,0,0);Ob(b,a.Ab,a.Ib,0,0);break;case cf:var d=a.kc;a=d.o;for(var d=d.length,e=0;e<d;e++){var g=a[e];c&&0===e?b.m(g.ma,g.ka,0,0):Ob(b,g.ma,g.ka,0,0);for(var h=g.Db.o,k=h.length,l=g.ma,m=g.ka,n=0;n<k;n++){var p=h[n];switch(p.type){case wf:case Ef:l=p.H;m=p.I;Ob(b,l,m,0,0);break;case Of:Ee(l,m,p.Ac,p.Wc,p.Rh,p.Sh,p.H,p.I,.5,b);l=p.H;m=p.I;break;case Pf:Ie(l,m,p.Ac,p.Wc,p.H,p.I,.5,b);l=p.H;m=p.I;break;case Qf:case Rf:var q=
p.type===Qf?Sf(p,g):Tf(p,g,l,m),r=q.length;if(0===r){l=p.na;m=p.va;Ob(b,l,m,0,0);break}for(var p=null,s=0;s<r;s++)p=q[s],Ee(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],.5,b);null!==p&&(l=p[6],m=p[7]);break;default:D.k("Unknown Segment type: "+p.type)}}}break;default:D.k("Unknown Geometry type: "+a.type)}}bf.prototype.normalize=bf.prototype.normalize=function(){this.J&&D.pa(this);var a=this.dI();this.offset(-a.x,-a.y);return new O(-a.x,-a.y)};
bf.prototype.offset=bf.prototype.offset=function(a,b){this.J&&D.pa(this);v&&(D.p(a,bf,"offset"),D.p(b,bf,"offset"));this.transform(1,0,0,1,a,b);return this};bf.prototype.scale=bf.prototype.scale=function(a,b){this.J&&D.pa(this);v&&(D.p(a,bf,"scale:x"),D.p(b,bf,"scale:y"),0===a&&D.ua(a,"scale must be non-zero",bf,"scale:x"),0===b&&D.ua(b,"scale must be non-zero",bf,"scale:y"));this.transform(a,0,0,b,0,0);return this};
bf.prototype.rotate=bf.prototype.rotate=function(a,b,c){this.J&&D.pa(this);void 0===b&&(b=0);void 0===c&&(c=0);v&&(D.p(a,bf,"rotate:angle"),D.p(b,bf,"rotate:x"),D.p(c,bf,"rotate:y"));var d=D.Of();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);D.He(d);return this};
bf.prototype.transform=bf.prototype.transform=function(a,b,c,d,e,g){var h=0,k=0;switch(this.type){case sf:case tf:case uf:h=this.wc;k=this.Gc;this.wc=h*a+k*c+e;this.Gc=h*b+k*d+g;h=this.Ab;k=this.Ib;this.Ab=h*a+k*c+e;this.Ib=h*b+k*d+g;break;case cf:for(var l=this.kc.o,m=l.length,n=0;n<m;n++){var p=l[n],h=p.ma,k=p.ka;p.ma=h*a+k*c+e;p.ka=h*b+k*d+g;for(var p=p.Db.o,q=p.length,r=0;r<q;r++){var s=p[r];switch(s.type){case wf:case Ef:h=s.H;k=s.I;s.H=h*a+k*c+e;s.I=h*b+k*d+g;break;case Of:h=s.Ac;k=s.Wc;s.Ac=
h*a+k*c+e;s.Wc=h*b+k*d+g;h=s.Rh;k=s.Sh;s.Rh=h*a+k*c+e;s.Sh=h*b+k*d+g;h=s.H;k=s.I;s.H=h*a+k*c+e;s.I=h*b+k*d+g;break;case Pf:h=s.Ac;k=s.Wc;s.Ac=h*a+k*c+e;s.Wc=h*b+k*d+g;h=s.H;k=s.I;s.H=h*a+k*c+e;s.I=h*b+k*d+g;break;case Qf:h=s.na;k=s.va;s.na=h*a+k*c+e;s.va=h*b+k*d+g;0!==b&&(h=180*Math.atan2(b,a)/Math.PI,0>h&&(h+=360),s.Le+=h);0>a&&(s.Le=180-s.Le,s.xf=-s.xf);0>d&&(s.Le=-s.Le,s.xf=-s.xf);s.radiusX*=Math.sqrt(a*a+c*c);void 0!==s.radiusY&&(s.radiusY*=Math.sqrt(b*b+d*d));break;case Rf:h=s.H;k=s.I;s.H=h*
a+k*c+e;s.I=h*b+k*d+g;0!==b&&(h=180*Math.atan2(b,a)/Math.PI,0>h&&(h+=360),s.Zj+=h);0>a&&(s.Zj=180-s.Zj,s.sm=!s.sm);0>d&&(s.Zj=-s.Zj,s.sm=!s.sm);s.radiusX*=Math.sqrt(a*a+c*c);s.radiusY*=Math.sqrt(b*b+d*d);break;default:D.k("Unknown Segment type: "+s.type)}}}}this.lb=!0;return this};
bf.prototype.Oa=function(a,b,c,d){var e=a.x,g=a.y,h=this.sb.x-20;a=a.y;for(var k=0,l=0,m=0,n=0,p=0,q=0,r=this.kc.o,s=r.length,u=0;u<s;u++){var t=r[u];if(t.wu){if(c&&t.Oa(e,g,b))return!0;for(var y=t.Db,l=t.ma,m=t.ka,w=l,C=m,A=y.o,N=0;N<=y.length;N++){var H,W;N!==y.length?(H=A[N],W=H.type,p=H.H,q=H.I):(W=wf,p=w,q=C);switch(W){case Ef:n=Uf(e,g,h,a,l,m,w,C);if(isNaN(n))return!0;k+=n;w=p;C=q;break;case wf:n=Uf(e,g,h,a,l,m,p,q);if(isNaN(n))return!0;k+=n;break;case Of:n=Le(l,m,H.Ac,H.Wc,H.Rh,H.Sh,p,q,h,
a,e,g,.5);k+=n;break;case Pf:n=Le(l,m,(l+2*H.Ac)/3,(m+2*H.Wc)/3,(2*H.Ac+p)/3,(2*H.Wc+q)/3,p,q,h,a,e,g,.5);k+=n;break;case Qf:case Rf:W=H.type===Qf?Sf(H,t):Tf(H,t,l,m);var fa=W.length;if(0===fa){n=Uf(e,g,h,a,l,m,H.na,H.va);if(isNaN(n))return!0;k+=n;break}for(var S=null,ba=0;ba<fa;ba++){S=W[ba];if(0===ba){n=Uf(e,g,h,a,l,m,S[0],S[1]);if(isNaN(n))return!0;k+=n}n=Le(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],h,a,e,g,.5);k+=n}null!==S&&(p=S[6],q=S[7]);break;default:D.k("Unknown Segment type: "+H.type)}l=p;
m=q}if(0!==k)return!0;k=0}else if(t.Oa(e,g,d?b:b+2))return!0}return 0!==k};function Uf(a,b,c,d,e,g,h,k){if(ue(e,g,h,k,.05,a,b))return NaN;var l=(a-c)*(g-k);if(0===l)return 0;var m=((a*d-b*c)*(e-h)-(a-c)*(e*k-g*h))/l;b=(a*d-b*c)*(g-k)/l;if(m>=a)return 0;if((e>h?e-h:h-e)<(g>k?g-k:k-g)){if(e=a=0,g<k?(a=g,e=k):(a=k,e=g),b<a||b>e)return 0}else if(e<h?(a=e,e=h):a=h,m<a||m>e)return 0;return 0<l?1:-1}function Vf(a,b,c,d){a=a.kc.o;for(var e=a.length,g=0;g<e;g++)if(a[g].Oa(b,c,d))return!0;return!1}
bf.prototype.getPointAlongPath=bf.prototype.NI=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new O);if(this.type===sf)return b.m(this.ma+a*(this.H-this.ma),this.ka+a*(this.I-this.ka)),b;for(var c=this.JA,d=this.Kx,e=c.length,g=this.KA*a,h=0,k=0;k<e;k++)for(var l=d[k],m=l.length,n=0;n<m;n++){var p=l[n];if(h+p>=g)return d=(g-h)/p,c=c[k],k=c[2*n],e=c[2*n+1],b.m(k+(c[2*n+2]-k)*d,e+(c[2*n+3]-e)*d),b;h+=p}b.m(NaN,NaN);return b};
bf.prototype.getFractionForPoint=bf.prototype.JI=function(a){if(this.type===sf){var b=this.ma,c=this.ka,d=this.H,e=this.I;if(b!==d||c!==e){var g=a.x;a=a.y;var h=0,k=0;return b===d?(c<e?(h=c,k=e):(h=e,k=c),a<=h?h===c?0:1:a>=k?k===c?0:1:Math.abs(a-c)/(k-h)):c===e?(b<d?(h=b,k=d):(h=d,k=b),g<=h?h===b?0:1:g>=k?k===b?0:1:Math.abs(g-b)/(k-h)):((g-b)*(g-b)+(a-c)*(a-c))/((d-b)*(d-b)+(e-c)*(e-c))}}else if(this.type===tf){if(b=this.ma,c=this.ka,d=this.H,e=this.I,b!==d||c!==e){var h=d-b,k=e-c,l=2*h+2*k,g=a.x;
a=a.y;g=Math.min(Math.max(g,b),d);a=Math.min(Math.max(a,c),e);var b=Math.abs(g-b),d=Math.abs(g-d),c=Math.abs(a-c),e=Math.abs(a-e),m=Math.min(b,d,c,e);if(m===c)return g/l;if(m===d)return(h+a)/l;if(m===e)return(2*h+k-g)/l;if(m===b)return(2*h+2*k-a)/l}}else{for(var e=this.JA,h=this.Kx,k=this.KA,l=D.P(),c=Infinity,b=d=0,g=e.length,n=m=0,p=0;p<g;p++)for(var q=e[p],r=h[p],s=q.length,u=0;u<s;u+=2){var t=q[u],y=q[u+1];if(0!==u){fb(m,n,t,y,a.x,a.y,l);var w=(l.x-a.x)*(l.x-a.x)+(l.y-a.y)*(l.y-a.y);w<c&&(c=w,
d=b,d+=Math.sqrt((l.x-m)*(l.x-m)+(l.y-n)*(l.y-n)));b+=r[(u-2)/2]}m=t;n=y}D.A(l);a=d/k;return 0>a?0:1<a?1:a}return 0};D.w(bf,{JA:null},function(){Wf(this);return this.Fo});
function Wf(a){if(null===a.Fo){a.Vx()&&a.Ly();var b=a.Fo=[],c=a.er=[],d=[],e=[];if(a.type===sf)d.push(a.ma),d.push(a.ka),d.push(a.H),d.push(a.I),b.push(d),e.push(Math.sqrt((a.ma-a.H)*(a.ma-a.H)+(a.ka-a.I)*(a.ka-a.I))),c.push(e);else if(a.type===tf)d.push(a.ma),d.push(a.ka),d.push(a.H),d.push(a.ka),d.push(a.H),d.push(a.I),d.push(a.ma),d.push(a.I),d.push(a.ma),d.push(a.ka),b.push(d),e.push(Math.abs(a.ma-a.H)),e.push(Math.abs(a.ka-a.I)),e.push(Math.abs(a.ma-a.H)),e.push(Math.abs(a.ka-a.I)),c.push(e);
else if(a.type===uf){var g=new df;g.ma=a.H;g.ka=(a.ka+a.I)/2;var h=new Xf(Qf);h.Le=0;h.xf=360;h.na=(a.ma+a.H)/2;h.va=(a.ka+a.I)/2;h.radiusX=Math.abs(a.ma-a.H)/2;h.radiusY=Math.abs(a.ka-a.I)/2;g.add(h);a=Sf(h,g);e=a.length;if(0===e)d.push(h.na),d.push(h.va);else for(var h=g.ma,g=g.ka,k=0;k<e;k++){var l=a[k];Fe(h,g,l[2],l[3],l[4],l[5],l[6],l[7],.5,d);h=l[6];g=l[7]}b.push(d);c.push(Yf(d))}else for(var m=a.kc.j;m.next();){var n=m.value,d=[];d.push(n.ma);d.push(n.ka);for(var h=n.ma,g=n.ka,p=h,q=g,r=n.Db.o,
s=r.length,u=0;u<s;u++){var t=r[u];switch(t.ca){case Ef:4<=d.length&&(b.push(d),c.push(Yf(d)));d=[];d.push(t.H);d.push(t.I);h=t.H;g=t.I;p=h;q=g;break;case wf:d.push(t.H);d.push(t.I);h=t.H;g=t.I;break;case Of:Fe(h,g,t.Pd,t.df,t.Ch,t.Kg,t.Ab,t.Ib,.5,d);h=t.H;g=t.I;break;case Pf:Je(h,g,t.Pd,t.df,t.Ab,t.Ib,.5,d);h=t.H;g=t.I;break;case Qf:a=Sf(t,n);e=a.length;if(0===e){d.push(t.na);d.push(t.va);h=t.na;g=t.va;break}for(k=0;k<e;k++)l=a[k],Fe(h,g,l[2],l[3],l[4],l[5],l[6],l[7],.5,d),h=l[6],g=l[7];break;case Rf:a=
Tf(t,n,h,g);e=a.length;if(0===e){d.push(t.na);d.push(t.va);h=t.na;g=t.va;break}for(k=0;k<e;k++)l=a[k],Fe(h,g,l[2],l[3],l[4],l[5],l[6],l[7],.5,d),h=l[6],g=l[7];break;default:D.k("Segment not of valid type: "+t.ca)}t.ei&&(d.push(p),d.push(q))}4<=d.length&&(b.push(d),c.push(Yf(d)))}}}D.w(bf,{Kx:null},function(){Wf(this);return this.er});
D.w(bf,{KA:null},function(){var a=this.fr;if(isNaN(a)){if(this.type===sf)var a=Math.abs(this.H-this.ma),b=Math.abs(this.I-this.ka),a=Math.sqrt(a*a+b*b);else if(this.type===tf)a=Math.abs(this.H-this.ma),b=Math.abs(this.I-this.ka),a=2*a+2*b;else for(var b=this.Kx,c=b.length,d=a=0;d<c;d++)for(var e=b[d],g=e.length,h=0;h<g;h++)a+=e[h];this.fr=a}return a});function Yf(a){for(var b=[],c=0,d=0,e=a.length,g=0;g<e;g+=2){var h=a[g],k=a[g+1];0!==g&&(c=Math.sqrt(kb(c,d,h,k)),b.push(c));c=h;d=k}return b}
D.defineProperty(bf,{type:"type"},function(){return this.ca},function(a){this.ca!==a&&(v&&D.Ca(a,bf,bf,"type"),this.J&&D.pa(this,a),this.ca=a,this.lb=!0)});D.defineProperty(bf,{ma:"startX"},function(){return this.wc},function(a){this.wc!==a&&(v&&D.p(a,bf,"startX"),this.J&&D.pa(this,a),this.wc=a,this.lb=!0)});D.defineProperty(bf,{ka:"startY"},function(){return this.Gc},function(a){this.Gc!==a&&(v&&D.p(a,bf,"startY"),this.J&&D.pa(this,a),this.Gc=a,this.lb=!0)});
D.defineProperty(bf,{H:"endX"},function(){return this.Ab},function(a){this.Ab!==a&&(v&&D.p(a,bf,"endX"),this.J&&D.pa(this,a),this.Ab=a,this.lb=!0)});D.defineProperty(bf,{I:"endY"},function(){return this.Ib},function(a){this.Ib!==a&&(v&&D.p(a,bf,"endY"),this.J&&D.pa(this,a),this.Ib=a,this.lb=!0)});D.defineProperty(bf,{kc:"figures"},function(){return this.fk},function(a){this.fk!==a&&(v&&D.l(a,K,bf,"figures"),this.J&&D.pa(this,a),this.fk=a,this.lb=!0)});
bf.prototype.add=bf.prototype.add=function(a){this.fk.add(a);return this};bf.prototype.setSpots=function(a,b,c,d,e,g,h,k){this.J&&D.pa(this);this.ui=(new R(a,b,e,g)).freeze();this.vi=(new R(c,d,h,k)).freeze();return this};D.defineProperty(bf,{C:"spot1"},function(){return this.ui},function(a){v&&D.l(a,R,bf,"spot1");this.J&&D.pa(this,a);this.ui=a.V()});D.defineProperty(bf,{D:"spot2"},function(){return this.vi},function(a){v&&D.l(a,R,bf,"spot2");this.J&&D.pa(this,a);this.vi=a.V()});
D.defineProperty(bf,{je:"defaultStretch"},function(){return this.Vi},function(a){v&&D.Ca(a,P,bf,"stretch");this.J&&D.pa(this,a);this.Vi=a});D.w(bf,{sb:"bounds"},function(){this.Vx()&&(this.Ly(),this.Kh());return this.Cv});function df(a,b,c,d){D.tc(this);this.J=!1;void 0===c&&(c=!0);this.Tm=c;void 0===d&&(d=!0);this.np=d;void 0!==a?(v&&D.p(a,df,"sx"),this.wc=a):this.wc=0;void 0!==b?(v&&D.p(b,df,"sy"),this.Gc=b):this.Gc=0;this.Kp=new K(Xf);this.Rw=this.Kp.G;this.lb=!0}D.ja("PathFigure",df);D.Ai(df);
df.prototype.copy=function(){var a=new df;a.Tm=this.Tm;a.np=this.np;a.wc=this.wc;a.Gc=this.Gc;for(var b=this.Kp.o,c=b.length,d=a.Kp,e=0;e<c;e++){var g=b[e].copy();d.add(g)}a.Rw=this.Rw;a.lb=this.lb;return a};df.prototype.equalsApprox=df.prototype.Sc=function(a){if(!(a instanceof df&&Q(this.ma,a.ma)&&Q(this.ka,a.ka)))return!1;var b=this.Db.o;a=a.Db.o;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Sc(a[d]))return!1;return!0};f=df.prototype;
f.toString=function(a){void 0===a&&(a=-1);for(var b=0>a?"M"+this.ma.toString()+" "+this.ka.toString():"M"+this.ma.toFixed(a)+" "+this.ka.toFixed(a),c=this.Db.o,d=c.length,e=0;e<d;e++)b+=" "+c[e].toString(a);return b};f.freeze=function(){this.J=!0;var a=this.Db;a.freeze();for(var b=a.o,a=a.length,c=0;c<a;c++)b[c].freeze();return this};f.Ya=function(){this.J=!1;var a=this.Db;a.Ya();for(var a=a.o,b=a.length,c=0;c<b;c++)a[c].Ya();return this};
f.Vx=function(){if(this.lb)return!0;var a=this.Db;if(this.Rw!==a.G)return!0;for(var a=a.o,b=a.length,c=0;c<b;c++)if(a[c].lb)return!0;return!1};f.Ly=function(){this.lb=!1;var a=this.Db;this.Rw=a.G;for(var a=a.o,b=a.length,c=0;c<b;c++){var d=a[c];d.lb=!1;d.tg=null}};D.defineProperty(df,{wu:"isFilled"},function(){return this.Tm},function(a){v&&D.h(a,"boolean",df,"isFilled");this.J&&D.pa(this,a);this.Tm=a});
D.defineProperty(df,{Wk:"isShadowed"},function(){return this.np},function(a){v&&D.h(a,"boolean",df,"isShadowed");this.J&&D.pa(this,a);this.np=a});D.defineProperty(df,{ma:"startX"},function(){return this.wc},function(a){v&&D.p(a,df,"startX");this.J&&D.pa(this,a);this.wc=a;this.lb=!0});D.defineProperty(df,{ka:"startY"},function(){return this.Gc},function(a){v&&D.p(a,df,"startY");this.J&&D.pa(this,a);this.Gc=a;this.lb=!0});
D.defineProperty(df,{Db:"segments"},function(){return this.Kp},function(a){v&&D.l(a,K,df,"segments");this.J&&D.pa(this,a);this.Kp=a;this.lb=!0});df.prototype.add=df.prototype.add=function(a){this.Kp.add(a);return this};
df.prototype.Oa=function(a,b,c){for(var d=this.ma,e=this.ka,g=d,h=e,k=this.Db.o,l=k.length,m=0;m<l;m++){var n=k[m];switch(n.type){case Ef:g=n.H;h=n.I;d=n.H;e=n.I;break;case wf:if(ue(d,e,n.H,n.I,c,a,b))return!0;d=n.H;e=n.I;break;case Of:if(De(d,e,n.Ac,n.Wc,n.Rh,n.Sh,n.H,n.I,.5,a,b,c))return!0;d=n.H;e=n.I;break;case Pf:if(He(d,e,n.Ac,n.Wc,n.H,n.I,.5,a,b,c))return!0;d=n.H;e=n.I;break;case Qf:case Rf:var p=n.type===Qf?Sf(n,this):Tf(n,this,d,e),q=p.length;if(0===q){if(ue(d,e,n.na,n.va,c,a,b))return!0;
d=n.na;e=n.va;break}for(var r=null,s=0;s<q;s++)if(r=p[s],0===s&&ue(d,e,r[0],r[1],c,a,b)||De(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],.5,a,b,c))return!0;null!==r&&(d=r[6],e=r[7]);break;default:D.k("Unknown Segment type: "+n.type)}if(n.Rx&&(d!==g||e!==h)&&ue(d,e,g,h,c,a,b))return!0}return!1};
function Xf(a,b,c,d,e,g,h,k){D.tc(this);this.J=!1;void 0===a?a=wf:v&&D.Ca(a,Xf,Xf,"constructor:type");this.ca=a;void 0!==b?(v&&D.p(b,Xf,"ex"),this.Ab=b):this.Ab=0;void 0!==c?(v&&D.p(c,Xf,"ey"),this.Ib=c):this.Ib=0;void 0===d&&(d=0);void 0===e&&(e=0);void 0===g&&(g=0);void 0===h&&(h=0);a===Rf?(a=g%360,0>a&&(a+=360),this.Pd=a,this.df=0,v&&D.p(d,Xf,"x1"),this.Ch=Math.max(d,0),v&&D.p(e,Xf,"y1"),this.Kg=Math.max(e,0),this.sp="boolean"===typeof h?!!h:!1,this.Ko=!!k):(v&&D.p(d,Xf,"x1"),this.Pd=d,v&&D.p(e,
Xf,"y1"),this.df=e,v&&D.p(g,Xf,"x2"),a===Qf&&(g=Math.max(g,0)),this.Ch=g,"number"===typeof h?(a===Qf&&(h=Math.max(h,0)),this.Kg=h):this.Kg=0,this.Ko=this.sp=!1);this.ei=!1;this.lb=!0;this.tg=null}D.ja("PathSegment",Xf);D.Ai(Xf);Xf.prototype.copy=function(){var a=new Xf;a.ca=this.ca;a.Ab=this.Ab;a.Ib=this.Ib;a.Pd=this.Pd;a.df=this.df;a.Ch=this.Ch;a.Kg=this.Kg;a.sp=this.sp;a.Ko=this.Ko;a.ei=this.ei;a.lb=this.lb;return a};
Xf.prototype.equalsApprox=Xf.prototype.Sc=function(a){if(!(a instanceof Xf)||this.type!==a.type||this.Rx!==a.Rx)return!1;switch(this.type){case Ef:case wf:return Q(this.H,a.H)&&Q(this.I,a.I);case Of:return Q(this.H,a.H)&&Q(this.I,a.I)&&Q(this.Ac,a.Ac)&&Q(this.Wc,a.Wc)&&Q(this.Rh,a.Rh)&&Q(this.Sh,a.Sh);case Pf:return Q(this.H,a.H)&&Q(this.I,a.I)&&Q(this.Ac,a.Ac)&&Q(this.Wc,a.Wc);case Qf:return Q(this.Le,a.Le)&&Q(this.xf,a.xf)&&Q(this.na,a.na)&&Q(this.va,a.va)&&Q(this.radiusX,a.radiusX)&&Q(this.radiusY,
a.radiusY);case Rf:return this.sm===a.sm&&this.Wx===a.Wx&&Q(this.Zj,a.Zj)&&Q(this.H,a.H)&&Q(this.I,a.I)&&Q(this.radiusX,a.radiusX)&&Q(this.radiusY,a.radiusY);default:return!1}};Xf.prototype.nc=function(a){a.Ne===Xf?this.type=a:D.Xj(this,a)};
Xf.prototype.toString=function(a){void 0===a&&(a=-1);var b="";switch(this.type){case Ef:b=0>a?"M"+this.H.toString()+" "+this.I.toString():"M"+this.H.toFixed(a)+" "+this.I.toFixed(a);break;case wf:b=0>a?"L"+this.H.toString()+" "+this.I.toString():"L"+this.H.toFixed(a)+" "+this.I.toFixed(a);break;case Of:b=0>a?"C"+this.Ac.toString()+" "+this.Wc.toString()+" "+this.Rh.toString()+" "+this.Sh.toString()+" "+this.H.toString()+" "+this.I.toString():"C"+this.Ac.toFixed(a)+" "+this.Wc.toFixed(a)+" "+this.Rh.toFixed(a)+
" "+this.Sh.toFixed(a)+" "+this.H.toFixed(a)+" "+this.I.toFixed(a);break;case Pf:b=0>a?"Q"+this.Ac.toString()+" "+this.Wc.toString()+" "+this.H.toString()+" "+this.I.toString():"Q"+this.Ac.toFixed(a)+" "+this.Wc.toFixed(a)+" "+this.H.toFixed(a)+" "+this.I.toFixed(a);break;case Qf:b=0>a?"B"+this.Le.toString()+" "+this.xf.toString()+" "+this.na.toString()+" "+this.va.toString()+" "+this.radiusX:"B"+this.Le.toFixed(a)+" "+this.xf.toFixed(a)+" "+this.na.toFixed(a)+" "+this.va.toFixed(a)+" "+this.radiusX;
break;case Rf:b=0>a?"A"+this.radiusX.toString()+" "+this.radiusY.toString()+" "+this.Zj.toString()+" "+(this.Wx?1:0)+" "+(this.sm?1:0)+" "+this.H.toString()+" "+this.I.toString():"A"+this.radiusX.toFixed(a)+" "+this.radiusY.toFixed(a)+" "+this.Zj.toFixed(a)+" "+(this.Wx?1:0)+" "+(this.sm?1:0)+" "+this.H.toFixed(a)+" "+this.I.toFixed(a);break;default:b=this.type.toString()}return b+(this.ei?"z":"")};var Ef;Xf.Move=Ef=D.s(Xf,"Move",0);var wf;Xf.Line=wf=D.s(Xf,"Line",1);var Of;
Xf.Bezier=Of=D.s(Xf,"Bezier",2);var Pf;Xf.QuadraticBezier=Pf=D.s(Xf,"QuadraticBezier",3);var Qf;Xf.Arc=Qf=D.s(Xf,"Arc",4);var Rf;Xf.SvgArc=Rf=D.s(Xf,"SvgArc",4);Xf.prototype.freeze=function(){this.J=!0;return this};Xf.prototype.Ya=function(){this.J=!1;return this};Xf.prototype.close=Xf.prototype.close=function(){this.ei=!0;return this};
function Sf(a,b){if(null!==a.tg&&!1===b.lb)return a.tg;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.tg=[],a.tg;var e=a.Pd,g=a.df,h=Ze(c<d?c:d,a.Le,a.Le+a.xf,!1);if(c!==d){var k=D.Of();k.reset();c<d?k.scale(1,d/c):k.scale(c/d,1);Cf(h,k);D.He(k)}c=h.length;for(d=0;d<c;d++)k=h[d],k[0]+=e,k[1]+=g,k[2]+=e,k[3]+=g,k[4]+=e,k[5]+=g,k[6]+=e,k[7]+=g;a.tg=h;return a.tg}
function Tf(a,b,c,d){function e(a,b,c,d){return(a*d<b*c?-1:1)*Math.acos((a*c+b*d)/(Math.sqrt(a*a+b*b)*Math.sqrt(c*c+d*d)))}if(null!==a.tg&&!1===b.lb)return a.tg;b=a.Ch;var g=a.Kg;if(0===b||0===g)return a.tg=[],a.tg;var h=Math.PI/180*a.Pd,k=a.sp,l=a.Ko,m=a.Ab,n=a.Ib,p=Math.cos(h),q=Math.sin(h),r=p*(c-m)/2+q*(d-n)/2,h=-q*(c-m)/2+p*(d-n)/2,s=r*r/(b*b)+h*h/(g*g);1<s&&(b*=Math.sqrt(s),g*=Math.sqrt(s));s=(k===l?-1:1)*Math.sqrt((b*b*g*g-b*b*h*h-g*g*r*r)/(b*b*h*h+g*g*r*r));isNaN(s)&&(s=0);k=s*b*h/g;s=s*-g*
r/b;isNaN(k)&&(k=0);isNaN(s)&&(s=0);c=(c+m)/2+p*k-q*s;d=(d+n)/2+q*k+p*s;n=e(1,0,(r-k)/b,(h-s)/g);p=(r-k)/b;m=(h-s)/g;r=(-r-k)/b;k=(-h-s)/g;h=e(p,m,r,k);r=(p*r+m*k)/(Math.sqrt(p*p+m*m)*Math.sqrt(r*r+k*k));-1>=r?h=Math.PI:1<=r&&(h=0);!l&&0<h&&(h-=2*Math.PI);l&&0>h&&(h+=2*Math.PI);l=b>g?1:b/g;r=b>g?g/b:1;b=Ze(b>g?b:g,n,n+h,!0);g=D.Of();g.reset();g.translate(c,d);g.rotate(a.Pd,0,0);g.scale(l,r);Cf(b,g);D.He(g);a.tg=b;return a.tg}
D.defineProperty(Xf,{Rx:"isClosed"},function(){return this.ei},function(a){this.ei!==a&&(this.ei=a,this.lb=!0)});D.defineProperty(Xf,{type:"type"},function(){return this.ca},function(a){v&&D.Ca(a,Xf,Xf,"type");this.J&&D.pa(this,a);this.ca=a;this.lb=!0});D.defineProperty(Xf,{H:"endX"},function(){return this.Ab},function(a){v&&D.p(a,Xf,"endX");this.J&&D.pa(this,a);this.Ab=a;this.lb=!0});
D.defineProperty(Xf,{I:"endY"},function(){return this.Ib},function(a){v&&D.p(a,Xf,"endY");this.J&&D.pa(this,a);this.Ib=a;this.lb=!0});D.defineProperty(Xf,{Ac:"point1X"},function(){return this.Pd},function(a){v&&D.p(a,Xf,"point1X");this.J&&D.pa(this,a);this.Pd=a;this.lb=!0});D.defineProperty(Xf,{Wc:"point1Y"},function(){return this.df},function(a){v&&D.p(a,Xf,"point1Y");this.J&&D.pa(this,a);this.df=a;this.lb=!0});
D.defineProperty(Xf,{Rh:"point2X"},function(){return this.Ch},function(a){v&&D.p(a,Xf,"point2X");this.J&&D.pa(this,a);this.Ch=a;this.lb=!0});D.defineProperty(Xf,{Sh:"point2Y"},function(){return this.Kg},function(a){v&&D.p(a,Xf,"point2Y");this.J&&D.pa(this,a);this.Kg=a;this.lb=!0});D.defineProperty(Xf,{na:"centerX"},function(){return this.Pd},function(a){v&&D.p(a,Xf,"centerX");this.J&&D.pa(this,a);this.Pd=a;this.lb=!0});
D.defineProperty(Xf,{va:"centerY"},function(){return this.df},function(a){v&&D.p(a,Xf,"centerY");this.J&&D.pa(this,a);this.df=a;this.lb=!0});D.defineProperty(Xf,{radiusX:"radiusX"},function(){return this.Ch},function(a){v&&D.p(a,Xf,"radiusX");0>a&&D.ua(a,">= zero",Xf,"radiusX");this.J&&D.pa(this,a);this.Ch=a;this.lb=!0});D.defineProperty(Xf,{radiusY:"radiusY"},function(){return this.Kg},function(a){v&&D.p(a,Xf,"radiusY");0>a&&D.ua(a,">= zero",Xf,"radiusY");this.J&&D.pa(this,a);this.Kg=a;this.lb=!0});
D.defineProperty(Xf,{Le:"startAngle"},function(){return this.Ab},function(a){this.Ab!==a&&(this.J&&D.pa(this,a),v&&D.p(a,Xf,"startAngle"),a%=360,0>a&&(a+=360),this.Ab=a,this.lb=!0)});D.defineProperty(Xf,{xf:"sweepAngle"},function(){return this.Ib},function(a){v&&D.p(a,Xf,"sweepAngle");this.J&&D.pa(this,a);360<a&&(a=360);-360>a&&(a=-360);this.Ib=a;this.lb=!0});D.defineProperty(Xf,{sm:"isClockwiseArc"},function(){return this.Ko},function(a){this.J&&D.pa(this,a);this.Ko=a;this.lb=!0});
D.defineProperty(Xf,{Wx:"isLargeArc"},function(){return this.sp},function(a){this.J&&D.pa(this,a);this.sp=a;this.lb=!0});D.defineProperty(Xf,{Zj:"xAxisRotation"},function(){return this.Pd},function(a){v&&D.p(a,Xf,"xAxisRotation");a%=360;0>a&&(a+=360);this.J&&D.pa(this,a);this.Pd=a;this.lb=!0});
function Zf(){this.ba=null;this.iA=(new O(0,0)).freeze();this.qz=(new O(0,0)).freeze();this.zv=this.vw=0;this.Av=1;this.jw="";this.ax=this.Ov=!1;this.Lv=this.Bv=0;this.ak=this.Wv=this.gw=!1;this.Sr=null;this.Zw=0;this.Og=this.Yw=null}D.ja("InputEvent",Zf);
Zf.prototype.copy=function(){var a=new Zf;a.ba=this.ba;a.iA.assign(this.qe);a.qz.assign(this.ha);a.vw=this.vw;a.zv=this.zv;a.Av=this.Av;a.jw=this.jw;a.Ov=this.Ov;a.ax=this.ax;a.Bv=this.Bv;a.Lv=this.Lv;a.gw=this.gw;a.Wv=this.Wv;a.ak=this.ak;a.Sr=this.Sr;a.Zw=this.Zw;a.Yw=this.Yw;a.Og=this.Og;return a};
Zf.prototype.toString=function(){var a="^";0!==this.Jd&&(a+="M:"+this.Jd);0!==this.button&&(a+="B:"+this.button);""!==this.key&&(a+="K:"+this.key);0!==this.Oe&&(a+="C:"+this.Oe);0!==this.hm&&(a+="D:"+this.hm);this.Lc&&(a+="h");this.bubbles&&(a+="b");null!==this.ha&&(a+="@"+this.ha.toString());return a};D.defineProperty(Zf,{g:"diagram"},function(){return this.ba},function(a){this.ba=a});D.defineProperty(Zf,{qe:"viewPoint"},function(){return this.iA},function(a){D.l(a,O,Zf,"viewPoint");this.iA.assign(a)});
D.defineProperty(Zf,{ha:"documentPoint"},function(){return this.qz},function(a){D.l(a,O,Zf,"documentPoint");this.qz.assign(a)});Zf.prototype.getMultiTouchViewPoint=Zf.prototype.Mx=function(a,b){var c=this.g;if(null===c)return b;$f(c,this.event,a,b);return b};Zf.prototype.getMultiTouchDocumentPoint=function(a,b){var c=this.g;if(null===c)return b;$f(c,this.event,a,b);b.assign(c.UB(b));return b};D.defineProperty(Zf,{Jd:"modifiers"},function(){return this.vw},function(a){this.vw=a});
D.defineProperty(Zf,{button:"button"},function(){return this.zv},function(a){this.zv=a;if(null===this.event)switch(a){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2}});D.defineProperty(Zf,{buttons:"buttons"},function(){return this.Av},function(a){this.Av=a});D.defineProperty(Zf,{key:"key"},function(){return this.jw},function(a){this.jw=a});D.defineProperty(Zf,{im:"down"},function(){return this.Ov},function(a){this.Ov=a});
D.defineProperty(Zf,{up:"up"},function(){return this.ax},function(a){this.ax=a});D.defineProperty(Zf,{Oe:"clickCount"},function(){return this.Bv},function(a){this.Bv=a});D.defineProperty(Zf,{hm:"delta"},function(){return this.Lv},function(a){this.Lv=a});D.defineProperty(Zf,{yu:"isMultiTouch"},function(){return this.gw},function(a){this.gw=a});D.defineProperty(Zf,{Lc:"handled"},function(){return this.Wv},function(a){this.Wv=a});
D.defineProperty(Zf,{bubbles:"bubbles"},function(){return this.ak},function(a){this.ak=a});D.defineProperty(Zf,{event:"event"},function(){return this.Sr},function(a){this.Sr=a});D.w(Zf,{Lj:"isTouchEvent"},function(){var a=window.TouchEvent;return a&&this.event instanceof a?!0:(a=window.PointerEvent)&&this.event instanceof a&&"touch"===this.event.pointerType});D.w(Zf,{Vk:"isMac"},function(){return D.Vk});D.defineProperty(Zf,{timestamp:"timestamp"},function(){return this.Zw},function(a){this.Zw=a});
D.defineProperty(Zf,{fh:"targetDiagram"},function(){return this.Yw},function(a){this.Yw=a});D.defineProperty(Zf,{We:"targetObject"},function(){return this.Og},function(a){this.Og=a});D.defineProperty(Zf,{control:"control"},function(){return 0!==(this.Jd&1)},function(a){this.Jd=a?this.Jd|1:this.Jd&-2});D.defineProperty(Zf,{shift:"shift"},function(){return 0!==(this.Jd&4)},function(a){this.Jd=a?this.Jd|4:this.Jd&-5});
D.defineProperty(Zf,{alt:"alt"},function(){return 0!==(this.Jd&2)},function(a){this.Jd=a?this.Jd|2:this.Jd&-3});D.defineProperty(Zf,{Hu:"meta"},function(){return 0!==(this.Jd&8)},function(a){this.Jd=a?this.Jd|8:this.Jd&-9});D.defineProperty(Zf,{left:"left"},function(){var a=this.event;return null!==a&&a instanceof MouseEvent&&("mousedown"===a.type||"mouseup"===a.type)?0===this.button:0!==(this.buttons&1)},function(a){this.buttons=a?this.buttons|1:this.buttons&-2});
D.defineProperty(Zf,{right:"right"},function(){var a=this.event;return null!==a&&a instanceof MouseEvent&&("mousedown"===a.type||"mouseup"===a.type)?2===this.button:0!==(this.buttons&2)},function(a){this.buttons=a?this.buttons|2:this.buttons&-3});D.defineProperty(Zf,{VL:"middle"},function(){var a=this.event;return null!==a&&a instanceof MouseEvent&&("mousedown"===a.type||"mouseup"===a.type)?1===this.button:0!==(this.buttons&4)},function(a){this.buttons=a?this.buttons|4:this.buttons&-5});
function ag(){this.ba=null;this.Xb="";this.Ew=this.Ww=null;this.mr=!1}D.ja("DiagramEvent",ag);ag.prototype.copy=function(){var a=new ag;a.ba=this.ba;a.Xb=this.Xb;a.Ww=this.Ww;a.Ew=this.Ew;a.mr=this.mr;return a};ag.prototype.toString=function(){var a="*"+this.name;null!==this.LB&&(a+=":"+this.LB.toString());null!==this.qB&&(a+="("+this.qB.toString()+")");return a};D.defineProperty(ag,{g:"diagram"},function(){return this.ba},function(a){this.ba=a});
D.defineProperty(ag,{name:"name"},function(){return this.Xb},function(a){this.Xb=a});D.defineProperty(ag,{LB:"subject"},function(){return this.Ww},function(a){this.Ww=a});D.defineProperty(ag,{qB:"parameter"},function(){return this.Ew},function(a){this.Ew=a});D.defineProperty(ag,{cancel:"cancel"},function(){return this.mr},function(a){this.mr!==a&&D.Nn("DiagramEvent.cancel","2.0");this.mr=a});function bg(){this.nr=cg;this.ln=this.uw="";this.Ms=this.Ns=this.Qs=this.Rs=this.Ps=this.ba=this.ve=null}
D.ja("ChangedEvent",bg);var dg;bg.Transaction=dg=D.s(bg,"Transaction",-1);var cg;bg.Property=cg=D.s(bg,"Property",0);var mg;bg.Insert=mg=D.s(bg,"Insert",1);var ng;bg.Remove=ng=D.s(bg,"Remove",2);bg.prototype.clear=bg.prototype.clear=function(){this.Ms=this.Ns=this.Qs=this.Rs=this.Ps=this.ba=this.ve=null};
bg.prototype.copy=function(){var a=new bg;a.nr=this.nr;a.uw=this.uw;a.ln=this.ln;a.ve=this.ve;a.ba=this.ba;a.Ps=this.Ps;var b=this.Rs;a.Rs=D.Ta(b)&&"function"===typeof b.V?b.V():b;b=this.Qs;a.Qs=D.Ta(b)&&"function"===typeof b.V?b.V():b;b=this.Ns;a.Ns=D.Ta(b)&&"function"===typeof b.V?b.V():b;b=this.Ms;a.Ms=D.Ta(b)&&"function"===typeof b.V?b.V():b;return a};bg.prototype.nc=function(a){a.Ne===bg?this.Ic=a:D.Xj(this,a)};
bg.prototype.toString=function(){var a="",a=this.Ic===dg?a+"* ":this.Ic===cg?a+(null!==this.ga?"!m":"!d"):a+((null!==this.ga?"!m":"!d")+this.Ic);this.propertyName&&"string"===typeof this.propertyName&&(a+=" "+this.propertyName);this.wf&&this.wf!==this.propertyName&&(a+=" "+this.wf);a+=": ";this.Ic===dg?null!==this.oldValue&&(a+=" "+this.oldValue):(null!==this.object&&(a+=ja(this.object)),null!==this.oldValue&&(a+="  old: "+ja(this.oldValue)),null!==this.Sj&&(a+=" "+this.Sj),null!==this.newValue&&
(a+="  new: "+ja(this.newValue)),null!==this.Qj&&(a+=" "+this.Qj));return a};bg.prototype.getValue=bg.prototype.oa=function(a){return a?this.oldValue:this.newValue};bg.prototype.getParam=function(a){return a?this.Sj:this.Qj};bg.prototype.canUndo=bg.prototype.canUndo=function(){return null!==this.ga||null!==this.g?!0:!1};bg.prototype.undo=bg.prototype.undo=function(){this.canUndo()&&(null!==this.ga?this.ga.En(this,!0):null!==this.g&&this.g.En(this,!0))};
bg.prototype.canRedo=bg.prototype.canRedo=function(){return null!==this.ga||null!==this.g?!0:!1};bg.prototype.redo=bg.prototype.redo=function(){this.canRedo()&&(null!==this.ga?this.ga.En(this,!1):null!==this.g&&this.g.En(this,!1))};D.defineProperty(bg,{ga:"model"},function(){return this.ve},function(a){this.ve=a});D.defineProperty(bg,{g:"diagram"},function(){return this.ba},function(a){this.ba=a});
D.defineProperty(bg,{Ic:"change"},function(){return this.nr},function(a){v&&D.Ca(a,bg,bg,"change");this.nr=a});D.defineProperty(bg,{wf:"modelChange"},function(){return this.uw},function(a){v&&D.h(a,"string",bg,"modelChange");this.uw=a});D.defineProperty(bg,{propertyName:"propertyName"},function(){return this.ln},function(a){v&&"string"!==typeof a&&D.h(a,"function",bg,"propertyName");this.ln=a});
D.w(bg,{VF:"isTransactionFinished"},function(){return this.nr===dg&&("CommittedTransaction"===this.ln||"FinishedUndo"===this.ln||"FinishedRedo"===this.ln)});D.defineProperty(bg,{object:"object"},function(){return this.Ps},function(a){this.Ps=a});D.defineProperty(bg,{oldValue:"oldValue"},function(){return this.Rs},function(a){this.Rs=a});D.defineProperty(bg,{Sj:"oldParam"},function(){return this.Qs},function(a){this.Qs=a});
D.defineProperty(bg,{newValue:"newValue"},function(){return this.Ns},function(a){this.Ns=a});D.defineProperty(bg,{Qj:"newParam"},function(){return this.Ms},function(a){this.Ms=a});
function M(a){1<arguments.length&&D.k("Model constructor can only take one optional argument, the Array of node data.");D.tc(this);this.Cr=this.Xb="";this.aj=!1;this.Oz={};this.we=[];this.Ec=new ma(null,Object);this.wk="key";this.Po=this.xp=null;this.tr=this.ur=!1;this.dr=null;this.fn="category";this.vg=new ma(null,L);this.sk=null;this.tj=!1;this.hA=null;this.ra=new og;void 0!==a&&(this.mg=a)}D.ja("Model",M);
M.prototype.cloneProtected=function(a){a.Xb=this.Xb;a.Cr=this.Cr;a.aj=this.aj;a.wk=this.wk;a.xp=this.xp;a.Po=this.Po;a.ur=this.ur;a.tr=this.tr;a.dr=this.dr;a.fn=this.fn};M.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};M.prototype.clear=M.prototype.clear=function(){this.we=[];this.Ec.clear();this.vg.clear();this.ra.clear()};f=M.prototype;
f.toString=function(a){void 0===a&&(a=0);if(1<a)return this.OB();var b=(""!==this.name?this.name:"")+" Model";if(0<a){b+="\n node data:";a=this.mg;for(var c=D.cb(a),d=0;d<c;d++)var e=D.La(a,d),b=b+(" "+this.Cb(e)+":"+ja(e))}return b};
f.zo=function(){var a="";""!==this.name&&(a+=',\n  "name": '+this.quote(this.name));""!==this.fm&&(a+=',\n  "dataFormat": '+this.quote(this.fm));this.mb&&(a+=',\n  "isReadOnly": '+this.mb);"key"!==this.Rj&&"string"===typeof this.Rj&&(a+=',\n  "nodeKeyProperty": '+this.quote(this.Rj));this.xA&&(a+=',\n  "copiesArrays": true');this.wA&&(a+=',\n  "copiesArrayObjects": true');"category"!==this.no&&"string"===typeof this.no&&(a+=',\n  "nodeCategoryProperty": '+this.quote(this.no));return a};
f.Ru=function(a){a.name&&(this.name=a.name);a.dataFormat&&(this.fm=a.dataFormat);a.isReadOnly&&(this.mb=a.isReadOnly);a.nodeKeyProperty&&(this.Rj=a.nodeKeyProperty);a.copiesArrays&&(this.xA=a.copiesArrays);a.copiesArrayObjects&&(this.wA=a.copiesArrayObjects);a.nodeCategoryProperty&&(this.no=a.nodeCategoryProperty)};function pg(a){return',\n  "modelData": '+qg(a,a.Yk)}function rg(a,b){var c=b.modelData;D.Ta(c)&&(a.Uu(c),a.Yk=c)}
f.bC=function(){var a=this.Yk,b=!1,c;for(c in a)if(!sg(c,a[c])){b=!0;break}a="";b&&(a=pg(this));return a+',\n  "nodeDataArray": '+tg(this,this.mg,!0)};f.tB=function(a){rg(this,a);a=a.nodeDataArray;D.isArray(a)&&(this.Uu(a),this.mg=a)};
function ug(a,b,c,d){if(b===c)return!0;if(typeof b!==typeof c||"function"===typeof b||"function"===typeof c)return!1;if(Array.isArray(b)&&Array.isArray(c)){if(d.oa(b)===c)return!0;d.add(b,c);if(b.length!==c.length)return!1;for(var e=0;e<b.length;e++)if(!ug(a,b[e],c[e],d))return!1;return!0}if(D.Ta(b)&&D.Ta(c)){if(d.oa(b)===c)return!0;d.add(b,c);for(e in b){var g=b[e];if(!sg(e,g)){var h=c[e];if(void 0===h||!ug(a,g,h,d))return!1}}for(var k in c)if(h=c[k],!sg(k,h)&&(g=b[k],void 0===g||!ug(a,g,h,d)))return!1;
return!0}return!1}function vg(a,b,c){a[c]!==b[c]&&D.k("Model.computeJsonDifference: Model."+c+' is not the same in both models: "'+a[c]+'" and "'+b[c]+'"')}
f.cC=function(a){vg(this,a,"nodeKeyProperty");this instanceof wg&&vg(this,a,"nodeParentKeyProperty");for(var b=new L,c=new L,d=(new L).Rc(this.Ec.XF),e=new ma,g=a.mg,h=0;h<g.length;h++){var k=g[h],l=a.Cb(k);if(void 0!==l){d.remove(l);var m=this.Fe(l);null===m?(b.add(l),c.add(k)):ug(this,m,k,e)||c.add(k)}else this.eB(k),l=this.Cb(k),b.add(l),c.add(k)}g="";ug(this,this.Yk,a.Yk,e)||(g+=pg(this));0<b.count&&(g+=this.Vy+tg(this,b.lc(),!0));0<c.count&&(g+=this.kC+tg(this,c.lc(),!0));0<d.count&&(g+=this.Xy+
tg(this,d.lc(),!0));return g};M.prototype.computeJsonDifference=M.prototype.computeJSONDifference=function(a,b){D.l(a,M,M,"computeJsonDifference:newmodel");void 0===b&&(b=this.constructor===M?"go.Model":this.constructor===Y?"go.GraphLinksModel":this.constructor===wg?"go.TreeModel":D.qf(this));return'{ "class": '+this.quote(b)+', "incremental": 1'+this.zo()+this.cC(a)+"}"};f=M.prototype;f.Vy=',\n  "insertedNodeKeys": ';f.kC=',\n  "modifiedNodeData": ';f.Xy=',\n  "removedNodeKeys": ';
f.aC=function(a,b){var c=this,d=!1,e=new L,g=new L,h=new L;a.ag.each(function(a){a.ga===c&&("nodeDataArray"===a.wf?a.Ic===mg?e.add(a.newValue):a.Ic===ng&&h.add(a.oldValue):c.ie(a.object)?g.add(a.object):c.Yk===a.object&&a.Ic===cg&&(d=!0))});var k=new L;e.each(function(a){k.add(c.Cb(a));b||g.add(a)});var l=new L;h.each(function(a){l.add(c.Cb(a));b&&g.add(a)});var m="";d&&(m+=pg(this));0<k.count&&(m+=(b?this.Xy:this.Vy)+tg(this,k.lc(),!0));0<g.count&&(m+=this.kC+tg(this,g.lc(),!0));0<l.count&&(m+=(b?
this.Vy:this.Xy)+tg(this,l.lc(),!0));return m};
f.sB=function(a){rg(this,a);var b=a.insertedNodeKeys;if(D.isArray(b))for(var c=D.cb(b),d=0;d<c;d++){var e=D.La(b,d),g=this.Fe(e);null===g&&(g=this.copyNodeData({}),this.Gy(g,e),this.Vl(g))}e=a.modifiedNodeData;if(D.isArray(e))for(c=D.cb(e),d=0;d<c;d++)if(b=D.La(e,d),g=this.Cb(b),g=this.Fe(g),null!==g)for(var h in b)"__gohashid"!==h&&h!==this.Rj&&this.setDataProperty(g,h,b[h]);a=a.removedNodeKeys;if(D.isArray(a))for(c=D.cb(a),d=0;d<c;d++)e=D.La(a,d),g=this.Fe(e),null!==g&&this.yy(g)};
M.prototype.toIncrementalJson=M.prototype.toIncrementalJSON=function(a,b){D.l(a,bg,M,"toIncrementalJson:e");a.Ic!==dg&&D.k("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+a.toString());var c=a.object;if(!(a.VF&&c instanceof xg))return'{ "incremental": 0 }';void 0===b&&(b=this.constructor===M?"go.Model":this.constructor===Y?"go.GraphLinksModel":this.constructor===wg?"go.TreeModel":D.qf(this));return'{ "class": '+this.quote(b)+', "incremental": 1'+this.zo()+this.aC(c,"FinishedUndo"===
a.propertyName)+"}"};M.prototype.toJson=M.prototype.toJSON=M.prototype.OB=function(a){void 0===a&&(a=this.constructor===M?"go.Model":this.constructor===Y?"go.GraphLinksModel":this.constructor===wg?"go.TreeModel":D.qf(this));return'{ "class": '+this.quote(a)+this.zo()+this.bC()+"}"};
M.prototype.applyIncrementalJson=M.prototype.applyIncrementalJSON=function(a){var b=null;if("string"===typeof a)if(window.JSON&&window.JSON.parse)try{b=window.JSON.parse(a)}catch(c){v&&D.trace("JSON.parse error: "+c.toString())}else D.trace("WARNING: no JSON.parse available");else"object"===typeof a?b=a:D.k("Unable to modify a Model from: "+a);var d=b.incremental;"number"!==typeof d&&D.k("Unable to apply non-incremental changes to Model: "+a);0!==d&&(this.$b("applyIncrementalJson"),this.sB(b),this.Td("applyIncrementalJson"))};
M.fromJson=M.fromJSON=function(a,b){void 0===b&&(b=null);null!==b&&D.l(b,M,M,"fromJson:model");var c=null;if("string"===typeof a)if(window.JSON&&window.JSON.parse)try{c=window.JSON.parse(a)}catch(d){v&&D.trace("JSON.parse error: "+d.toString())}else D.trace("WARNING: no JSON.parse available");else"object"===typeof a?c=a:D.k("Unable to construct a Model from: "+a);if(null===b){var e;e=null;var g=c["class"];if("string"===typeof g)try{var h=null;0===g.indexOf("go.")?(g=g.substr(3),h=aa[g]):(h=aa[g],
void 0===h&&(h=window[g]));"function"===typeof h&&(e=new h)}catch(k){}null===e||e instanceof M?b=e:D.k("Unable to construct a Model of declared class: "+c["class"])}null===b&&(b=new Y);b.Ru(c);b.tB(c);return b};
M.prototype.replaceJsonObjects=M.prototype.Uu=function(a){if(D.isArray(a))for(var b=D.cb(a),c=0;c<b;c++){var d=D.La(a,c);D.Ta(d)&&D.JE(a,c,this.Uu(d))}else if(D.Ta(a)){for(c in a)d=a[c],D.Ta(d)&&(d=this.Uu(d),a[c]=d);if("object"===typeof a){d=a;c=a["class"];if("NaN"===c)d=NaN;else if("Date"===c)d=new Date(a.value);else if("go.Point"===c)d=new O(yg(a.x),yg(a.y));else if("go.Size"===c)d=new Ca(yg(a.width),yg(a.height));else if("go.Rect"===c)d=new B(yg(a.x),yg(a.y),yg(a.width),yg(a.height));else if("go.Margin"===
c)d=new Hb(yg(a.top),yg(a.right),yg(a.bottom),yg(a.left));else if("go.Spot"===c)d="string"===typeof a["enum"]?Yb(a["enum"]):new R(yg(a.x),yg(a.y),yg(a.offsetX),yg(a.offsetY));else if("go.Brush"===c){if(d=new Ba,d.type=Ha(Ba,a.type),"string"===typeof a.color&&(d.color=a.color),a.start instanceof R&&(d.start=a.start),a.end instanceof R&&(d.end=a.end),"number"===typeof a.startRadius&&(d.dv=yg(a.startRadius)),"number"===typeof a.endRadius&&(d.eu=yg(a.endRadius)),a=a.colorStops,D.Ta(a))for(b in a)d.addColorStop(parseFloat(b),
a[b])}else"go.Geometry"===c?(b=null,b="string"===typeof a.path?yf(a.path):new bf,b.type=Ha(bf,a.type),"number"===typeof a.startX&&(b.ma=yg(a.startX)),"number"===typeof a.startY&&(b.ka=yg(a.startY)),"number"===typeof a.endX&&(b.H=yg(a.endX)),"number"===typeof a.endY&&(b.I=yg(a.endY)),a.spot1 instanceof R&&(b.C=a.spot1),a.spot2 instanceof R&&(b.D=a.spot2),d=b):"go.EnumValue"===c&&(b=a.classType,0===b.indexOf("go.")&&(b=b.substr(3)),d=Ha(aa[b],a.name));a=d}}return a};
M.prototype.quote=function(a){for(var b="",c=a.length,d=0;d<c;d++){var e=a[d];if('"'===e||"\\"===e)b+="\\"+e;else if("\b"===e)b+="\\b";else if("\f"===e)b+="\\f";else if("\n"===e)b+="\\n";else if("\r"===e)b+="\\r";else if("\t"===e)b+="\\t";else var g=a.charCodeAt(d),b=16>g?b+("\\u000"+a.charCodeAt(d).toString(16)):32>g?b+("\\u00"+a.charCodeAt(d).toString(16)):8232===g?b+"\\u2028":8233===g?b+"\\u2029":b+e}return'"'+b+'"'};
M.prototype.writeJsonValue=M.prototype.jv=function(a){return void 0===a?"undefined":null===a?"null":!0===a?"true":!1===a?"false":"string"===typeof a?this.quote(a):"number"===typeof a?Infinity===a?"9e9999":-Infinity===a?"-9e9999":isNaN(a)?'{"class":"NaN"}':a.toString():a instanceof Date?'{"class":"Date", "value":"'+a.toJSON()+'"}':a instanceof Number?this.jv(a.valueOf()):D.isArray(a)?tg(this,a):D.Ta(a)?qg(this,a):"function"===typeof a?"null":a.toString()};
function tg(a,b,c){void 0===c&&(c=!1);var d=D.cb(b);if(0>=d)return"[]";var e=new ya;e.add("[ ");c&&1<d&&e.add("\n");for(var g=0;g<d;g++){var h=D.La(b,g);void 0!==h&&(0<g&&(e.add(","),c&&e.add("\n")),e.add(a.jv(h)))}c&&1<d&&e.add("\n");e.add(" ]");return e.toString()}function sg(a,b){return void 0===b||"__gohashid"===a||"_"===a[0]||"function"===typeof b?!0:!1}function zg(a){return isNaN(a)?"NaN":Infinity===a?"9e9999":-Infinity===a?"-9e9999":a}
function qg(a,b){var c=b;if(c instanceof O)b={"class":"go.Point",x:zg(c.x),y:zg(c.y)};else if(c instanceof Ca)b={"class":"go.Size",width:zg(c.width),height:zg(c.height)};else if(c instanceof B)b={"class":"go.Rect",x:zg(c.x),y:zg(c.y),width:zg(c.width),height:zg(c.height)};else if(c instanceof Hb)b={"class":"go.Margin",top:zg(c.top),right:zg(c.right),bottom:zg(c.bottom),left:zg(c.left)};else if(c instanceof R)b=c.fd()?{"class":"go.Spot",x:zg(c.x),y:zg(c.y),offsetX:zg(c.offsetX),offsetY:zg(c.offsetY)}:
{"class":"go.Spot","enum":c.toString()};else if(c instanceof Ba){b={"class":"go.Brush",type:c.type.name};if(c.type===Ag)b.color=c.color;else if(c.type===Qg||c.type===Ed)b.start=c.start,b.end=c.end,c.type===Ed&&(0!==c.dv&&(b.startRadius=zg(c.dv)),isNaN(c.eu)||(b.endRadius=zg(c.eu)));if(null!==c.Lk){for(var d={},c=c.Lk.j;c.next();)d[c.key]=c.value;b.colorStops=d}}else if(c instanceof bf)b={"class":"go.Geometry",type:c.type.name},0!==c.ma&&(b.startX=zg(c.ma)),0!==c.ka&&(b.startY=zg(c.ka)),0!==c.H&&(b.endX=
zg(c.H)),0!==c.I&&(b.endY=zg(c.I)),c.C.O(cc)||(b.spot1=c.C),c.D.O(rc)||(b.spot2=c.D),c.type===cf&&(b.path=xf(c));else if(c instanceof za)b={"class":"go.EnumValue",classType:D.qf(c.Ne),name:c.name};else if(c instanceof P||c instanceof E||c instanceof Rg||c instanceof M||c instanceof Sg||c instanceof oa||c instanceof Tg||c instanceof va||c instanceof og||c instanceof xg)return D.trace("ERROR: trying to convert a GraphObject or Diagram or Model or Tool or Layout or UndoManager into JSON text: "+c.toString()),
"{}";var d="{",c=!0,e;for(e in b){var g=D.ub(b,e);if(!sg(e,g))if(c?c=!1:d+=", ",d+='"'+e+'":',"points"===e&&g instanceof K&&g.ca===O){for(var h="[",g=g.j;g.next();){var k=g.value;1<h.length&&(h+=",");h+=a.jv(k.x);h+=",";h+=a.jv(k.y)}h+="]";d+=h}else d+=a.jv(g)}return d+"}"}function yg(a){return"number"===typeof a?a:"NaN"===a?NaN:"9e9999"===a?Infinity:"-9e9999"===a?-Infinity:parseFloat(a)}
D.defineProperty(M,{name:"name"},function(){return this.Xb},function(a){var b=this.Xb;b!==a&&(D.h(a,"string",M,"name"),this.Xb=a,this.i("name",b,a))});D.defineProperty(M,{fm:"dataFormat"},function(){return this.Cr},function(a){var b=this.Cr;b!==a&&(D.h(a,"string",M,"dataFormat"),this.Cr=a,this.i("dataFormat",b,a))});D.defineProperty(M,{mb:"isReadOnly"},function(){return this.aj},function(a){var b=this.aj;b!==a&&(D.h(a,"boolean",M,"isReadOnly"),this.aj=a,this.i("isReadOnly",b,a))});
D.defineProperty(M,{Yk:"modelData"},function(){return this.Oz},function(a){var b=this.Oz;b!==a&&(D.h(a,"object",M,"modelData"),this.Oz=a,this.i("modelData",b,a),this.Nb(a))});M.prototype.addChangedListener=M.prototype.An=function(a){D.h(a,"function",M,"addChangedListener:listener");null===this.sk&&(this.sk=new K("function"));this.sk.add(a)};
M.prototype.removeChangedListener=M.prototype.Su=function(a){D.h(a,"function",M,"removeChangedListener:listener");null!==this.sk&&(this.sk.remove(a),0===this.sk.count&&(this.sk=null))};M.prototype.qx=function(a){this.Eb||this.ra.EF(a);if(null!==this.sk){var b=this.sk,c=b.length;if(1===c)b=b.ea(0),b(a);else if(0!==c)for(var d=b.lc(),e=0;e<c;e++)b=d[e],b(a)}};M.prototype.raiseChangedEvent=M.prototype.hd=function(a,b,c,d,e,g,h){Ug(this,"",a,b,c,d,e,g,h)};
M.prototype.raiseChanged=M.prototype.i=function(a,b,c,d,e){Ug(this,"",cg,a,this,b,c,d,e)};M.prototype.raiseDataChanged=M.prototype.rB=function(a,b,c,d,e,g){Ug(this,"",cg,b,a,c,d,e,g)};function Ug(a,b,c,d,e,g,h,k,l){void 0===k&&(k=null);void 0===l&&(l=null);var m=new bg;m.ga=a;m.Ic=c;m.wf=b;m.propertyName=d;m.object=e;m.oldValue=g;m.Sj=k;m.newValue=h;m.Qj=l;a.qx(m)}
D.defineProperty(M,{ra:"undoManager"},function(){return this.hA},function(a){var b=this.hA;b!==a&&(D.l(a,og,M,"undoManager"),null!==b&&b.WJ(this),this.hA=a,null!==a&&a.MH(this))});D.defineProperty(M,{Eb:"skipsUndoManager"},function(){return this.tj},function(a){D.h(a,"boolean",M,"skipsUndoManager");this.tj=a});
M.prototype.En=function(a,b){if(null!==a&&a.ga===this)if(a.Ic===cg){var c=a.object,d=a.propertyName,e=a.oa(b);D.Ua(c,d,e)}else a.Ic===mg?(c=a.Qj,"nodeDataArray"===a.wf?(d=a.newValue,D.Ta(d)&&"number"===typeof c&&(e=this.Cb(d),b?(D.La(this.we,c)===d&&D.Sg(this.we,c),void 0!==e&&this.Ec.remove(e)):(D.La(this.we,c)!==d&&D.Ih(this.we,c,d),void 0!==e&&this.Ec.add(e,d)))):""===a.wf?(d=a.object,!D.isArray(d)&&a.propertyName&&(d=D.ub(a.object,a.propertyName)),D.isArray(d)&&"number"===typeof c&&(e=a.newValue,
b?D.Sg(d,c):D.Ih(d,c,e))):D.k("unknown ChangedEvent.Insert modelChange: "+a.toString())):a.Ic===ng?(c=a.Sj,"nodeDataArray"===a.wf?(d=a.oldValue,D.Ta(d)&&"number"===typeof c&&(e=this.Cb(d),b?(D.La(this.we,c)!==d&&D.Ih(this.we,c,d),void 0!==e&&this.Ec.add(e,d)):(D.La(this.we,c)===d&&D.Sg(this.we,c),void 0!==e&&this.Ec.remove(e)))):""===a.wf?(d=a.object,!D.isArray(d)&&a.propertyName&&(d=D.ub(a.object,a.propertyName)),D.isArray(d)&&"number"===typeof c&&(e=a.oldValue,b?D.Ih(d,c,e):D.Sg(d,c))):D.k("unknown ChangedEvent.Remove modelChange: "+
a.toString())):a.Ic!==dg&&D.k("unknown ChangedEvent: "+a.toString())};M.prototype.startTransaction=M.prototype.$b=function(a){return this.ra.$b(a)};M.prototype.commitTransaction=M.prototype.Td=function(a){return this.ra.Td(a)};M.prototype.rollbackTransaction=M.prototype.Kq=function(){return this.ra.Kq()};M.prototype.updateTargetBindings=M.prototype.Nb=function(a,b){void 0===b&&(b="");Ug(this,"SourceChanged",dg,b,a,null,null)};
D.defineProperty(M,{Rj:"nodeKeyProperty"},function(){return this.wk},function(a){var b=this.wk;b!==a&&(Vg(a,M,"nodeKeyProperty"),""===a&&D.k("Model.nodeKeyProperty may not be the empty string"),0<this.Ec.count&&D.k("Cannot set Model.nodeKeyProperty when there is existing node data"),this.wk=a,this.i("nodeKeyProperty",b,a))});function Vg(a,b,c){"string"!==typeof a&&"function"!==typeof a&&D.gc(a,"string or function",b,c)}
M.prototype.getKeyForNodeData=M.prototype.Cb=function(a){if(null!==a){var b=this.wk;if(""!==b&&(b=D.ub(a,b),void 0!==b)){if(Wg(b))return b;D.k("Key value for node data "+a+" is not a number or a string: "+b)}}};
M.prototype.setKeyForNodeData=M.prototype.Gy=function(a,b){void 0!==b&&null!==b&&Wg(b)||D.gc(b,"number or string",M,"setKeyForNodeData:key");if(null!==a){var c=this.wk;if(""!==c)if(this.ie(a)){var d=D.ub(a,c);d!==b&&null===this.Fe(b)&&(D.Ua(a,c,b),this.Ec.remove(d),this.Ec.add(b,a),Ug(this,"nodeKey",cg,c,a,d,b),"string"===typeof c&&this.Nb(a,c),this.Tu(d,b))}else D.Ua(a,c,b)}};
D.defineProperty(M,{OL:"makeUniqueKeyFunction"},function(){return this.xp},function(a){var b=this.xp;b!==a&&(null!==a&&D.h(a,"function",M,"makeUniqueKeyFunction"),this.xp=a,this.i("makeUniqueKeyFunction",b,a))});function Wg(a){return"number"===typeof a||"string"===typeof a}M.prototype.containsNodeData=M.prototype.ie=function(a){var b=this.Cb(a);return void 0===b?!1:this.Ec.oa(b)===a};
M.prototype.findNodeDataForKey=M.prototype.Fe=function(a){null===a&&D.k("Model.findNodeDataForKey:key must not be null");return void 0!==a&&Wg(a)?this.Ec.oa(a):null};
D.defineProperty(M,{mg:"nodeDataArray"},function(){return this.we},function(a){var b=this.we;if(b!==a){D.Xt(a,M,"nodeDataArray");this.Ec.clear();this.WB();for(var c=D.cb(a),d=0;d<c;d++){var e=D.La(a,d);if(!D.Ta(e)){D.k("Model.nodeDataArray must only contain Objects, not: "+e);return}D.sq(e)}this.we=a;for(var g=new K(Object),d=0;d<c;d++){var e=D.La(a,d),h=this.Cb(e);void 0===h?g.add(e):null!==this.Ec.oa(h)?g.add(e):this.Ec.add(h,e)}for(d=g.j;d.next();)e=d.value,this.eB(e),g=this.Cb(e),void 0!==g&&
this.Ec.add(g,e);Ug(this,"nodeDataArray",cg,"nodeDataArray",this,b,a);for(d=0;d<c;d++)e=D.La(a,d),this.Jq(e),this.Iq(e);this.ME();D.hJ(a)||(this.mb=!0)}});
M.prototype.makeNodeDataKeyUnique=M.prototype.eB=function(a){if(null!==a){var b=this.wk;if(""!==b){var c=this.Cb(a);if(void 0===c||this.Ec.contains(c)){var d=this.xp;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.Ec.contains(c))){D.Ua(a,b,c);return}if("string"===typeof c){for(d=2;this.Ec.contains(c+d);)d++;D.Ua(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(d=-this.Ec.count-1;this.Ec.contains(d);)d--;D.Ua(a,b,d)}else D.k("Model.getKeyForNodeData returned something other than a string or a number: "+
c)}}}};M.prototype.addNodeData=M.prototype.Vl=function(a){null!==a&&(D.sq(a),this.ie(a)||Xg(this,a,!0))};function Xg(a,b,c){var d=a.Cb(b);if(void 0===d||a.Ec.oa(d)!==b)a.eB(b),d=a.Cb(b),void 0===d?D.k("Model.makeNodeDataKeyUnique failed on "+b+".  Data not added to Model."):(a.Ec.add(d,b),d=null,c&&(d=D.cb(a.we),D.Ih(a.we,d,b)),Ug(a,"nodeDataArray",mg,"nodeDataArray",a,null,b,null,d),a.Jq(b),a.Iq(b))}
M.prototype.addNodeDataCollection=function(a){if(D.isArray(a))for(var b=D.cb(a),c=0;c<b;c++)this.Vl(D.La(a,c));else for(a=a.j;a.next();)this.Vl(a.value)};M.prototype.removeNodeData=M.prototype.yy=function(a){null!==a&&Yg(this,a,!0)};function Yg(a,b,c){var d=a.Cb(b);void 0!==d&&a.Ec.remove(d);d=null;if(c){d=D.$l(a.we,b);if(0>d)return;D.Sg(a.we,d)}Ug(a,"nodeDataArray",ng,"nodeDataArray",a,b,null,d,null);a.hv(b)}
M.prototype.removeNodeDataCollection=function(a){if(D.isArray(a))for(var b=D.cb(a),c=0;c<b;c++)this.yy(D.La(a,c));else for(a=a.j;a.next();)this.yy(a.value)};f=M.prototype;f.Tu=function(a,b){var c=Zg(this,a);c instanceof L&&this.vg.add(b,c)};f.WB=function(){};f.Jq=function(){};f.Iq=function(){};f.hv=function(){};function $g(a,b,c){if(void 0!==b){var d=a.vg.oa(b);null===d&&(d=new L(Object),a.vg.add(b,d));d.add(c)}}
function ah(a,b,c){if(void 0!==b){var d=a.vg.oa(b);d instanceof L&&(void 0===c||null===c?a.vg.remove(b):(d.remove(c),0===d.count&&a.vg.remove(b)))}}function Zg(a,b){if(void 0===b)return null;var c=a.vg.oa(b);return c instanceof L?c:null}M.prototype.clearUnresolvedReferences=M.prototype.ME=function(a){void 0===a?this.vg.clear():this.vg.remove(a)};
D.defineProperty(M,{fL:"copyNodeDataFunction"},function(){return this.Po},function(a){var b=this.Po;b!==a&&(null!==a&&D.h(a,"function",M,"copyNodeDataFunction"),this.Po=a,this.i("copyNodeDataFunction",b,a))});D.defineProperty(M,{xA:"copiesArrays"},function(){return this.ur},function(a){var b=this.ur;b!==a&&(null!==a&&D.h(a,"boolean",M,"copiesArrays"),this.ur=a,this.i("copiesArrays",b,a))});
D.defineProperty(M,{wA:"copiesArrayObjects"},function(){return this.tr},function(a){var b=this.tr;b!==a&&(null!==a&&D.h(a,"boolean",M,"copiesArrayObjects"),this.tr=a,this.i("copiesArrayObjects",b,a))});M.prototype.copyNodeData=function(a){if(null===a)return null;var b=null,b=this.Po,b=null!==b?b(a,this):bh(this,a,!0);D.Ta(b)&&D.tc(b);return b};
function bh(a,b,c){if(a.xA&&Array.isArray(b)){var d=[];for(c=0;c<b.length;c++){var e=bh(a,b[c],a.wA);d.push(e)}D.tc(d);return d}if(c&&D.Ta(b)){c=(c=b.constructor)?new c:{};for(d in b)if("__gohashid"!==d){var e=D.ub(b,d),g;g=e;g instanceof P||g instanceof E||g instanceof Rg||g instanceof ch||g instanceof dh||g instanceof Sg||g instanceof oa||g instanceof Tg||g instanceof Zf||g instanceof ag?("_"!==d[0]&&D.trace('Warning: found GraphObject or Diagram reference when copying model data on property "'+
d+'" of data object: '+b.toString()+"  \nModel data should not have any references to a Diagram or any part of a diagram, such as: "+g.toString()),g=!0):g=g instanceof M||g instanceof og||g instanceof xg||g instanceof bg?!0:!1;g||(e=bh(a,e,!1));D.Ua(c,d,e)}D.tc(c);return c}return b instanceof O?b.copy():b instanceof Ca?b.copy():b instanceof B?b.copy():b instanceof R?b.copy():b instanceof Hb?b.copy():b}
D.defineProperty(M,{OH:"afterCopyFunction"},function(){return this.dr},function(a){var b=this.dr;b!==a&&(null!==a&&D.h(a,"function",M,"afterCopyFunction"),this.dr=a,this.i("afterCopyFunction",b,a))});var eh=!1;
M.prototype.setDataProperty=function(a,b,c){v&&(D.h(a,"object",M,"setDataProperty:data"),D.h(b,"string",M,"setDataProperty:propname"),""===b&&D.k("Model.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.ie(a))if(b===this.Rj)this.Gy(a,c);else{if(b===this.no){this.Ey(a,c);return}}else!eh&&a instanceof P&&(eh=!0,D.trace('Model.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),D.trace("  Is that really your intent?"));var d=D.ub(a,b);d!==c&&
(D.Ua(a,b,c),this.rB(a,b,d,c))};M.prototype.addArrayItem=function(a,b){this.WA(a,-1,b)};M.prototype.insertArrayItem=M.prototype.WA=function(a,b,c){v&&(D.Xt(a,M,"insertArrayItem:arr"),D.p(b,M,"insertArrayItem:idx"));a===this.we&&D.k("Model.insertArrayItem or Model.addArrayItem should not be called on the Model.nodeDataArray");0>b&&(b=D.cb(a));D.Ih(a,b,c);Ug(this,"",mg,"",a,null,c,null,b)};
M.prototype.removeArrayItem=M.prototype.sG=function(a,b){void 0===b&&(b=-1);v&&(D.Xt(a,M,"removeArrayItem:arr"),D.p(b,M,"removeArrayItem:idx"));a===this.we&&D.k("Model.removeArrayItem should not be called on the Model.nodeDataArray");-1===b&&(b=D.cb(a)-1);var c=D.La(a,b);D.Sg(a,b);Ug(this,"",ng,"",a,c,null,b,null)};D.defineProperty(M,{no:"nodeCategoryProperty"},function(){return this.fn},function(a){var b=this.fn;b!==a&&(Vg(a,M,"nodeCategoryProperty"),this.fn=a,this.i("nodeCategoryProperty",b,a))});
M.prototype.getCategoryForNodeData=M.prototype.OA=function(a){if(null===a)return"";var b=this.fn;if(""===b)return"";b=D.ub(a,b);if(void 0===b)return"";if("string"===typeof b)return b;D.k("getCategoryForNodeData found a non-string category for "+a+": "+b);return""};
M.prototype.setCategoryForNodeData=M.prototype.Ey=function(a,b){D.h(b,"string",M,"setCategoryForNodeData:cat");if(null!==a){var c=this.fn;if(""!==c)if(this.ie(a)){var d=D.ub(a,c);void 0===d&&(d="");d!==b&&(D.Ua(a,c,b),Ug(this,"nodeCategory",cg,c,a,d,b))}else D.Ua(a,c,b)}};
function Y(a,b){M.call(this);2<arguments.length&&D.k("GraphLinksModel constructor can only take two optional arguments, the Array of node data and the Array of link data.");this.bf=[];this.hi=new L(Object);this.nd=new ma(null,Object);this.Fl="";this.ol=this.Oo=this.yp=null;this.ii="from";this.ji="to";this.bn=this.an="";this.$m="category";this.Gg="";this.Bp="isGroup";this.zh="group";this.vr=!1;void 0!==a&&(this.mg=a);void 0!==b&&(this.Yg=b)}D.Sa(Y,M);D.ja("GraphLinksModel",Y);
Y.prototype.cloneProtected=function(a){M.prototype.cloneProtected.call(this,a);a.Fl=this.Fl;a.yp=this.yp;a.Oo=this.Oo;a.ii=this.ii;a.ji=this.ji;a.an=this.an;a.bn=this.bn;a.$m=this.$m;a.Gg=this.Gg;a.Bp=this.Bp;a.zh=this.zh;a.vr=this.vr};Y.prototype.clear=Y.prototype.clear=function(){M.prototype.clear.call(this);this.bf=[];this.nd.clear();this.hi.clear()};f=Y.prototype;
f.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.OB();var b=(""!==this.name?this.name:"")+" GraphLinksModel";if(0<a){b+="\n node data:";a=this.mg;for(var c=D.cb(a),d=0,d=0;d<c;d++)var e=D.La(a,d),b=b+(" "+this.Cb(e)+":"+ja(e));b+="\n link data:";a=this.Yg;c=D.cb(a);for(d=0;d<c;d++)e=D.La(a,d),b+=" "+this.om(e)+"--\x3e"+this.pm(e)}return b};
f.zo=function(){var a=M.prototype.zo.call(this),b="";"category"!==this.Cu&&"string"===typeof this.Cu&&(b+=',\n  "linkCategoryProperty": '+this.quote(this.Cu));""!==this.Oj&&"string"===typeof this.Oj&&(b+=',\n  "linkKeyProperty": '+this.quote(this.Oj));"from"!==this.co&&"string"===typeof this.co&&(b+=',\n  "linkFromKeyProperty": '+this.quote(this.co));"to"!==this.eo&&"string"===typeof this.eo&&(b+=',\n  "linkToKeyProperty": '+this.quote(this.eo));""!==this.Du&&"string"===typeof this.Du&&(b+=',\n  "linkFromPortIdProperty": '+
this.quote(this.Du));""!==this.Fu&&"string"===typeof this.Fu&&(b+=',\n  "linkToPortIdProperty": '+this.quote(this.Fu));""!==this.Eu&&"string"===typeof this.Eu&&(b+=',\n  "linkLabelKeysProperty": '+this.quote(this.Eu));"isGroup"!==this.Nu&&"string"===typeof this.Nu&&(b+=',\n  "nodeIsGroupProperty": '+this.quote(this.Nu));"group"!==this.Mu&&"string"===typeof this.Mu&&(b+=',\n  "nodeGroupKeyProperty": '+this.quote(this.Mu));return a+b};
f.Ru=function(a){M.prototype.Ru.call(this,a);a.linkKeyProperty&&(this.Oj=a.linkKeyProperty);a.linkFromKeyProperty&&(this.co=a.linkFromKeyProperty);a.linkToKeyProperty&&(this.eo=a.linkToKeyProperty);a.linkFromPortIdProperty&&(this.Du=a.linkFromPortIdProperty);a.linkToPortIdProperty&&(this.Fu=a.linkToPortIdProperty);a.linkCategoryProperty&&(this.Cu=a.linkCategoryProperty);a.linkLabelKeysProperty&&(this.Eu=a.linkLabelKeysProperty);a.nodeIsGroupProperty&&(this.Nu=a.nodeIsGroupProperty);a.nodeGroupKeyProperty&&
(this.Mu=a.nodeGroupKeyProperty)};f.bC=function(){var a=M.prototype.bC.call(this),b=',\n  "linkDataArray": '+tg(this,this.Yg,!0);return a+b};f.tB=function(a){M.prototype.tB.call(this,a);a=a.linkDataArray;D.isArray(a)&&(this.Uu(a),this.Yg=a)};
f.cC=function(a){if(!(a instanceof Y))return D.k("Model.computeJsonDifference: newmodel must be a GraphLinksModel"),"";""===this.Oj&&D.k("GraphLinksModel.linkKeyProperty must not be an empty string for .computeJsonDifference() to succeed.");var b=M.prototype.cC.call(this,a);vg(this,a,"linkKeyProperty");vg(this,a,"linkFromKeyProperty");vg(this,a,"linkToKeyProperty");vg(this,a,"linkLabelKeysProperty");vg(this,a,"nodeIsGroupProperty");vg(this,a,"nodeGroupKeyProperty");for(var c=new L,d=new L,e=(new L).Rc(this.nd.XF),
g=new ma,h=a.Yg,k=0;k<h.length;k++){var l=h[k],m=a.dg(l);if(void 0!==m){e.remove(m);var n=this.oq(m);null===n?(c.add(m),d.add(l)):ug(this,n,l,g)||d.add(l)}else this.dB(l),m=this.dg(l),c.add(m),d.add(l)}a=b;0<c.count&&(a+=this.Uy+tg(this,c.lc(),!0));0<d.count&&(a+=this.jC+tg(this,d.lc(),!0));0<e.count&&(a+=this.Wy+tg(this,e.lc(),!0));return a};f.Uy=',\n  "insertedLinkKeys": ';f.jC=',\n  "modifiedLinkData": ';f.Wy=',\n  "removedLinkKeys": ';
f.aC=function(a,b){""===this.Oj&&D.k("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalJson() to succeed.");var c=M.prototype.aC.call(this,a,b),d=this,e=new L,g=new L,h=new L;a.ag.each(function(a){a.ga===d&&("linkDataArray"===a.wf?a.Ic===mg?e.add(a.newValue):a.Ic===ng&&h.add(a.oldValue):d.Lh(a.object)&&g.add(a.object))});var k=new L;e.each(function(a){k.add(d.dg(a));b||g.add(a)});var l=new L;h.each(function(a){l.add(d.dg(a));b&&g.add(a)});0<k.count&&(c+=(b?this.Wy:this.Uy)+
tg(this,k.lc(),!0));0<g.count&&(c+=this.jC+tg(this,g.lc(),!0));0<l.count&&(c+=(b?this.Uy:this.Wy)+tg(this,l.lc(),!0));return c};
f.sB=function(a){M.prototype.sB.call(this,a);var b=a.insertedLinkKeys;if(D.isArray(b))for(var c=D.cb(b),d=0;d<c;d++){var e=D.La(b,d),g=this.oq(e);null===g&&(g=this.vx({}),this.PG(g,e),this.Qt(g))}e=a.modifiedLinkData;if(D.isArray(e))for(c=D.cb(e),d=0;d<c;d++)if(b=D.La(e,d),g=this.dg(b),g=this.oq(g),null!==g)for(var h in b)"__gohashid"!==h&&h!==this.Oj&&this.setDataProperty(g,h,b[h]);a=a.removedLinkKeys;if(D.isArray(a))for(c=D.cb(a),d=0;d<c;d++)e=D.La(a,d),g=this.oq(e),null!==g&&this.xy(g)};
f.En=function(a,b){if(a.Ic===mg){var c=a.Qj;if("linkDataArray"===a.wf){var d=a.newValue;if(D.Ta(d)&&"number"===typeof c){var e=this.dg(d);b?(this.hi.remove(d),D.La(this.bf,c)===d&&D.Sg(this.bf,c),void 0!==e&&this.nd.remove(e)):(this.hi.add(d),D.La(this.bf,c)!==d&&D.Ih(this.bf,c,d),void 0!==e&&this.nd.add(e,d))}return}if("linkLabelKeys"===a.wf){d=this.Sk(a.object);D.isArray(d)&&"number"===typeof c&&(b?(c=D.$l(d,a.newValue),0<=c&&D.Sg(d,c)):0>D.$l(d,a.newValue)&&D.Ih(d,c,a.newValue));return}}else if(a.Ic===
ng){c=a.Sj;if("linkDataArray"===a.wf){d=a.oldValue;D.Ta(d)&&"number"===typeof c&&(e=this.dg(d),b?(this.hi.add(d),D.La(this.bf,c)!==d&&D.Ih(this.bf,c,d),void 0!==e&&this.nd.add(e,d)):(this.hi.remove(d),D.La(this.bf,c)===d&&D.Sg(this.bf,c),void 0!==e&&this.nd.remove(e)));return}if("linkLabelKeys"===a.wf){d=this.Sk(a.object);D.isArray(d)&&"number"===typeof c&&(b?0>D.$l(d,a.newValue)&&D.Ih(d,c,a.newValue):(c=D.$l(d,a.newValue),0<=c&&D.Sg(d,c)));return}}M.prototype.En.call(this,a,b)};
D.defineProperty(Y,{pA:"archetypeNodeData"},function(){return this.ol},function(a){var b=this.ol;b!==a&&(null!==a&&D.l(a,Object,Y,"archetypeNodeData"),this.ol=a,this.i("archetypeNodeData",b,a))});Y.prototype.fo=function(a){if(void 0!==a){var b=this.ol;if(null!==b){var c=this.Fe(a);null===c&&(c=this.copyNodeData(b),D.Ua(c,this.wk,a),this.Vl(c))}return a}};
D.defineProperty(Y,{co:"linkFromKeyProperty"},function(){return this.ii},function(a){var b=this.ii;b!==a&&(Vg(a,Y,"linkFromKeyProperty"),this.ii=a,this.i("linkFromKeyProperty",b,a))});Y.prototype.getFromKeyForLinkData=Y.prototype.om=function(a){if(null!==a){var b=this.ii;if(""!==b&&(b=D.ub(a,b),void 0!==b)){if(Wg(b))return b;D.k("FromKey value for link data "+a+" is not a number or a string: "+b)}}};
Y.prototype.setFromKeyForLinkData=Y.prototype.BB=function(a,b){null===b&&(b=void 0);void 0===b||Wg(b)||D.gc(b,"number or string",Y,"setFromKeyForLinkData:key");if(null!==a){var c=this.ii;if(""!==c)if(b=this.fo(b),this.Lh(a)){var d=D.ub(a,c);d!==b&&(ah(this,d,a),D.Ua(a,c,b),null===this.Fe(b)&&$g(this,b,a),Ug(this,"linkFromKey",cg,c,a,d,b),"string"===typeof c&&this.Nb(a,c))}else D.Ua(a,c,b)}};
D.defineProperty(Y,{eo:"linkToKeyProperty"},function(){return this.ji},function(a){var b=this.ji;b!==a&&(Vg(a,Y,"linkToKeyProperty"),this.ji=a,this.i("linkToKeyProperty",b,a))});Y.prototype.getToKeyForLinkData=Y.prototype.pm=function(a){if(null!==a){var b=this.ji;if(""!==b&&(b=D.ub(a,b),void 0!==b)){if(Wg(b))return b;D.k("ToKey value for link data "+a+" is not a number or a string: "+b)}}};
Y.prototype.setToKeyForLinkData=Y.prototype.HB=function(a,b){null===b&&(b=void 0);void 0===b||Wg(b)||D.gc(b,"number or string",Y,"setToKeyForLinkData:key");if(null!==a){var c=this.ji;if(""!==c)if(b=this.fo(b),this.Lh(a)){var d=D.ub(a,c);d!==b&&(ah(this,d,a),D.Ua(a,c,b),null===this.Fe(b)&&$g(this,b,a),Ug(this,"linkToKey",cg,c,a,d,b),"string"===typeof c&&this.Nb(a,c))}else D.Ua(a,c,b)}};
D.defineProperty(Y,{Du:"linkFromPortIdProperty"},function(){return this.an},function(a){var b=this.an;b!==a&&(Vg(a,Y,"linkFromPortIdProperty"),a!==this.co&&a!==this.eo||D.k("linkFromPortIdProperty name must not be the same as the GraphLinksModel.linkFromKeyProperty or linkToKeyProperty: "+a),this.an=a,this.i("linkFromPortIdProperty",b,a))});Y.prototype.getFromPortIdForLinkData=Y.prototype.KI=function(a){if(null===a)return"";var b=this.an;if(""===b)return"";a=D.ub(a,b);return void 0===a?"":a};
Y.prototype.setFromPortIdForLinkData=Y.prototype.CB=function(a,b){D.h(b,"string",Y,"setFromPortIdForLinkData:portname");if(null!==a){var c=this.an;if(""!==c)if(this.Lh(a)){var d=D.ub(a,c);void 0===d&&(d="");d!==b&&(D.Ua(a,c,b),Ug(this,"linkFromPortId",cg,c,a,d,b),"string"===typeof c&&this.Nb(a,c))}else D.Ua(a,c,b)}};
D.defineProperty(Y,{Fu:"linkToPortIdProperty"},function(){return this.bn},function(a){var b=this.bn;b!==a&&(Vg(a,Y,"linkToPortIdProperty"),a!==this.co&&a!==this.eo||D.k("linkFromPortIdProperty name must not be the same as the GraphLinksModel.linkFromKeyProperty or linkToKeyProperty: "+a),this.bn=a,this.i("linkToPortIdProperty",b,a))});Y.prototype.getToPortIdForLinkData=Y.prototype.OI=function(a){if(null===a)return"";var b=this.bn;if(""===b)return"";a=D.ub(a,b);return void 0===a?"":a};
Y.prototype.setToPortIdForLinkData=Y.prototype.IB=function(a,b){D.h(b,"string",Y,"setToPortIdForLinkData:portname");if(null!==a){var c=this.bn;if(""!==c)if(this.Lh(a)){var d=D.ub(a,c);void 0===d&&(d="");d!==b&&(D.Ua(a,c,b),Ug(this,"linkToPortId",cg,c,a,d,b),"string"===typeof c&&this.Nb(a,c))}else D.Ua(a,c,b)}};D.defineProperty(Y,{Eu:"linkLabelKeysProperty"},function(){return this.Gg},function(a){var b=this.Gg;b!==a&&(Vg(a,Y,"linkLabelKeysProperty"),this.Gg=a,this.i("linkLabelKeysProperty",b,a))});
Y.prototype.getLabelKeysForLinkData=Y.prototype.Sk=function(a){if(null===a)return D.Co;var b=this.Gg;if(""===b)return D.Co;a=D.ub(a,b);return void 0===a?D.Co:a};
Y.prototype.setLabelKeysForLinkData=Y.prototype.QG=function(a,b){D.Xt(b,Y,"setLabelKeysForLinkData:arr");if(null!==a){var c=this.Gg;if(""!==c)if(this.Lh(a)){var d=D.ub(a,c);void 0===d&&(d=D.Co);if(d!==b){for(var e=D.cb(d),g=0;g<e;g++){var h=D.La(d,g);ah(this,h,a)}D.Ua(a,c,b);e=D.cb(b);for(g=0;g<e;g++)h=D.La(b,g),null===this.Fe(h)&&$g(this,h,a);Ug(this,"linkLabelKeys",cg,c,a,d,b);"string"===typeof c&&this.Nb(a,c)}}else D.Ua(a,c,b)}};
Y.prototype.addLabelKeyForLinkData=Y.prototype.CE=function(a,b){if(null!==b&&void 0!==b&&(Wg(b)||D.gc(b,"number or string",Y,"addLabelKeyForLinkData:key"),null!==a)){var c=this.Gg;if(""!==c){var d=D.ub(a,c);if(void 0===d)c=[],c.push(b),this.QG(a,c);else if(D.isArray(d)){var e=D.$l(d,b);0<=e||(e=D.cb(d),D.Ih(d,Infinity,b),this.Lh(a)&&(null===this.Fe(b)&&$g(this,b,a),Ug(this,"linkLabelKeys",mg,c,a,null,b,null,e)))}else D.k(c+" property is not an Array; cannot addLabelKeyForLinkData: "+a)}}};
Y.prototype.removeLabelKeyForLinkData=Y.prototype.VJ=function(a,b){if(null!==b&&void 0!==b&&(Wg(b)||D.gc(b,"number or string",Y,"removeLabelKeyForLinkData:key"),null!==a)){var c=this.Gg;if(""!==c){var d=D.ub(a,c);if(D.isArray(d)){var e=D.$l(d,b);0>e||(D.Sg(d,e),this.Lh(a)&&(ah(this,b,a),Ug(this,"linkLabelKeys",ng,c,a,b,null,e,null)))}else void 0!==d&&D.k(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}};
D.defineProperty(Y,{Yg:"linkDataArray"},function(){return this.bf},function(a){var b=this.bf;if(b!==a){D.Xt(a,Y,"linkDataArray");this.nd.clear();for(var c=D.cb(a),d=0;d<c;d++){var e=D.La(a,d);if(!D.Ta(e)){D.k("GraphLinksModel.linkDataArray must only contain Objects, not: "+e);return}D.sq(e)}this.bf=a;if(""!==this.Oj){for(var g=new K(Object),d=0;d<c;d++){var e=D.La(a,d),h=this.dg(e);void 0===h?g.add(e):null!==this.nd.oa(h)?g.add(e):this.nd.add(h,e)}for(d=g.j;d.next();)e=d.value,this.dB(e),g=this.dg(e),
void 0!==g&&this.nd.add(g,e)}g=new L(Object);for(d=0;d<c;d++)e=D.La(a,d),g.add(e);this.hi=g;Ug(this,"linkDataArray",cg,"linkDataArray",this,b,a);for(d=0;d<c;d++)e=D.La(a,d),fh(this,e)}});D.defineProperty(Y,{Oj:"linkKeyProperty"},function(){return this.Fl},function(a){var b=this.Fl;if(b!==a){Vg(a,Y,"linkKeyProperty");this.Fl=a;this.nd.clear();for(var c=D.cb(this.Yg),d=0;d<c;d++){var e=D.La(this.Yg,d),g=this.dg(e);void 0!==g&&this.nd.add(g,e)}this.i("linkKeyProperty",b,a)}});
Y.prototype.getKeyForLinkData=Y.prototype.dg=function(a){if(null!==a){var b=this.Fl;if(""!==b&&(b=D.ub(a,b),void 0!==b)){if(Wg(b))return b;D.k("Key value for link data "+a+" is not a number or a string: "+b)}}};
Y.prototype.setKeyForLinkData=Y.prototype.PG=function(a,b){void 0!==b&&null!==b&&Wg(b)||D.gc(b,"number or string",Y,"setKeyForLinkData:key");if(null!==a){var c=this.Fl;if(""!==c)if(this.Lh(a)){var d=D.ub(a,c);d!==b&&null===this.oq(b)&&(D.Ua(a,c,b),this.nd.remove(d),this.nd.add(b,a),Ug(this,"linkKey",cg,c,a,d,b),"string"===typeof c&&this.Nb(a,c))}else D.Ua(a,c,b)}};
D.defineProperty(Y,{PL:"makeUniqueLinkKeyFunction"},function(){return this.yp},function(a){var b=this.yp;b!==a&&(null!==a&&D.h(a,"function",Y,"makeUniqueLinkKeyFunction"),this.yp=a,this.i("makeUniqueLinkKeyFunction",b,a))});Y.prototype.findLinkDataForKey=Y.prototype.oq=function(a){null===a&&D.k("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&Wg(a)?this.nd.oa(a):null};
Y.prototype.makeLinkDataKeyUnique=Y.prototype.dB=function(a){if(null!==a){var b=this.Fl;if(""!==b){var c=this.dg(a);if(void 0===c||this.nd.contains(c)){var d=this.yp;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.nd.contains(c))){D.Ua(a,b,c);return}if("string"===typeof c){for(d=2;this.nd.contains(c+d);)d++;D.Ua(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(d=-this.nd.count-1;this.nd.contains(d);)d--;D.Ua(a,b,d)}else D.k("GraphLinksModel.getKeyForLinkData returned something other than a string or a number: "+
c)}}}};Y.prototype.containsLinkData=Y.prototype.Lh=function(a){return null===a?!1:this.hi.contains(a)};Y.prototype.addLinkData=Y.prototype.Qt=function(a){null!==a&&(D.sq(a),this.Lh(a)||gh(this,a,!0))};
function gh(a,b,c){if(""!==a.Oj){var d=a.dg(b);if(void 0!==d&&a.nd.oa(d)===b)return;a.dB(b);d=a.dg(b);if(void 0===d){D.k("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");return}a.nd.add(d,b)}a.hi.add(b);d=null;c&&(d=D.cb(a.bf),D.Ih(a.bf,d,b));Ug(a,"linkDataArray",mg,"linkDataArray",a,null,b,null,d);fh(a,b)}Y.prototype.addLinkDataCollection=function(a){if(D.isArray(a))for(var b=D.cb(a),c=0;c<b;c++)this.Qt(D.La(a,c));else for(a=a.j;a.next();)this.Qt(a.value)};
Y.prototype.removeLinkData=Y.prototype.xy=function(a){null!==a&&hh(this,a,!0)};function hh(a,b,c){a.hi.remove(b);var d=a.dg(b);void 0!==d&&a.nd.remove(d);d=null;if(c){d=D.$l(a.bf,b);if(0>d)return;D.Sg(a.bf,d)}Ug(a,"linkDataArray",ng,"linkDataArray",a,b,null,d,null);c=a.om(b);ah(a,c,b);c=a.pm(b);ah(a,c,b);d=a.Sk(b);if(D.isArray(d))for(var e=D.cb(d),g=0;g<e;g++)c=D.La(d,g),ah(a,c,b)}
Y.prototype.removeLinkDataCollection=function(a){if(D.isArray(a))for(var b=D.cb(a),c=0;c<b;c++)this.xy(D.La(a,c));else for(a=a.j;a.next();)this.xy(a.value)};function fh(a,b){var c=a.om(b),c=a.fo(c);null===a.Fe(c)&&$g(a,c,b);c=a.pm(b);c=a.fo(c);null===a.Fe(c)&&$g(a,c,b);var d=a.Sk(b);if(D.isArray(d))for(var e=D.cb(d),g=0;g<e;g++)c=D.La(d,g),null===a.Fe(c)&&$g(a,c,b)}
D.defineProperty(Y,{eL:"copyLinkDataFunction"},function(){return this.Oo},function(a){var b=this.Oo;b!==a&&(null!==a&&D.h(a,"function",Y,"copyLinkDataFunction"),this.Oo=a,this.i("copyLinkDataFunction",b,a))});Y.prototype.copyLinkData=Y.prototype.vx=function(a){if(null===a)return null;var b=null,b=this.Oo,b=null!==b?b(a,this):bh(this,a,!0);D.Ta(b)&&(D.tc(b),""!==this.ii&&D.Ua(b,this.ii,void 0),""!==this.ji&&D.Ua(b,this.ji,void 0),""!==this.Gg&&D.Ua(b,this.Gg,[]));return b};
D.defineProperty(Y,{Nu:"nodeIsGroupProperty"},function(){return this.Bp},function(a){var b=this.Bp;b!==a&&(Vg(a,Y,"nodeIsGroupProperty"),this.Bp=a,this.i("nodeIsGroupProperty",b,a))});Y.prototype.isGroupForNodeData=Y.prototype.ZA=function(a){if(null===a)return!1;var b=this.Bp;return""===b?!1:D.ub(a,b)?!0:!1};D.defineProperty(Y,{Mu:"nodeGroupKeyProperty"},function(){return this.zh},function(a){var b=this.zh;b!==a&&(Vg(a,Y,"nodeGroupKeyProperty"),this.zh=a,this.i("nodeGroupKeyProperty",b,a))});
D.defineProperty(Y,{In:"copiesGroupKeyOfNodeData"},function(){return this.vr},function(a){this.vr!==a&&(D.h(a,"boolean",Y,"copiesGroupKeyOfNodeData"),this.vr=a)});Y.prototype.getGroupKeyForNodeData=Y.prototype.Sn=function(a){if(null!==a){var b=this.zh;if(""!==b&&(b=D.ub(a,b),void 0!==b)){if(Wg(b))return b;D.k("GroupKey value for node data "+a+" is not a number or a string: "+b)}}};
Y.prototype.setGroupKeyForNodeData=Y.prototype.DB=function(a,b){null===b&&(b=void 0);void 0===b||Wg(b)||D.gc(b,"number or string",Y,"setGroupKeyForNodeData:key");if(null!==a){var c=this.zh;if(""!==c)if(this.ie(a)){var d=D.ub(a,c);d!==b&&(ah(this,d,a),D.Ua(a,c,b),null===this.Fe(b)&&$g(this,b,a),Ug(this,"nodeGroupKey",cg,c,a,d,b),"string"===typeof c&&this.Nb(a,c))}else D.Ua(a,c,b)}};
Y.prototype.copyNodeData=function(a){if(null===a)return null;a=M.prototype.copyNodeData.call(this,a);this.In||""===this.zh||void 0===D.ub(a,this.zh)||D.Ua(a,this.zh,void 0);return a};
Y.prototype.setDataProperty=function(a,b,c){v&&(D.h(a,"object",Y,"setDataProperty:data"),D.h(b,"string",Y,"setDataProperty:propname"),""===b&&D.k("GraphLinksModel.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.ie(a))if(b===this.Rj)this.Gy(a,c);else{if(b===this.no){this.Ey(a,c);return}if(b===this.Mu){this.DB(a,c);return}b===this.Nu&&D.k("GraphLinksModel.setDataProperty: property name must not be the nodeIsGroupProperty: "+b)}else if(this.Lh(a)){if(b===
this.co){this.BB(a,c);return}if(b===this.eo){this.HB(a,c);return}if(b===this.Du){this.CB(a,c);return}if(b===this.Fu){this.IB(a,c);return}if(b===this.Oj){this.PG(a,c);return}if(b===this.Cu){this.OG(a,c);return}if(b===this.Eu){this.QG(a,c);return}}else!eh&&a instanceof P&&(eh=!0,D.trace('GraphLinksModel.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),D.trace("  Is that really your intent?"));var d=D.ub(a,b);d!==c&&(D.Ua(a,b,c),this.rB(a,b,d,c))};f=Y.prototype;
f.Tu=function(a,b){M.prototype.Tu.call(this,a,b);for(var c=this.Ec.j;c.next();)this.wB(c.value,a,b);for(c=this.hi.j;c.next();){var d=c.value,e=a,g=b;if(this.om(d)===e){var h=this.ii;D.Ua(d,h,g);Ug(this,"linkFromKey",cg,h,d,e,g);"string"===typeof h&&this.Nb(d,h)}this.pm(d)===e&&(h=this.ji,D.Ua(d,h,g),Ug(this,"linkToKey",cg,h,d,e,g),"string"===typeof h&&this.Nb(d,h));h=this.Sk(d);if(D.isArray(h))for(var k=D.cb(h),l=this.Gg,m=0;m<k;m++)D.La(h,m)===e&&(D.JE(h,m,g),Ug(this,"linkLabelKeys",mg,l,d,e,g,m,
m))}};f.wB=function(a,b,c){if(this.Sn(a)===b){var d=this.zh;D.Ua(a,d,c);Ug(this,"nodeGroupKey",cg,d,a,b,c);"string"===typeof d&&this.Nb(a,d)}};f.WB=function(){M.prototype.WB.call(this);for(var a=this.Yg,b=D.cb(a),c=0;c<b;c++){var d=D.La(a,c);fh(this,d)}};
f.Jq=function(a){M.prototype.Jq.call(this,a);a=this.Cb(a);var b=Zg(this,a);if(null!==b){for(var c=new K(Object),b=b.j;b.next();){var d=b.value;if(this.ie(d)){if(this.Sn(d)===a){var e=this.zh;Ug(this,"nodeGroupKey",cg,e,d,a,a);"string"===typeof e&&this.Nb(d,e);c.add(d)}}else if(this.om(d)===a&&(e=this.ii,Ug(this,"linkFromKey",cg,e,d,a,a),"string"===typeof e&&this.Nb(d,e),c.add(d)),this.pm(d)===a&&(e=this.ji,Ug(this,"linkToKey",cg,e,d,a,a),"string"===typeof e&&this.Nb(d,e),c.add(d)),e=this.Sk(d),D.isArray(e))for(var g=
D.cb(e),h=this.Gg,k=0;k<g;k++)D.La(e,k)===a&&(Ug(this,"linkLabelKeys",mg,h,d,a,a,k,k),c.add(d))}for(c=c.j;c.next();)ah(this,a,c.value)}};f.Iq=function(a){M.prototype.Iq.call(this,a);var b=this.Sn(a);null===this.Fe(b)&&$g(this,b,a)};f.hv=function(a){M.prototype.hv.call(this,a);var b=this.Sn(a);ah(this,b,a)};D.defineProperty(Y,{Cu:"linkCategoryProperty"},function(){return this.$m},function(a){var b=this.$m;b!==a&&(Vg(a,Y,"linkCategoryProperty"),this.$m=a,this.i("linkCategoryProperty",b,a))});
Y.prototype.getCategoryForLinkData=Y.prototype.Lx=function(a){if(null===a)return"";var b=this.$m;if(""===b)return"";b=D.ub(a,b);if(void 0===b)return"";if("string"===typeof b)return b;D.k("getCategoryForLinkData found a non-string category for "+a+": "+b);return""};
Y.prototype.setCategoryForLinkData=Y.prototype.OG=function(a,b){D.h(b,"string",Y,"setCategoryForLinkData:cat");if(null!==a){var c=this.$m;if(""!==c)if(this.Lh(a)){var d=D.ub(a,c);void 0===d&&(d="");d!==b&&(D.Ua(a,c,b),Ug(this,"linkCategory",cg,c,a,d,b),"string"===typeof c&&this.Nb(a,c))}else D.Ua(a,c,b)}};
function wg(a){1<arguments.length&&D.k("TreeModel constructor can only take one optional argument, the Array of node data.");M.call(this);this.Ah="parent";this.wr=!1;this.jn="parentLinkCategory";void 0!==a&&(this.mg=a)}D.Sa(wg,M);D.ja("TreeModel",wg);wg.prototype.cloneProtected=function(a){M.prototype.cloneProtected.call(this,a);a.Ah=this.Ah;a.wr=this.wr;a.jn=this.jn};
wg.prototype.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.OB();var b=(""!==this.name?this.name:"")+" TreeModel";if(0<a){b+="\n node data:";a=this.mg;for(var c=D.cb(a),d=0;d<c;d++)var e=D.La(a,d),b=b+(" "+this.Cb(e)+":"+ja(e))}return b};wg.prototype.zo=function(){var a=M.prototype.zo.call(this),b="";"parent"!==this.Ou&&"string"===typeof this.Ou&&(b+=',\n  "nodeParentKeyProperty": '+this.quote(this.Ou));return a+b};
wg.prototype.Ru=function(a){M.prototype.Ru.call(this,a);a.nodeParentKeyProperty&&(this.Ou=a.nodeParentKeyProperty)};wg.prototype.fo=function(a){return a};D.defineProperty(wg,{Ou:"nodeParentKeyProperty"},function(){return this.Ah},function(a){var b=this.Ah;b!==a&&(Vg(a,wg,"nodeParentKeyProperty"),this.Ah=a,this.i("nodeParentKeyProperty",b,a))});
D.defineProperty(wg,{Jn:"copiesParentKeyOfNodeData"},function(){return this.wr},function(a){this.wr!==a&&(D.h(a,"boolean",wg,"copiesParentKeyOfNodeData"),this.wr=a)});wg.prototype.getParentKeyForNodeData=wg.prototype.Un=function(a){if(null!==a){var b=this.Ah;if(""!==b&&(b=D.ub(a,b),void 0!==b)){if(Wg(b))return b;D.k("ParentKey value for node data "+a+" is not a number or a string: "+b)}}};
wg.prototype.setParentKeyForNodeData=wg.prototype.Hi=function(a,b){null===b&&(b=void 0);void 0===b||Wg(b)||D.gc(b,"number or string",wg,"setParentKeyForNodeData:key");if(null!==a){var c=this.Ah;if(""!==c)if(b=this.fo(b),this.ie(a)){var d=D.ub(a,c);d!==b&&(ah(this,d,a),D.Ua(a,c,b),null===this.Fe(b)&&$g(this,b,a),Ug(this,"nodeParentKey",cg,c,a,d,b),"string"===typeof c&&this.Nb(a,c))}else D.Ua(a,c,b)}};
D.defineProperty(wg,{jM:"parentLinkCategoryProperty"},function(){return this.jn},function(a){var b=this.jn;b!==a&&(Vg(a,wg,"parentLinkCategoryProperty"),this.jn=a,this.i("parentLinkCategoryProperty",b,a))});wg.prototype.getParentLinkCategoryForNodeData=wg.prototype.MI=function(a){if(null===a)return"";var b=this.jn;if(""===b)return"";b=D.ub(a,b);if(void 0===b)return"";if("string"===typeof b)return b;D.k("getParentLinkCategoryForNodeData found a non-string category for "+a+": "+b);return""};
wg.prototype.setParentLinkCategoryForNodeData=wg.prototype.gK=function(a,b){D.h(b,"string",wg,"setParentLinkCategoryForNodeData:cat");if(null!==a){var c=this.jn;if(""!==c)if(this.ie(a)){var d=D.ub(a,c);void 0===d&&(d="");d!==b&&(D.Ua(a,c,b),Ug(this,"parentLinkCategory",cg,c,a,d,b),"string"===typeof c&&this.Nb(a,c))}else D.Ua(a,c,b)}};
wg.prototype.copyNodeData=function(a){if(null===a)return null;a=M.prototype.copyNodeData.call(this,a);this.Jn||""===this.Ah||void 0===D.ub(a,this.Ah)||D.Ua(a,this.Ah,void 0);return a};
wg.prototype.setDataProperty=function(a,b,c){v&&(D.h(a,"object",wg,"setDataProperty:data"),D.h(b,"string",wg,"setDataProperty:propname"),""===b&&D.k("TreeModel.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.ie(a))if(b===this.Rj)this.Gy(a,c);else{if(b===this.no){this.Ey(a,c);return}if(b===this.Ou){this.Hi(a,c);return}}else!eh&&a instanceof P&&(eh=!0,D.trace('TreeModel.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),D.trace("  Is that really your intent?"));
var d=D.ub(a,b);d!==c&&(D.Ua(a,b,c),this.rB(a,b,d,c))};f=wg.prototype;f.Tu=function(a,b){M.prototype.Tu.call(this,a,b);for(var c=this.Ec.j;c.next();)this.wB(c.value,a,b)};f.wB=function(a,b,c){if(this.Un(a)===b){var d=this.Ah;D.Ua(a,d,c);Ug(this,"nodeParentKey",cg,d,a,b,c);"string"===typeof d&&this.Nb(a,d)}};
f.Jq=function(a){M.prototype.Jq.call(this,a);a=this.Cb(a);var b=Zg(this,a);if(null!==b){for(var c=new K(Object),b=b.j;b.next();){var d=b.value;if(this.ie(d)&&this.Un(d)===a){var e=this.Ah;Ug(this,"nodeParentKey",cg,e,d,a,a);"string"===typeof e&&this.Nb(d,e);c.add(d)}}for(c=c.j;c.next();)ah(this,a,c.value)}};f.Iq=function(a){M.prototype.Iq.call(this,a);var b=this.Un(a),b=this.fo(b);null===this.Fe(b)&&$g(this,b,a)};f.hv=function(a){M.prototype.hv.call(this,a);var b=this.Un(a);ah(this,b,a)};
function ih(a,b,c){D.tc(this);this.J=!1;void 0===a?a="":D.h(a,"string",ih,"constructor:targetprop");void 0===b?b=a:D.h(b,"string",ih,"constructor:sourceprop");void 0===c?c=null:null!==c&&D.h(c,"function",ih,"constructor:conv");this.dE=-1;this.Og=null;this.Vp=a;this.Up=this.Et=0;this.Tw=null;this.ls=!1;this.Mp=b;this.sr=c;this.Es=jh;this.lr=null;this.zz=new L}D.ja("Binding",ih);
ih.prototype.copy=function(){var a=new ih;a.Vp=this.Vp;a.Et=this.Et;a.Up=this.Up;a.Tw=this.Tw;a.ls=this.ls;a.Mp=this.Mp;a.sr=this.sr;a.Es=this.Es;a.lr=this.lr;return a};var jh;ih.OneWay=jh=D.s(ih,"OneWay",1);var kh;ih.TwoWay=kh=D.s(ih,"TwoWay",2);ih.parseEnum=function(a,b){D.h(a,"function",ih,"parseEnum:ctor");D.Ca(b,a,ih,"parseEnum:defval");return function(c){c=Ha(a,c);return null===c?b:c}};ih.prototype.nc=function(a){a.Ne===ih?this.mode=a:D.Xj(this,a)};var ja;
ih.toString=ja=function(a){var b=a;D.Ta(a)&&(a.text?b=a.text:a.name?b=a.name:void 0!==a.key?b=a.key:void 0!==a.id?b=a.id:a.constructor===Object&&(a.Text?b=a.Text:a.Name?b=a.Name:void 0!==a.Key?b=a.Key:void 0!==a.Id?b=a.Id:void 0!==a.ID&&(b=a.ID)));return void 0===b?"undefined":null===b?"null":b.toString()};ih.prototype.toString=function(){return"Binding("+this.ev+":"+this.TG+(-1!==this.Bm?" "+this.Bm:"")+" "+this.mode.name+")"};ih.prototype.freeze=function(){this.J=!0;return this};
ih.prototype.Ya=function(){this.J=!1;return this};D.defineProperty(ih,{Bm:null},function(){return this.dE},function(a){this.J&&D.pa(this);D.h(a,"number",ih,"targetId");this.dE=a});D.defineProperty(ih,{ev:"targetProperty"},function(){return this.Vp},function(a){this.J&&D.pa(this);D.h(a,"string",ih,"targetProperty");this.Vp=a});D.defineProperty(ih,{Vq:"sourceName"},function(){return this.Tw},function(a){this.J&&D.pa(this);null!==a&&D.h(a,"string",ih,"sourceName");this.Tw=a;null!==a&&(this.ls=!1)});
D.defineProperty(ih,{Yx:"isToModel"},function(){return this.ls},function(a){this.J&&D.pa(this);D.h(a,"boolean",ih,"isToModel");this.ls=a});D.defineProperty(ih,{TG:"sourceProperty"},function(){return this.Mp},function(a){this.J&&D.pa(this);D.h(a,"string",ih,"sourceProperty");this.Mp=a});D.defineProperty(ih,{gI:"converter"},function(){return this.sr},function(a){this.J&&D.pa(this);null!==a&&D.h(a,"function",ih,"converter");this.sr=a});
D.defineProperty(ih,{UH:"backConverter"},function(){return this.lr},function(a){this.J&&D.pa(this);null!==a&&D.h(a,"function",ih,"backConverter");this.lr=a});D.defineProperty(ih,{mode:"mode"},function(){return this.Es},function(a){this.J&&D.pa(this);D.Ca(a,ih,ih,"mode");this.Es=a});ih.prototype.makeTwoWay=ih.prototype.xJ=function(a){void 0===a&&(a=null);null!==a&&D.h(a,"function",ih,"makeTwoWay");this.mode=kh;this.UH=a;return this};
ih.prototype.ofObject=ih.prototype.ly=function(a){void 0===a&&(a="");v&&D.h(a,"string",ih,"ofObject:srcname");this.Vq=a;this.Yx=!1;return this};ih.prototype.ofModel=function(){this.Vq=null;this.Yx=!0;return this};function lh(a,b,c){a=a.Vq;var d=null;return d=null===a||""===a?b:"/"===a?c.Y:"."===a?c:".."===a?c.Q:b.Ed(a)}
ih.prototype.updateTarget=ih.prototype.iH=function(a,b,c){var d=this.Mp;if(void 0===c||""===d||d===c){c=this.Vp;var e=this.sr;if(null===e&&""===c)D.trace("Binding error: target property is the empty string: "+this.toString());else{v&&"string"===typeof c&&("function"!==typeof a.setAttribute&&0<c.length&&"_"!==c[0]&&!D.Px(a,c)?D.trace("Binding error: undefined target property: "+c+" on "+a.toString()):"name"===c&&a instanceof P&&D.trace("Binding error: cannot modify GraphObject.name on "+a.toString()));
var g=b;""!==d&&(g=D.ub(b,d));if(void 0!==g)if(null===e)""!==c&&D.Ua(a,c,g);else try{if(""!==c){var h=e(g,a);v&&void 0===h&&D.trace('Binding warning: conversion function returned undefined when setting target property "'+c+'" on '+a.toString()+", function is: "+e);D.Ua(a,c,h)}else e(g,a)}catch(k){v&&D.trace("Binding error: "+k.toString()+' setting target property "'+c+'" on '+a.toString()+" with conversion function: "+e)}}}};
ih.prototype.updateSource=ih.prototype.Jy=function(a,b,c,d){if(this.Es===kh){var e=this.Vp;if(void 0===c||e===c){c=this.Mp;var g=this.lr,h=a;""!==e&&(h=D.ub(a,e));if(void 0!==h&&!this.zz.contains(a))try{this.zz.add(a);var k=null!==d?d.g:null,l=null!==k?k.ga:null;if(null===g)if(""!==c)null!==l?(v&&l.Rj===c&&l.ie(b)&&D.trace("Binding error: cannot have TwoWay Binding on node data key property: "+this.toString()),l.setDataProperty(b,c,h)):D.Ua(b,c,h);else{if(null!==l&&null!==d&&0<=d.Au&&null!==d.Q&&
Array.isArray(d.Q.Xk)){var m=d.Au,n=d.Q.Xk;l.sG(n,m);l.WA(n,m,h)}}else try{if(""!==c){var p=g(h,b,l);null!==l?(v&&(l.Rj===c&&l.ie(b)&&D.trace("Binding error: cannot have TwoWay Binding on node data key property: "+this.toString()),void 0===p&&D.trace('Binding warning: conversion function returned undefined when setting source property "'+c+'" on '+b.toString()+", function is: "+g)),l.setDataProperty(b,c,p)):D.Ua(b,c,p)}else p=g(h,b,l),void 0!==p&&null!==l&&null!==d&&0<=d.Au&&null!==d.Q&&Array.isArray(d.Q.Xk)&&
(m=d.Au,n=d.Q.Xk,l.sG(n,m),l.WA(n,m,p))}catch(q){v&&D.trace("Binding error: "+q.toString()+' setting source property "'+c+'" on '+b.toString()+" with conversion function: "+g)}}finally{this.zz.remove(a)}}}};function xg(){this.oH=(new K(bg)).freeze();this.Xb="";this.hD=!1}D.ja("Transaction",xg);
xg.prototype.toString=function(a){var b="Transaction: "+this.name+" "+this.ag.count.toString()+(this.uu?"":", incomplete");if(void 0!==a&&0<a){a=this.ag.count;for(var c=0;c<a;c++){var d=this.ag.ea(c);null!==d&&(b+="\n  "+d.toString())}}return b};xg.prototype.clear=xg.prototype.clear=function(){var a=this.ag;a.Ya();for(var b=a.count-1;0<=b;b--){var c=a.ea(b);null!==c&&c.clear()}a.clear();a.freeze()};xg.prototype.canUndo=xg.prototype.canUndo=function(){return this.uu};
xg.prototype.undo=xg.prototype.undo=function(){if(this.canUndo())for(var a=this.ag.count-1;0<=a;a--){var b=this.ag.ea(a);null!==b&&b.undo()}};xg.prototype.canRedo=xg.prototype.canRedo=function(){return this.uu};xg.prototype.redo=xg.prototype.redo=function(){if(this.canRedo())for(var a=this.ag.count,b=0;b<a;b++){var c=this.ag.ea(b);null!==c&&c.redo()}};D.w(xg,{ag:"changes"},function(){return this.oH});D.defineProperty(xg,{name:"name"},function(){return this.Xb},function(a){this.Xb=a});
D.defineProperty(xg,{uu:"isComplete"},function(){return this.hD},function(a){this.hD=a});function og(){this.Pz=new L(M);this.mf=!1;this.sH=(new K(xg)).freeze();this.sh=-1;this.wD=999;this.bj=!1;this.Kv=null;this.Sl=0;this.ez=!1;v&&(this.ez=!0);this.yh=(new K("string")).freeze();this.Ap=new K("number");this.Az=!0;this.Kz=!1}D.ja("UndoManager",og);
og.prototype.toString=function(a){for(var b="UndoManager "+this.Hj+"<"+this.history.count+"<="+this.cG,b=b+"[",c=this.hG.count,d=0;d<c;d++)0<d&&(b+=" "),b+=this.hG.ea(d);b+="]";if(void 0!==a&&0<a)for(c=this.history.count,d=0;d<c;d++)b+="\n "+this.history.ea(d).toString(a-1);return b};
og.prototype.clear=og.prototype.clear=function(){var a=this.history;a.Ya();for(var b=a.count-1;0<=b;b--){var c=a.ea(b);null!==c&&c.clear()}a.clear();this.sh=-1;a.freeze();this.bj=!1;this.Kv=null;this.Sl=0;this.yh.Ya();this.yh.clear();this.yh.freeze();this.Ap.clear()};og.prototype.addModel=og.prototype.MH=function(a){this.Pz.add(a)};og.prototype.removeModel=og.prototype.WJ=function(a){this.Pz.remove(a)};
og.prototype.startTransaction=og.prototype.$b=function(a){void 0===a&&(a="");null===a&&(a="");if(this.nb)return!1;!0===this.Az&&(this.Az=!1,this.Sl++,this.pd("StartingFirstTransaction",a,this.Cj),0<this.Sl&&this.Sl--);this.isEnabled&&(this.yh.Ya(),this.yh.add(a),this.yh.freeze(),null===this.Cj?this.Ap.add(0):this.Ap.add(this.Cj.ag.count));this.Sl++;var b=1===this.Vh;b&&this.pd("StartedTransaction",a,this.Cj);return b};
og.prototype.commitTransaction=og.prototype.Td=function(a){void 0===a&&(a="");return mh(this,!0,a)};og.prototype.rollbackTransaction=og.prototype.Kq=function(){return mh(this,!1,"")};
function mh(a,b,c){if(a.nb)return!1;a.rA&&1>a.Vh&&D.trace("Ending transaction without having started a transaction: "+c);var d=1===a.Vh;d&&b&&a.pd("CommittingTransaction",c,a.Cj);var e=0;if(0<a.Vh&&(a.Sl--,a.isEnabled)){var g=a.yh.count;0<g&&(""===c&&(c=a.yh.ea(0)),a.yh.Ya(),a.yh.jd(g-1),a.yh.freeze());g=a.Ap.count;0<g&&(e=a.Ap.ea(g-1),a.Ap.jd(g-1))}g=a.Cj;if(d){if(b){a.Kz=!1;if(a.isEnabled&&null!==g){b=g;b.uu=!0;b.name=c;d=a.history;d.Ya();for(e=d.count-1;e>a.Hj;e--)g=d.ea(e),null!==g&&g.clear(),
d.jd(e),a.Kz=!0;e=a.cG;0===e&&(e=1);0<e&&d.count>=e&&(g=d.ea(0),null!==g&&g.clear(),d.jd(0),a.sh--);d.add(b);a.sh++;d.freeze();g=b}a.pd("CommittedTransaction",c,g)}else{a.bj=!0;try{a.isEnabled&&null!==g&&(g.uu=!0,g.undo())}finally{a.pd("RolledBackTransaction",c,g),a.bj=!1}null!==g&&g.clear()}a.Kv=null;return!0}if(a.isEnabled&&!b&&null!==g){a=e;c=g.ag;for(b=c.count-1;b>=a;b--)d=c.ea(b),null!==d&&d.undo(),c.Ya(),c.jd(b);c.freeze()}return!1}
og.prototype.canUndo=og.prototype.canUndo=function(){if(!this.isEnabled||0<this.Vh||this.nb)return!1;var a=this.eH;return null!==a&&a.canUndo()?!0:!1};og.prototype.undo=og.prototype.undo=function(){if(this.canUndo()){var a=this.eH;try{this.pd("StartingUndo","Undo",a),this.bj=!0,this.sh--,a.undo()}catch(b){D.trace("undo error: "+b.toString())}finally{this.bj=!1,this.pd("FinishedUndo","Undo",a)}}};
og.prototype.canRedo=og.prototype.canRedo=function(){if(!this.isEnabled||0<this.Vh||this.nb)return!1;var a=this.dH;return null!==a&&a.canRedo()?!0:!1};og.prototype.redo=og.prototype.redo=function(){if(this.canRedo()){var a=this.dH;try{this.pd("StartingRedo","Redo",a),this.bj=!0,this.sh++,a.redo()}catch(b){D.trace("redo error: "+b.toString())}finally{this.bj=!1,this.pd("FinishedRedo","Redo",a)}}};
og.prototype.pd=function(a,b,c){void 0===c&&(c=null);var d=new bg;d.Ic=dg;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.HJ;a.next();)b=a.value,d.ga=b,b.qx(d)};og.prototype.handleChanged=og.prototype.EF=function(a){if(this.isEnabled&&!this.nb&&!this.skipsEvent(a)){var b=this.Cj;null===b&&(this.Kv=b=new xg);var c=a.copy(),b=b.ag;b.Ya();b.add(c);b.freeze();this.rA&&0>=this.Vh&&!this.Az&&(a=a.g,null!==a&&!1===a.Zn||D.trace("Change not within a transaction: "+c.toString()))}};
og.prototype.skipsEvent=function(a){if(null===a||0>a.Ic.value)return!0;a=a.object;if(a instanceof P){if(a=a.layer,null!==a&&a.Tc)return!0}else if(a instanceof Rg&&a.Tc)return!0;return!1};D.w(og,{HJ:"models"},function(){return this.Pz.j});D.defineProperty(og,{isEnabled:"isEnabled"},function(){return this.mf},function(a){this.mf=a});D.w(og,{eH:"transactionToUndo"},function(){return 0<=this.Hj&&this.Hj<=this.history.count-1?this.history.ea(this.Hj):null});
D.w(og,{dH:"transactionToRedo"},function(){return this.Hj<this.history.count-1?this.history.ea(this.Hj+1):null});D.w(og,{nb:"isUndoingRedoing"},function(){return this.bj});D.w(og,{history:"history"},function(){return this.sH});D.defineProperty(og,{cG:"maxHistoryLength"},function(){return this.wD},function(a){this.wD=a});D.w(og,{Hj:"historyIndex"},function(){return this.sh});D.w(og,{Cj:"currentTransaction"},function(){return this.Kv});D.w(og,{Vh:"transactionLevel"},function(){return this.Sl});
D.w(og,{RF:"isInTransaction"},function(){return 0<this.Sl});D.defineProperty(og,{rA:"checksTransactionLevel"},function(){return this.ez},function(a){this.ez=a});D.w(og,{hG:"nestedTransactionNames"},function(){return this.yh});function oa(){0<arguments.length&&D.td(oa);D.tc(this);this.ba=null;this.tC=!1;this.OC=this.uC=!0;this.wC=this.xC=this.PC=this.yC=!1;this.Il=this.Zy=null;this.wE=1.05;this.LC=1;this.Lz=NaN;this.sD=null;this.lA=NaN;this.kA=Hd;this.sj=null}D.ja("CommandHandler",oa);
var nh=null,Gh="";oa.prototype.toString=function(){return"CommandHandler"};D.w(oa,{g:"diagram"},function(){return this.ba});oa.prototype.Xc=function(a){v&&null!==a&&D.l(a,E,oa,"setDiagram");this.ba=a};
oa.prototype.doKeyDown=function(){var a=this.g;if(null!==a){var b=a.U,c=D.Vk?b.Hu:b.control,d=b.shift,e=b.alt,g=b.key;!c||"C"!==g&&"Insert"!==g?c&&"X"===g||d&&"Del"===g?this.canCutSelection()&&this.cutSelection():c&&"V"===g||d&&"Insert"===g?this.canPasteSelection()&&this.pasteSelection():c&&"Y"===g||e&&d&&"Backspace"===g?this.canRedo()&&this.redo():c&&"Z"===g||e&&"Backspace"===g?this.canUndo()&&this.undo():"Del"===g||"Backspace"===g?this.canDeleteSelection()&&this.deleteSelection():c&&"A"===g?this.canSelectAll()&&
this.selectAll():"Esc"===g?this.canStopCommand()&&this.stopCommand():"Up"===g?a.ze&&(c?a.scroll("pixel","up"):a.scroll("line","up")):"Down"===g?a.ze&&(c?a.scroll("pixel","down"):a.scroll("line","down")):"Left"===g?a.ye&&(c?a.scroll("pixel","left"):a.scroll("line","left")):"Right"===g?a.ye&&(c?a.scroll("pixel","right"):a.scroll("line","right")):"PageUp"===g?d&&a.ye?a.scroll("page","left"):a.ze&&a.scroll("page","up"):"PageDown"===g?d&&a.ye?a.scroll("page","right"):a.ze&&a.scroll("page","down"):"Home"===
g?c&&a.ze?a.scroll("document","up"):!c&&a.ye&&a.scroll("document","left"):"End"===g?c&&a.ze?a.scroll("document","down"):!c&&a.ye&&a.scroll("document","right"):" "===g?this.canScrollToPart()&&this.scrollToPart():"Subtract"===g?this.canDecreaseZoom()&&this.decreaseZoom():"Add"===g?this.canIncreaseZoom()&&this.increaseZoom():c&&"0"===g?this.canResetZoom()&&this.resetZoom():d&&"Z"===g?this.canZoomToFit()&&this.zoomToFit():c&&!d&&"G"===g?this.canGroupSelection()&&this.groupSelection():c&&d&&"G"===g?this.canUngroupSelection()&&
this.ungroupSelection():b.event&&113===b.event.which?this.canEditTextBlock()&&this.editTextBlock():b.event&&93===b.event.which?this.canShowContextMenu()&&this.showContextMenu():b.bubbles=!0:this.canCopySelection()&&this.copySelection()}};oa.prototype.doKeyUp=function(){var a=this.g;null!==a&&(a.U.bubbles=!0)};oa.prototype.stopCommand=function(){var a=this.g;if(null!==a){var b=a.gb;b instanceof Hh&&a.Bf&&a.tx();null!==b&&b.doCancel()}};oa.prototype.canStopCommand=function(){return!0};
oa.prototype.selectAll=function(){var a=this.g;if(null!==a){a.qa();try{a.jc="wait";a.Ja("ChangingSelection");for(var b=a.Gi;b.next();)b.value.hb=!0;for(var c=a.ng;c.next();)c.value.hb=!0;for(var d=a.links;d.next();)d.value.hb=!0}finally{a.Ja("ChangedSelection"),a.jc=""}}};oa.prototype.canSelectAll=function(){var a=this.g;return null!==a&&a.Bf};
oa.prototype.deleteSelection=function(){var a=this.g;if(null!==a&&!a.Ja("SelectionDeleting",a.selection))try{a.jc="wait";a.$b("Delete");a.Ja("ChangingSelection");for(var b=new L(F),c=a.selection.j;c.next();)Ih(b,c.value,!0,this.pI?Infinity:0,this.bF,function(a){return a.canDelete()});a.vB(b,!0);a.Ja("SelectionDeleted",b)}finally{a.Ja("ChangedSelection"),a.Td("Delete"),a.jc=""}};oa.prototype.canDeleteSelection=function(){var a=this.g;return null===a||a.mb||a.Ff||!a.Bn||0===a.selection.count?!1:!0};
function Ih(a,b,c,d,e,g){void 0===g&&(g=null);if(!(a.contains(b)||null!==g&&!g(b)||b instanceof da))if(a.add(b),b instanceof G){if(c&&b instanceof I)for(var h=b.Mc;h.next();)Ih(a,h.value,c,d,e,g);if(e)for(h=b.Gd;h.next();){var k=h.value;if(!a.contains(k)){var l=k.aa,m=k.da;null!==l&&a.contains(l)&&null!==m&&a.contains(m)?Ih(a,k,c,d,e,g):null!==l&&null!==m||Ih(a,k,c,d,e,g)}}if(1<d)for(b=b.qF();b.next();)Ih(a,b.value,c,d-1,e,g)}else if(b instanceof J)for(b=b.If;b.next();)Ih(a,b.value,c,d,e,g)}
oa.prototype.hq=function(a,b,c){var d=new ma(F,F);for(a=a.j;a.next();)Jh(this,a.value,b,d,c);if(null!==b){c=b.ga;a=!1;null!==b.kb.De&&(a=b.kb.De.Ej);for(var e=new L(J),g=new ma(J,J),h=d.j;h.next();){var k=h.value;if(k instanceof J){var l=k;a||null!==l.aa&&null!==l.da||e.add(l)}else if(c instanceof wg&&k instanceof G&&null!==k.data){var l=c,m=k,k=h.key,n=k.mm();null!==n&&(n=d.oa(n),null!==n?(l.Hi(m.data,l.Cb(n.data)),l=b.bg(m.data),k=k.Pn(),null!==k&&null!==l&&g.add(k,l)):l.Hi(m.data,void 0))}}0<e.count&&
b.vB(e,!1);if(0<g.count)for(c=g.j;c.next();)d.add(c.key,c.value)}if(null!==b&&null!==this.g&&(b=b.ga,c=b.OH,null!==c)){var p=new ma;d.each(function(a){null!==a.key.data&&p.add(a.key.data,a.value.data)});c(p,b,this.g.ga)}for(b=d.j;b.next();)b.value.Nb();return d};
function Jh(a,b,c,d,e){if(null===b||e&&!b.canCopy())return null;if(d.contains(b))return d.oa(b);var g=null,h=b.data;if(null!==h&&null!==c){var k=c.ga;b instanceof J?k instanceof Y&&(h=k.vx(h),D.Ta(h)&&(k.Qt(h),g=c.bg(h))):(h=k.copyNodeData(h),D.Ta(h)&&(k.Vl(h),g=c.Nh(h)))}else Kh(b),g=b.copy(),null!==g&&(null!==c?c.add(g):null!==h&&null!==a.g&&a.hI&&(k=a.g.ga,h=g instanceof J&&k instanceof Y?k.vx(h):k.copyNodeData(h),D.Ta(h)&&(g.data=h)));if(!(g instanceof F))return null;g.hb=!1;g.Xg=!1;d.add(b,g);
if(b instanceof G){for(h=b.Gd;h.next();){k=h.value;if(k.aa===b){var l=d.oa(k);null!==l&&(l.aa=g)}k.da===b&&(l=d.oa(k),null!==l&&(l.da=g))}if(b instanceof I&&g instanceof I)for(h=g,b=b.Mc;b.next();)k=Jh(a,b.value,c,d,e),k instanceof J||null===k||(k.Pa=h)}else if(b instanceof J&&g instanceof J)for(h=b.aa,null!==h&&(h=d.oa(h),null!==h&&(g.aa=h)),h=b.da,null!==h&&(h=d.oa(h),null!==h&&(g.da=h)),b=b.If;b.next();)h=Jh(a,b.value,c,d,e),null!==h&&h instanceof G&&(h.zc=g);return g}
oa.prototype.copySelection=function(){var a=this.g;if(null!==a){for(var b=new L(F),a=a.selection.j;a.next();)Ih(b,a.value,!0,this.kI?Infinity:0,this.iI,function(a){return a.canCopy()});this.copyToClipboard(b)}};oa.prototype.canCopySelection=function(){var a=this.g;return null!==a&&a.Kk&&a.nA&&0!==a.selection.count?!0:!1};oa.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};
oa.prototype.canCutSelection=function(){var a=this.g;return null!==a&&!a.mb&&!a.Ff&&a.Kk&&a.Bn&&a.nA&&0!==a.selection.count?!0:!1};oa.prototype.copyToClipboard=function(a){var b=this.g;if(null!==b){var c=null;if(null===a)nh=null,Gh="";else{var c=b.ga,d=!1,e=!1,g=null;try{if(c instanceof wg){var h=c,d=h.Jn;h.Jn=this.TE}c instanceof Y&&(h=c,e=h.In,h.In=this.SE);g=b.hq(a,null,!0)}finally{c instanceof wg&&(c.Jn=d),c instanceof Y&&(c.In=e),c=new K(F),c.Rc(g),nh=c,Gh=b.ga.fm}}b.Ja("ClipboardChanged",c)}};
oa.prototype.pasteFromClipboard=function(){var a=new L(F),b=nh;if(null===b)return a;var c=this.g;if(null===c||Gh!==c.ga.fm)return a;var d=c.ga,e=!1,g=!1,h=null;try{if(d instanceof wg){var k=d,e=k.Jn;k.Jn=this.TE}d instanceof Y&&(k=d,g=k.In,k.In=this.SE);h=c.hq(b,c,!1)}finally{for(d instanceof wg&&(d.Jn=e),d instanceof Y&&(d.In=g),b=h.j;b.next();)c=b.value,d=b.key,c.location.F()||(d.location.F()?c.location=d.location:!c.position.F()&&d.position.F()&&(c.position=d.position)),a.add(c)}return a};
oa.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.g;if(null!==b)try{b.jc="wait";b.$b("Paste");b.Ja("ChangingSelection");var c=this.pasteFromClipboard();0<c.count&&Lh(b);for(var d=c.j;d.next();)d.value.hb=!0;b.Ja("ChangedSelection");if(null!==a){var e=b.computePartsBounds(b.selection);if(e.F()){var g=b.kb.De;null===g&&(g=new Mh,g.Xc(b));var h=g.computeEffectiveCollection(b.selection);g.moveParts(h,new O(a.x-e.na,a.y-e.va),!1)}}b.Ja("ClipboardPasted",c)}finally{b.Td("Paste"),b.jc=
""}};oa.prototype.canPasteSelection=function(){var a=this.g;return null===a||a.mb||a.Ff||!a.Zp||!a.nA||null===nh||Gh!==a.ga.fm?!1:!0};oa.prototype.undo=function(){var a=this.g;null!==a&&a.ra.undo()};oa.prototype.canUndo=function(){var a=this.g;return null===a||a.mb||a.Ff?!1:a.FE&&a.ra.canUndo()};oa.prototype.redo=function(){var a=this.g;null!==a&&a.ra.redo()};oa.prototype.canRedo=function(){var a=this.g;return null===a||a.mb||a.Ff?!1:a.FE&&a.ra.canRedo()};
oa.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.My);D.p(a,oa,"decreaseZoom:factor");var b=this.g;null!==b&&b.am===Nh&&(a*=b.scale,a<b.Qh||a>b.Ph||(b.scale=a))};oa.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.My);D.p(a,oa,"canDecreaseZoom:factor");var b=this.g;if(null===b||b.am!==Nh)return!1;a*=b.scale;return a<b.Qh||a>b.Ph?!1:b.px};
oa.prototype.increaseZoom=function(a){void 0===a&&(a=this.My);D.p(a,oa,"increaseZoom:factor");var b=this.g;null!==b&&b.am===Nh&&(a*=b.scale,a<b.Qh||a>b.Ph||(b.scale=a))};oa.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.My);D.p(a,oa,"canIncreaseZoom:factor");var b=this.g;if(null===b||b.am!==Nh)return!1;a*=b.scale;return a<b.Qh||a>b.Ph?!1:b.px};oa.prototype.resetZoom=function(a){void 0===a&&(a=this.zx);D.p(a,oa,"resetZoom:newscale");var b=this.g;null===b||a<b.Qh||a>b.Ph||(b.scale=a)};
oa.prototype.canResetZoom=function(a){void 0===a&&(a=this.zx);D.p(a,oa,"canResetZoom:newscale");var b=this.g;return null===b||a<b.Qh||a>b.Ph?!1:b.px};oa.prototype.zoomToFit=function(){var a=this.g;if(null!==a){var b=a.scale,c=a.position;b===this.lA&&!isNaN(this.Lz)&&a.cd.O(this.kA)?(a.scale=this.Lz,a.position=this.sD,this.lA=NaN,this.kA=Hd):(this.Lz=b,this.sD=c.copy(),a.zoomToFit(),this.lA=a.scale,this.kA=a.cd.copy())}};oa.prototype.canZoomToFit=function(){var a=this.g;return null===a?!1:a.px};
oa.prototype.scrollToPart=function(a){void 0===a&&(a=null);null!==a&&D.l(a,F,oa,"part");var b=this.g;if(null!==b){if(null===a){try{null!==this.sj&&(this.sj.next()?a=this.sj.value:this.sj=null)}catch(c){this.sj=null}null===a&&(0<b.qm.count?this.sj=b.qm.j:0<b.selection.count&&(this.sj=b.selection.j),null!==this.sj&&this.sj.next()&&(a=this.sj.value))}if(null!==a){var d=b.Xa;d.oo("Scroll To Part");var e=b.position.copy();b.VH(a.$);e.Sc(b.position)&&d.Ii()}}};
oa.prototype.canScrollToPart=function(a){void 0===a&&(a=null);if(null!==a&&!(a instanceof F))return!1;a=this.g;return null===a||0===a.selection.count&&0===a.qm.count?!1:a.ye&&a.ze};
oa.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.g;if(null!==b)try{b.$b("Collapse Tree");b.Xa.oo("Collapse Tree");var c=new K(G);if(null!==a&&a.rd)a.collapseTree(),c.add(a);else for(var d=b.selection.j;d.next();){var e=d.value;e instanceof G&&(a=e,a.rd&&(a.collapseTree(),c.add(a)))}b.Ja("TreeCollapsed",c)}finally{b.Td("Collapse Tree")}};
oa.prototype.canCollapseTree=function(a){void 0===a&&(a=null);var b=this.g;if(null===b||b.mb)return!1;if(null!==a){if(!(a instanceof G&&a.rd))return!1;if(0<a.Jx().count)return!0}else for(a=b.selection.j;a.next();)if(b=a.value,b instanceof G&&b.rd&&0<b.Jx().count)return!0;return!1};
oa.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.g;if(null!==b)try{b.$b("Expand Tree");b.Xa.oo("Expand Tree");var c=new K(G);if(null===a||a.rd)for(var d=b.selection.j;d.next();){var e=d.value;e instanceof G&&(a=e,a.rd||(a.expandTree(),c.add(a)))}else a.expandTree(),c.add(a);b.Ja("TreeExpanded",c)}finally{b.Td("Expand Tree")}};
oa.prototype.canExpandTree=function(a){void 0===a&&(a=null);var b=this.g;if(null===b||b.mb)return!1;if(null!==a){if(!(a instanceof G)||a.rd)return!1;if(0<a.Jx().count)return!0}else for(a=b.selection.j;a.next();)if(b=a.value,b instanceof G&&!b.rd&&0<b.Jx().count)return!0;return!1};
oa.prototype.groupSelection=function(){var a=this.g;if(null!==a){var b=a.ga;if(b instanceof Y){var c=this.GE;if(null!==c){var d=null;try{a.jc="wait";a.$b("Group");a.Ja("ChangingSelection");for(var e=new K(F),g=a.selection.j;g.next();){var h=g.value;h.oe()&&h.canGroup()&&e.add(h)}for(var k=new K(F),l=e.j;l.next();){for(var m=l.value,g=!1,n=e.j;n.next();)if(m.Ei(n.value)){g=!0;break}g||k.add(m)}if(0<k.count){var p=k.first().Pa;if(null!==p)for(;null!==p;){for(var e=!1,q=k.j;q.next();)if(!q.value.Ei(p)){e=
!0;break}if(e)p=p.Pa;else break}if(c instanceof I)Kh(c),d=c.copy(),null!==d&&a.add(d);else if(b.ZA(c)){var r=b.copyNodeData(c);D.Ta(r)&&(b.Vl(r),d=a.Ix(r))}if(null!==d){null!==p&&this.isValidMember(p,d)&&(d.Pa=p);for(var s=k.j;s.next();){var u=s.value;this.isValidMember(d,u)&&(u.Pa=d)}a.select(d)}}a.Ja("ChangedSelection");a.Ja("SelectionGrouped",d)}finally{a.Td("Group"),a.jc=""}}}}};
oa.prototype.canGroupSelection=function(){var a=this.g;if(null===a||a.mb||a.Ff||!a.Zp||!a.kx||!(a.ga instanceof Y)||null===this.GE)return!1;for(a=a.selection.j;a.next();){var b=a.value;if(b.oe()&&b.canGroup())return!0}return!1};function Oh(a){var b=D.tb();for(a=a.j;a.next();){var c=a.value;c instanceof J||b.push(c)}a=new L(F);for(var c=b.length,d=0;d<c;d++){for(var e=b[d],g=!0,h=0;h<c;h++)if(e.Ei(b[h])){g=!1;break}g&&a.add(e)}D.Aa(b);return a}
oa.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof J)return!1;if(null!==a){if(a===b||a.Ei(b))return!1;var c=a.gB;if(null!==c&&!c(a,b)||null===a.data&&null!==b.data||null!==a.data&&null===b.data)return!1}c=this.gB;return null!==c?c(a,b):!0};
oa.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.g;if(null!==b){var c=b.ga;if(c instanceof Y)try{b.jc="wait";b.$b("Ungroup");b.Ja("ChangingSelection");var d=new K(I);if(null!==a)d.add(a);else for(var e=b.selection.j;e.next();){var g=e.value;g instanceof I&&(a=g,a.canUngroup()&&d.add(a))}if(0<d.count){b.tx();for(var h=d.j;h.next();){var k=h.value;k.expandSubGraph();var l=k.Pa,m=null!==l&&null!==l.data?c.Cb(l.data):void 0,n=new K(F);n.Rc(k.Mc);for(var p=n.j;p.next();){var q=
p.value;q.hb=!0;if(!(q instanceof J)){var r=q.data;null!==r?c.DB(r,m):q.Pa=l}}b.remove(k)}}b.Ja("ChangedSelection");b.Ja("SelectionUngrouped",d,n)}finally{b.Td("Ungroup"),b.jc=""}}};oa.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.g;if(null===b||b.mb||b.Ff||!b.Bn||!b.ox||!(b.ga instanceof Y))return!1;if(null!==a){if(!(a instanceof I))return!1;if(a.canUngroup())return!0}else for(a=b.selection.j;a.next();)if(b=a.value,b instanceof I&&b.canUngroup())return!0;return!1};
oa.prototype.addTopLevelParts=function(a,b){for(var c=!0,d=Oh(a).j;d.next();){var e=d.value;null!==e.Pa&&(!b||this.isValidMember(null,e)?e.Pa=null:c=!1)}return c};
oa.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.g;if(null!==b)try{b.$b("Collapse SubGraph");b.Xa.oo("Collapse SubGraph");var c=new K(I);if(null!==a&&a.Je)a.collapseSubGraph(),c.add(a);else for(var d=b.selection.j;d.next();){var e=d.value;e instanceof I&&(a=e,a.Je&&(a.collapseSubGraph(),c.add(a)))}b.Ja("SubGraphCollapsed",c)}finally{b.Td("Collapse SubGraph")}};
oa.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.g;if(null===b||b.mb)return!1;if(null!==a)return a instanceof I&&a.Je?!0:!1;for(a=b.selection.j;a.next();)if(b=a.value,b instanceof I&&b.Je)return!0;return!1};
oa.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.g;if(null!==b)try{b.$b("Expand SubGraph");b.Xa.oo("Expand SubGraph");var c=new K(I);if(null===a||a.Je)for(var d=b.selection.j;d.next();){var e=d.value;e instanceof I&&(a=e,a.Je||(a.expandSubGraph(),c.add(a)))}else a.expandSubGraph(),c.add(a);b.Ja("SubGraphExpanded",c)}finally{b.Td("Expand SubGraph")}};
oa.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.g;if(null===b||b.mb)return!1;if(null!==a)return a instanceof I&&!a.Je?!0:!1;for(a=b.selection.j;a.next();)if(b=a.value,b instanceof I&&!b.Je)return!0;return!1};
oa.prototype.editTextBlock=function(a){void 0===a&&(a=null);null!==a&&D.l(a,na,oa,"editTextBlock");var b=this.g;if(null!==b){var c=b.kb.MB;if(null!==c){if(null===a){a=null;for(var d=b.selection.j;d.next();){var e=d.value;if(e.canEdit()){a=e;break}}if(null===a)return;a=a.gu(function(a){return a instanceof na&&a.FA})}null!==a&&(b.gb=null,c.ih=a,b.gb=c)}}};
oa.prototype.canEditTextBlock=function(a){void 0===a&&(a=null);var b=this.g;if(null===b||b.mb||b.Ff||!b.nx||null===b.kb.MB)return!1;if(null!==a){if(!(a instanceof na))return!1;a=a.Y;if(null!==a&&a.canEdit())return!0}else for(b=b.selection.j;b.next();)if(a=b.value,a.canEdit()&&(a=a.gu(function(a){return a instanceof na&&a.FA}),null!==a))return!0;return!1};
oa.prototype.showContextMenu=function(a){var b=this.g;if(null!==b){var c=b.kb.vA;if(null!==c&&(void 0===a&&(a=0<b.selection.count?b.selection.first():b),a=c.findObjectWithContextMenu(a),null!==a)){var d=new Zf,e=null;a instanceof P?e=a.eb(gc):b.iJ||(e=b.xb,e=new O(e.x+e.width/2,e.y+e.height/2));null!==e&&(d.g=b,d.qe=b.TB(e),d.ha=e,d.left=!1,d.right=!0,d.up=!0,b.U=d);b.gb=c;Ph(c,!1,a)}}};
oa.prototype.canShowContextMenu=function(a){var b=this.g;if(null===b)return!1;var c=b.kb.vA;if(null===c)return!1;void 0===a&&(a=0<b.selection.count?b.selection.first():b);return null===c.findObjectWithContextMenu(a)?!1:!0};D.defineProperty(oa,{hI:"copiesClipboardData"},function(){return this.tC},function(a){D.h(a,"boolean",oa,"copiesClipboardData");this.tC=a});
D.defineProperty(oa,{iI:"copiesConnectedLinks"},function(){return this.uC},function(a){D.h(a,"boolean",oa,"copiesConnectedLinks");this.uC=a});D.defineProperty(oa,{bF:"deletesConnectedLinks"},function(){return this.OC},function(a){D.h(a,"boolean",oa,"deletesConnectedLinks");this.OC=a});D.defineProperty(oa,{kI:"copiesTree"},function(){return this.yC},function(a){D.h(a,"boolean",oa,"copiesTree");this.yC=a});
D.defineProperty(oa,{pI:"deletesTree"},function(){return this.PC},function(a){D.h(a,"boolean",oa,"deletesTree");this.PC=a});D.defineProperty(oa,{TE:"copiesParentKey"},function(){return this.xC},function(a){D.h(a,"boolean",oa,"copiesParentKey");this.xC=a});D.defineProperty(oa,{SE:"copiesGroupKey"},function(){return this.wC},function(a){D.h(a,"boolean",oa,"copiesGroupKey");this.wC=a});
D.defineProperty(oa,{GE:"archetypeGroupData"},function(){return this.Zy},function(a){null!==a&&D.l(a,Object,oa,"archetypeGroupData");var b=this.g;null!==b&&(b=b.ga,b instanceof Y&&(a instanceof I||b.ZA(a)||D.k("CommandHandler.archetypeGroupData must be either a Group or a data object for which GraphLinksModel.isGroupForNodeData is true: "+a)));this.Zy=a});D.defineProperty(oa,{gB:"memberValidation"},function(){return this.Il},function(a){null!==a&&D.h(a,"function",oa,"memberValidation");this.Il=a});
D.defineProperty(oa,{zx:"defaultScale"},function(){return this.LC},function(a){D.p(a,oa,"defaultScale");0<a||D.k("defaultScale must be larger than zero, not: "+a);this.LC=a});D.defineProperty(oa,{My:"zoomFactor"},function(){return this.wE},function(a){D.p(a,oa,"zoomFactor");1<a||D.k("zoomFactor must be larger than 1.0, not: "+a);this.wE=a});oa.prototype.Bt=function(a){if(null!==a)for(a=a.j;a.next();){var b=a.key;b instanceof J&&(b.Wj=!0)}};
oa.prototype.Hp=function(a){if(null!==a)for(a=a.j;a.next();){var b=a.key;b instanceof J&&(b.Wj=!1,Qh(b)&&b.fc())}};function Sg(){0<arguments.length&&D.td(Sg);D.tc(this);this.ba=null;this.Xb="";this.mf=!0;this.fD=!1;this.qE=null;this.gx=-1}D.ja("Tool",Sg);Sg.prototype.Xc=function(a){v&&null!==a&&D.l(a,E,Sg,"setDiagram");this.ba=a};Sg.prototype.toString=function(){return""!==this.name?this.name+" Tool":D.qf(Object.getPrototypeOf(this))};Sg.prototype.updateAdornments=function(){};
Sg.prototype.canStart=function(){return this.isEnabled};Sg.prototype.doStart=function(){};Sg.prototype.doActivate=function(){this.wa=!0};Sg.prototype.doDeactivate=function(){this.wa=!1};Sg.prototype.doStop=function(){};Sg.prototype.doCancel=function(){this.stopTool()};Sg.prototype.stopTool=function(){var a=this.g;null!==a&&a.gb===this&&(a.gb=null,a.jc="")};Sg.prototype.doMouseDown=function(){!this.wa&&this.canStart()&&this.doActivate()};Sg.prototype.doMouseMove=function(){};
Sg.prototype.doMouseUp=function(){this.stopTool()};Sg.prototype.doMouseWheel=function(){};Sg.prototype.canStartMultiTouch=function(){return!0};Sg.prototype.standardPinchZoomStart=function(){var a=this.g;if(null!==a){var b=a.U,c=b.Mx(0,D.Fb(NaN,NaN)),d=b.Mx(1,D.Fb(NaN,NaN));if(c.F()&&d.F()&&(this.doCancel(),a.pu("hasGestureZoom"))){a.GD=a.scale;var e=d.x-c.x,g=d.y-c.y;a.ZD=Math.sqrt(e*e+g*g);b.bubbles=!1}D.A(c);D.A(d)}};
Sg.prototype.standardPinchZoomMove=function(){var a=this.g;if(null!==a){var b=a.U,c=b.Mx(0,D.Fb(NaN,NaN)),d=b.Mx(1,D.Fb(NaN,NaN));if(c.F()&&d.F()&&(this.doCancel(),a.pu("hasGestureZoom"))){var e=d.x-c.x,g=d.y-c.y,g=Math.sqrt(e*e+g*g)/a.ZD,e=new O((Math.min(d.x,c.x)+Math.max(d.x,c.x))/2,(Math.min(d.y,c.y)+Math.max(d.y,c.y))/2),g=a.GD*g,h=a.wb;if(g!==a.scale&&h.canResetZoom(g)){var k=a.Fm;a.Fm=e;h.resetZoom(g);a.Fm=k}b.bubbles=!1}D.A(c);D.A(d)}};
Sg.prototype.doKeyDown=function(){var a=this.g;null!==a&&"Esc"===a.U.key&&this.doCancel()};Sg.prototype.doKeyUp=function(){};Sg.prototype.startTransaction=Sg.prototype.$b=function(a){void 0===a&&(a=this.name);this.Pf=null;var b=this.g;return null===b?!1:b.$b(a)};Sg.prototype.stopTransaction=Sg.prototype.bl=function(){var a=this.g;return null===a?!1:null===this.Pf?a.Kq():a.Td(this.Pf)};
Sg.prototype.standardMouseSelect=function(){var a=this.g;if(null!==a&&a.Bf){var b=a.U,c=a.iu(b.ha,!1);if(null!==c)if(D.Vk?b.Hu:b.control){a.Ja("ChangingSelection");for(b=c;null!==b&&!b.canSelect();)b=b.Pa;null!==b&&(b.hb=!b.hb);a.Ja("ChangedSelection")}else if(b.shift){if(!c.hb){a.Ja("ChangingSelection");for(b=c;null!==b&&!b.canSelect();)b=b.Pa;null!==b&&(b.hb=!0);a.Ja("ChangedSelection")}}else{if(!c.hb){for(b=c;null!==b&&!b.canSelect();)b=b.Pa;null!==b&&a.select(b)}}else!b.left||(D.Vk?b.Hu:b.control)||
b.shift||a.tx()}};Sg.prototype.standardMouseClick=function(a,b){void 0===a&&(a=null);void 0===b&&(b=function(a){return!a.layer.Tc});var c=this.g;if(null===c)return!1;var d=c.U,e=c.Ge(d.ha,a,b);d.We=e;Rh(e,d,c);return d.Lc};
function Rh(a,b,c){b.Lc=!1;if(null===a||a.vu()){var d=0;b.left?d=1===b.Oe?1:2===b.Oe?2:1:b.right&&1===b.Oe&&(d=3);var e="";if(null!==a){switch(d){case 1:e="ObjectSingleClicked";break;case 2:e="ObjectDoubleClicked";break;case 3:e="ObjectContextClicked"}0!==d&&c.Ja(e,a)}else{switch(d){case 1:e="BackgroundSingleClicked";break;case 2:e="BackgroundDoubleClicked";break;case 3:e="BackgroundContextClicked"}0!==d&&c.Ja(e)}if(null!==a)for(;null!==a;){c=null;switch(d){case 1:c=a.click;break;case 2:c=a.du?a.du:
a.click;break;case 3:c=a.uA}if(null!==c&&(c(b,a),b.Lc))break;a=a.Q}else{a=null;switch(d){case 1:a=c.click;break;case 2:a=c.du?c.du:c.click;break;case 3:a=c.uA}null!==a&&a(b)}}}
Sg.prototype.standardMouseOver=function(){var a=this.g;if(null!==a){var b=a.U;if(null!==b.g&&!0!==a.Xa.vc){var c=a.Eb;a.Eb=!0;var d=a.Ge(b.ha,null,null);b.We=d;var e=!1;if(d!==a.Qo){var g=a.Qo,h=g;a.Qo=d;this.doCurrentObjectChanged(g,d);for(b.Lc=!1;null!==g;){var k=g.Ju;if(null!==k){if(d===g)break;if(null!==d&&d.tm(g))break;k(b,g,d);e=!0;if(b.Lc)break}g=g.Q}g=h;for(b.Lc=!1;null!==d;){k=d.Iu;if(null!==k){if(g===d)break;if(null!==g&&g.tm(d))break;k(b,d,g);e=!0;if(b.Lc)break}d=d.Q}d=a.Qo}if(null!==d){g=
d;for(h="";null!==g;){h=g.cursor;if(""!==h)break;g=g.Q}a.jc=h;b.Lc=!1;for(g=d;null!==g;){d=g.kB;if(null!==d&&(d(b,g),e=!0,b.Lc))break;g=g.Q}}else a.jc="",d=a.kB,null!==d&&(d(b),e=!0);e&&a.Se();a.Eb=c}}};Sg.prototype.doCurrentObjectChanged=function(){};
Sg.prototype.standardMouseWheel=function(){var a=this.g;if(null!==a){var b=a.U,c=b.hm;if(0!==c&&a.cd.F()){var d=a.wb,e=a.kb.Ku;if((e===Sh&&!b.shift||e===Th&&b.control)&&(0<c?d.canIncreaseZoom():d.canDecreaseZoom()))e=a.Fm,a.Fm=b.qe,0<c?d.increaseZoom():d.decreaseZoom(),a.Fm=e,b.bubbles=!1;else if(e===Sh&&b.shift||e===Th&&!b.control){var d=a.position.copy(),e=0<c?c:-c,g=b.event.deltaX,h=b.event.deltaY;void 0===g||void 0===h||0===g&&0===h||b.shift?!b.shift&&a.ze?(g=a.Yu,e=e/40*g,0<c?a.scroll("pixel",
"up",e):a.scroll("pixel","down",e)):b.shift&&a.ye&&(g=a.Xu,e=e/40*g,0<c?a.scroll("pixel","left",e):a.scroll("pixel","right",e)):(0!==g&&a.ye&&(0<g?a.scroll("pixel","left",-g):a.scroll("pixel","right",g)),0!==h&&a.ze&&(0<h?a.scroll("pixel","up",-h):a.scroll("pixel","down",h)));a.position.O(d)||(b.bubbles=!1)}}}};Sg.prototype.standardWaitAfter=function(a,b){D.h(a,"number",Sg,"standardWaitAfter:delay");this.cancelWaitAfter();var c=this,d=b.copy();this.gx=D.setTimeout(function(){c.doWaitAfter(d)},a)};
Sg.prototype.cancelWaitAfter=function(){-1!==this.gx&&D.clearTimeout(this.gx);this.gx=-1};Sg.prototype.doWaitAfter=function(){};Sg.prototype.findToolHandleAt=function(a,b){var c=this.g;if(null===c)return null;c=c.Ge(a,function(a){for(;null!==a&&!(a.Q instanceof da);)a=a.Q;return a});return null===c?null:c.Y.Dd===b?c:null};
Sg.prototype.isBeyondDragSize=function(a,b){var c=this.g;if(null===c)return!1;void 0===a&&(a=c.Kc.qe);void 0===b&&(b=c.U.qe);var d=c.kb.tI,e=d.width,d=d.height;c.Kc.Lj&&(e+=6,d+=6);return Math.abs(b.x-a.x)>e||Math.abs(b.y-a.y)>d};D.w(Sg,{g:"diagram"},function(){return this.ba});D.defineProperty(Sg,{name:"name"},function(){return this.Xb},function(a){D.h(a,"string",Sg,"name");this.Xb=a});
D.defineProperty(Sg,{isEnabled:"isEnabled"},function(){return this.mf},function(a){D.h(a,"boolean",Sg,"isEnabled");this.mf=a});D.defineProperty(Sg,{wa:"isActive"},function(){return this.fD},function(a){D.h(a,"boolean",Sg,"isActive");this.fD=a});D.defineProperty(Sg,{Pf:"transactionResult"},function(){return this.qE},function(a){null!==a&&D.h(a,"string",Sg,"transactionResult");this.qE=a});
function Mh(){Sg.call(this);0<arguments.length&&D.td(Mh);this.name="Dragging";this.vC=this.jD=!0;this.fs=this.VC=!1;this.nD=!0;this.Bz=(new Ca(NaN,NaN)).freeze();this.Cz=cc;this.Dz=(new O(NaN,NaN)).freeze();this.UC=!1;this.SC=this.sC=this.TC=this.DC=this.qj=null;this.Mr=this.lD=!1;this.Pp=new O(NaN,NaN);this.Uw=new O;this.Xw=!1;this.iD=!0;this.Wo=100;this.ek=[];this.rH=(new L(F)).freeze()}D.Sa(Mh,Sg);D.ja("DraggingTool",Mh);
D.defineProperty(Mh,{MF:"isCopyEnabled"},function(){return this.jD},function(a){D.h(a,"boolean",Mh,"isCopyEnabled");this.jD=a});D.defineProperty(Mh,{jI:"copiesEffectiveCollection"},function(){return this.vC},function(a){D.h(a,"boolean",Mh,"copiesEffectiveCollection");this.vC=a});D.defineProperty(Mh,{uI:"dragsTree"},function(){return this.VC},function(a){D.h(a,"boolean",Mh,"dragsTree");this.VC=a});
D.defineProperty(Mh,{Tx:"isGridSnapEnabled"},function(){return this.fs},function(a){D.h(a,"boolean",Mh,"isGridSnapEnabled");this.fs=a});D.defineProperty(Mh,{dJ:"isComplexRoutingRealtime"},function(){return this.iD},function(a){D.h(a,"boolean",Mh,"isComplexRoutingRealtime");this.iD=a});D.defineProperty(Mh,{fJ:"isGridSnapRealtime"},function(){return this.nD},function(a){D.h(a,"boolean",Mh,"isGridSnapRealtime");this.nD=a});
D.defineProperty(Mh,{CF:"gridSnapCellSize"},function(){return this.Bz},function(a){D.l(a,Ca,Mh,"gridSnapCellSize");this.Bz.O(a)||(this.Bz=a=a.V())});D.defineProperty(Mh,{QI:"gridSnapCellSpot"},function(){return this.Cz},function(a){D.l(a,R,Mh,"gridSnapCellSpot");this.Cz.O(a)||(this.Cz=a=a.V())});D.defineProperty(Mh,{RI:"gridSnapOrigin"},function(){return this.Dz},function(a){D.l(a,O,Mh,"gridSnapOrigin");this.Dz.O(a)||(this.Dz=a=a.V())});
D.defineProperty(Mh,{Ej:"dragsLink"},function(){return this.UC},function(a){D.h(a,"boolean",Mh,"dragsLink");this.UC=a});D.defineProperty(Mh,{Ln:"currentPart"},function(){return this.DC},function(a){null!==a&&D.l(a,F,Mh,"currentPart");this.DC=a});D.defineProperty(Mh,{ic:"copiedParts"},function(){return this.sC},function(a){this.sC=a});D.defineProperty(Mh,{ec:"draggedParts"},function(){return this.TC},function(a){this.TC=a});
D.w(Mh,{vL:"draggingParts"},function(){return null!==this.ic?this.ic.Yj():null!==this.ec?this.ec.Yj():this.rH});D.defineProperty(Mh,{qd:"draggedLink"},function(){return this.SC},function(a){null!==a&&D.l(a,J,Mh,"draggedLink");this.SC=a});D.defineProperty(Mh,{Sx:"isDragOutStarted"},function(){return this.lD},function(a){this.lD=a});D.defineProperty(Mh,{al:"startPoint"},function(){return this.Uw},function(a){D.l(a,O,Mh,"startPoint");this.Uw.O(a)||(this.Uw=a=a.V())});
D.defineProperty(Mh,{XE:"delay"},function(){return this.Wo},function(a){D.h(a,"number",Mh,"delay");this.Wo=a});Mh.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;if(null===a||a.mb&&!a.Ut||!a.Yl&&!a.Kk&&!a.Ut||!a.Bf)return!1;var b=a.U;return!b.left||a.gb!==this&&(!this.isBeyondDragSize()||b.Lj&&b.timestamp-a.Kc.timestamp<this.Wo)?!1:null!==this.findDraggablePart()};
Mh.prototype.findDraggablePart=function(){var a=this.g;if(null===a)return null;a=a.iu(a.Kc.ha,!1);if(null===a)return null;for(;null!==a&&!a.canSelect();)a=a.Pa;return null!==a&&(a.canMove()||a.canCopy())?a:null};Mh.prototype.standardMouseSelect=function(){var a=this.g;if(null!==a&&a.Bf){var b=a.iu(a.Kc.ha,!1);if(null!==b){for(;null!==b&&!b.canSelect();)b=b.Pa;this.Ln=b;this.Ln.hb||(a.Ja("ChangingSelection"),b=a.U,(D.Vk?b.Hu:b.control)||b.shift||Lh(a),this.Ln.hb=!0,a.Ja("ChangedSelection"))}}};
Mh.prototype.doActivate=function(){var a=this.g;if(null!==a){null===this.Ln&&this.standardMouseSelect();var b=this.Ln;null!==b&&(b.canMove()||b.canCopy())&&(this.wa=!0,this.Pp.set(a.position),Uh(this,a.selection),this.ek.length=0,this.ec=this.computeEffectiveCollection(a.selection),a.cv=!0,this.Bt(this.ec),this.$b("Drag"),this.al=a.Kc.ha,a.jf=!0,a.Ut&&(this.Sx=!0,this.Mr=!1,Vh=this,Wh=this.g,this.doSimulatedDragOut()))}};
function Uh(a,b){if(a.Ej){var c=a.g;null!==c&&c.Cn&&(c.ga instanceof Y&&1===b.count&&b.first()instanceof J?(a.qd=b.first(),a.qd.canRelinkFrom()&&a.qd.canRelinkTo()&&a.qd.Zt(),a.qj=c.kb.rG,null===a.qj&&(a.qj=new Xh,a.qj.Xc(c))):(a.qd=null,a.qj=null))}}
Mh.prototype.computeEffectiveCollection=function(a){var b=null!==this.g&&this.g.gb===this,c=new ma(F);if(null===a)return c;for(var d=a.j;d.next();)Yh(this,c,d.value,b);if(null!==this.qd&&this.Ej)return c;for(d=a.j;d.next();)a=d.value,a instanceof J&&(b=a.aa,null===b||c.contains(b)?(b=a.da,null===b||c.contains(b)||c.remove(a)):c.remove(a));return c};function ki(a){return void 0===a?new xi(Gd):new xi(a.copy())}
function Yh(a,b,c,d){if(!b.contains(c)&&(!d||c.canMove()||c.canCopy()))if(c instanceof G){b.add(c,ki(c.location));if(c instanceof I)for(var e=c.Mc;e.next();)Yh(a,b,e.value,d);for(e=c.Gd;e.next();){var g=e.value;if(!b.contains(g)){var h=g.aa,k=g.da;null!==h&&b.contains(h)&&null!==k&&b.contains(k)&&Yh(a,b,g,d)}}if(a.uI)for(c=c.qF();c.next();)Yh(a,b,c.value,d)}else if(c instanceof J)for(g=c,b.add(g,ki()),c=g.If;c.next();)Yh(a,b,c.value,d);else c instanceof da||b.add(c,ki(c.location))}
Mh.prototype.doDeactivate=function(){this.wa=!1;var a=this.g;null!==a&&yi(a);zi(this);this.Hp(this.ec);this.ec=this.Ln=null;this.Mr=this.Sx=!1;if(0<Ai.count){for(var b=Ai.length,c=0;c<b;c++){var d=Ai.ea(c);Bi(d);Ci(d);zi(d);null!==d.g&&yi(d.g)}Ai.clear()}Bi(this);this.Pp.m(NaN,NaN);Vh=Wh=null;Ci(this);a.jf=!1;a.jc="";a.cv=!1;this.bl()};function zi(a){var b=a.g;if(null!==b){var c=b.Eb;b.Eb=!0;Di(a,b.U,null);b.Eb=c}a.ek.length=0}
function Ei(){var a=Vh;Ci(a);Fi(a);var b=a.g;null!==b&&a.Pp.F()&&(b.position=a.Pp);null!==b&&yi(b)}Mh.prototype.doCancel=function(){Ci(this);Fi(this);var a=this.g;null!==a&&this.Pp.F()&&(a.position=this.Pp);this.stopTool()};Mh.prototype.Bt=function(a){if(null!==a)for(this.Xw=!0,a=a.j;a.next();){var b=a.key;b instanceof J&&(b.Wj=!0)}};Mh.prototype.Hp=function(a){if(null!==a){for(a=a.j;a.next();){var b=a.key;b instanceof J&&(b.Wj=!1,Qh(b)&&b.fc())}this.Xw=!1}};
Mh.prototype.doKeyDown=function(){var a=this.g;null!==a&&(a=a.U,null!==a&&this.wa&&("Esc"===a.key?this.doCancel():this.doMouseMove()))};Mh.prototype.doKeyUp=function(){var a=this.g;null!==a&&null!==a.U&&this.wa&&this.doMouseMove()};function Gi(a,b){for(var c=Infinity,d=Infinity,e=-Infinity,g=-Infinity,h=a.j;h.next();){var k=h.value;if(k.oe()&&k.isVisible()){var l=k.location,k=l.x,l=l.y;isNaN(k)||isNaN(l)||(k<c&&(c=k),l<d&&(d=l),k>e&&(e=k),l>g&&(g=l))}}Infinity===c?b.m(0,0,0,0):b.m(c,d,e-c,g-d)}
function Hi(a,b){if(null===a.ic){var c=a.g;if(!(null===c||b&&(c.mb||c.Ff))&&null!==a.ec){var d=c.ra;d.isEnabled&&d.RF?null!==d.Cj&&0<d.Cj.ag.count&&(c.ra.Kq(),c.$b("Drag")):Fi(a);c.Eb=!b;c.br=!b;a.al=c.Kc.ha;d=a.jI?a.ec.Yj():c.selection;d=c.hq(d,c,!0);for(c=d.j;c.next();)c.value.location=c.key.location;c=D.Nf();Gi(d,c);D.Mb(c);for(var c=new ma(F),e=a.ec.j;e.next();){var g=e.key;g.oe()&&g.canCopy()&&(g=d.oa(g),null!==g&&(g.hf(),c.add(g,ki(g.location))))}for(d=d.j;d.next();)e=d.value,e instanceof J&&
e.canCopy()&&c.add(e,ki());a.ic=c;Uh(a,c.Yj());null!==a.qd&&(c=a.qd,d=c.qo,c.wm(a.al.x-(d.x+d.width/2),a.al.y-(d.y+d.height/2)))}}}function Ci(a){var b=a.g;if(null!==b){if(null!==a.ic&&(b.vB(a.ic.Yj(),!1),a.ic=null,null!==a.ec))for(var c=a.ec.j;c.next();)c.key instanceof J&&(c.value.point=new O(0,0));b.Eb=!1;b.br=!1;a.al=b.Kc.ha}}function Bi(a){if(null!==a.qd){if(a.Ej&&null!==a.qj){var b=a.qj;null!==b.g&&(b.g.remove(b.ae),b.g.remove(b.be))}a.qd=null;a.qj=null}}
function Ii(a,b,c){var d=a.g;if(null!==d){var e=a.al,g=D.P();g.assign(d.U.ha);a.moveParts(b,g.vo(e),c);D.A(g)}}
Mh.prototype.moveParts=function(a,b,c){if(null!==a&&(D.l(a,ma,Mh,"moveParts:parts"),0!==a.count)){var d=D.P(),e=D.P();e.assign(b);isNaN(e.x)&&(e.x=0);isNaN(e.y)&&(e.y=0);(b=this.Xw)||this.Bt(a);for(var g=new K(Ji),h=new K(Ra),k=a.j;k.next();){var l=k.key;if(l.oe()){var m=Ki(this,l,a);if(null!==m)g.add(new Ji(l,k.value,m));else if(!c||l.canMove()){m=k.value.point;d.assign(m);var n=D.P(),p=this.computeMove(l,d.add(e),a,n);l.location=p;k.value.RG=n.vo(m);D.A(n)}}else k.key instanceof J&&h.add(k.bb)}for(c=
g.j;c.next();)g=c.value,m=g.info.point,d.assign(m),g.Vc.location=d.add(g.SI.RG);c=D.P();m=D.P();for(h=h.j;h.next();)if(k=h.value,g=k.key,g instanceof J)if(g.Wj)l=g.aa,n=g.da,null!==this.qd&&this.Ej?(k=k.value.point,a.add(g,ki(e)),l=e.x-k.x,k=e.y-k.y,g.wm(l,k)):(null!==l&&(c.assign(l.location),p=a.oa(l),null!==p&&c.vo(p.point)),null!==n&&(m.assign(n.location),p=a.oa(n),null!==p&&m.vo(p.point)),null!==l&&null!==n?c.Sc(m)?(k=k.value.point,l=d,l.assign(c),l.vo(k),a.add(g,ki(c)),g.wm(l.x,l.y)):(g.Wj=!1,
g.fc()):(k=k.value.point,n=null!==l?c:null!==n?m:e,a.add(g,ki(n)),l=n.x-k.x,k=n.y-k.y,g.wm(l,k)));else if(null===g.aa||null===g.da)k=k.value.point,a.add(g,ki(e)),l=e.x-k.x,k=e.y-k.y,g.wm(l,k);D.A(d);D.A(e);D.A(c);D.A(m);b||(Li(this.g),this.Hp(a))}};function Ki(a,b,c){b=b.Pa;if(null!==b){a=Ki(a,b,c);if(null!==a)return a;a=c.oa(b);if(null!==a)return a}return null}
function Fi(a){if(null!==a.ec){for(var b=a.g,c=a.ec.j;c.next();){var d=c.key;d.oe()&&(d.location=c.value.point)}for(c=a.ec.j;c.next();)if(d=c.key,d instanceof J&&d.Wj){var e=c.value.point;a.ec.add(d,ki());d.wm(-e.x,-e.y)}b.gg()}}
Mh.prototype.computeMove=function(a,b,c,d){void 0===d&&(d=new O);d.assign(b);if(null===a)return d;void 0===c&&(c=null);var e=b;if(this.Tx&&(this.fJ||null===c||null!==this.g&&this.g.U.up)&&(e=D.P(),c=e,c.assign(b),null!==a)){var g=this.g;if(null!==g){var h=g.Vn,k=this.CF,g=k.width,k=k.height,l=this.RI,m=l.x,l=l.y,n=this.QI;if(null!==h){var p=h.Ox;isNaN(g)&&(g=p.width);isNaN(k)&&(k=p.height);h=h.BF;isNaN(m)&&(m=h.x);isNaN(l)&&(l=h.y)}h=D.Fb(0,0);h.av(0,0,g,k,n);gb(b.x,b.y,m+h.x,l+h.y,g,k,c);D.A(h)}}c=
null!==a.cF?a.cF(a,b,e):e;k=a.GJ;g=k.x;isNaN(g)&&(g=a.location.x);k=k.y;isNaN(k)&&(k=a.location.y);h=a.AJ;m=h.x;isNaN(m)&&(m=a.location.x);h=h.y;isNaN(h)&&(h=a.location.y);d.m(Math.max(g,Math.min(c.x,m)),Math.max(k,Math.min(c.y,h)));e!==b&&D.A(e);return d};function Mi(a,b){if(null===b)return!0;var c=b.Y;return null===c||c instanceof da||c.layer.Tc||a.ec&&a.ec.contains(c)||a.ic&&a.ic.contains(c)?!0:!1}
function Ni(a,b,c,d){var e=a.g;if(null!==e){a.Ej&&(null!==a.qd&&(a.qd.aa=null,a.qd.da=null),Oi(a,!1));var g=Pi(e,b,null,function(b){return!Mi(a,b)}),h=e.U;h.We=g;var k=e.Eb,l=!1;try{e.Eb=!0;l=Di(a,h,g);if(!a.wa&&null===Vh)return;if(null===g){var m=e.KJ;null!==m&&(m(h),l=!0)}if(!a.wa&&null===Vh)return;a.doDragOver(b,g);if(!a.wa&&null===Vh)return}finally{e.Eb=k,l&&e.gg()}(e.ye||e.ze)&&(c||d)&&e.CA(h.qe)}}
function Di(a,b,c){var d=!1,e=a.ek.length,g=0<e?a.ek[0]:null;if(c===g)return!1;b.Lc=!1;for(var h=0;h<e;h++){var k=a.ek[h],l=k.JJ;if(null!==l&&(l(b,k,c),d=!0,b.Lc))break}a.ek.length=0;if(!a.wa&&null===Vh||null===c)return d;for(b.Lc=!1;null!==c;)a.ek.push(c),c=Qi(c);e=a.ek.length;for(h=0;h<e&&(k=a.ek[h],l=k.IJ,null===l||(l(b,k,g),d=!0,!b.Lc));h++);return d}function Qi(a){var b=a.Q;return null!==b?b:a instanceof F&&!(a instanceof I)&&(a=a.Pa,null!==a&&a.UI)?a:null}
function Ri(a,b,c){var d=a.qj;if(null===d)return null;var e=a.g.On(b,d.pG,function(a){return d.findValidLinkablePort(a,c)});a=D.P();for(var g=Infinity,h=null,e=e.j;e.next();){var k=e.value;if(null!==k.Y){var l=k.eb(gc,a),l=b.Cf(l);l<g&&(h=k,g=l)}}D.A(a);return h}
function Oi(a,b){var c=a.qd;if(null!==c&&!(2>c.ta)){var d=a.g;if(null!==d&&!d.mb&&(d=a.qj,null!==d)){var e=null,g=null;null===c.aa&&(e=Ri(a,c.n(0),!1),null!==e&&(g=e.Y));var h=null,k=null;null===c.da&&(h=Ri(a,c.n(c.ta-1),!0),null!==h&&(k=h.Y));d.isValidLink(g,e,k,h)?b?(c.iq=c.n(0),c.jq=c.n(c.ta-1),c.Wj=!1,c.aa=g,null!==e&&(c.cg=e.sd),c.da=k,null!==h&&(c.jh=h.sd)):Si(d,g,e,k,h):Si(d,null,null,null,null)}}}Mh.prototype.doDragOver=function(){};
function Ti(a,b){var c=a.g;if(null!==c){a.Ej&&Oi(a,!0);zi(a);var d=Pi(c,b,null,function(b){return!Mi(a,b)}),e=c.U;e.We=d;if(null!==d){e.Lc=!1;for(var g=d;null!==g;){var h=g.hB;if(null!==h&&(h(e,g),e.Lc))break;g=Qi(g)}}else g=c.hB,null!==g&&g(e);if(a.wa||null!==Vh){for(e=(a.ic||a.ec).j;e.next();)g=e.key,g instanceof G&&g.Gd.each(function(a){a.Wj=!1});a.doDropOnto(b,d);if(a.wa||null!==Vh){d=D.Nf();for(e=c.selection.j;e.next();)g=e.value,g instanceof G&&Ui(c,g.getAvoidableRect(d));D.Mb(d)}}}}
Mh.prototype.doDropOnto=function(){};Mh.prototype.doMouseMove=function(){if(this.wa){var a=this.g;if(null!==a&&null!==this.Ln&&null!==this.ec){var b=!1,c=!1;this.mayCopy()?(b=!0,a.jc="copy",Hi(this,!1),this.Bt(this.ic),Ii(this,this.ic,!1),this.Hp(this.ic)):this.mayMove()?(c=!0,a.jc="default",Ci(this),Ii(this,this.ec,!0)):this.mayDragOut()?(a.jc="no-drop",Hi(this,!1),Ii(this,this.ic,!1)):Ci(this);Ni(this,a.U.ha,c,b)}}};
Mh.prototype.doMouseUp=function(){if(this.wa){var a=this.g;if(null!==a){var b=!1,c=this.mayCopy();c&&null!==this.ic?(Ci(this),Hi(this,!0),this.Bt(this.ic),Ii(this,this.ic,!1),this.Hp(this.ic),null!==this.ic&&a.LG(this.ic.Yj())):(b=!0,Ci(this),this.mayMove()&&(Ii(this,this.ec,!0),Ni(this,a.U.ha,!0,!1)));this.Mr=!0;Ti(this,a.U.ha);if(this.wa){this.ic=null;if(b&&null!==this.ec)for(b=this.ec.j;b.next();){var d=b.key;d instanceof G&&(d=d.Pa,null===d||null===d.placeholder||this.ec.contains(d)||d.placeholder.K())}a.yc();
this.Hp(this.ec);this.Pf=c?"Copy":"Move";a.Ja(c?"SelectionCopied":"SelectionMoved",a.selection)}this.stopTool()}}};Mh.prototype.mayCopy=function(){if(!this.MF)return!1;var a=this.g;if(null===a||a.mb||a.Ff||!a.Zp||!a.Kk||(D.Vk?!a.U.alt:!a.U.control))return!1;for(a=a.selection.j;a.next();){var b=a.value;if(b.oe()&&b.canCopy())return!0}return null!==this.qd&&this.Ej&&this.qd.canCopy()?!0:!1};
Mh.prototype.mayDragOut=function(){if(!this.MF)return!1;var a=this.g;if(null===a||!a.Ut||!a.Kk||a.Yl)return!1;for(a=a.selection.j;a.next();){var b=a.value;if(b.oe()&&b.canCopy())return!0}return null!==this.qd&&this.Ej&&this.qd.canCopy()?!0:!1};Mh.prototype.mayMove=function(){var a=this.g;if(null===a||a.mb||!a.Yl)return!1;for(a=a.selection.j;a.next();){var b=a.value;if(b.oe()&&b.canMove())return!0}return null!==this.qd&&this.Ej&&this.qd.canMove()?!0:!1};var Ai=new K(Mh),Vh=null,Wh=null;
Mh.prototype.getDraggingSource=function(){return Vh};Mh.prototype.mayDragIn=function(){var a=this.g;if(null===a||!a.EE||a.mb||a.Ff||!a.Zp)return!1;var b=Vh;return null===b||null===b.g||b.g.ga.fm!==a.ga.fm?!1:!0};Mh.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.g;a.Xa.Ii();Vi(a);a=Vh;null!==a&&null!==a.g&&(a.g.jc="copy")}};Mh.prototype.doSimulatedDragLeave=function(){var a=Vh;null!==a&&a.doSimulatedDragOut();this.doCancel()};
Mh.prototype.doSimulatedDragOver=function(){var a=this.g;if(null!==a){var b=Vh;null!==b&&null!==b.ec&&this.mayDragIn()&&(a.jc="copy",Wi(this,b.ec.Yj(),!1),Ii(this,this.ic,!1),Ni(this,a.U.ha,!1,!0))}};
Mh.prototype.doSimulatedDrop=function(){var a=this.g;if(null!==a){var b=Vh;if(null!==b){var c=b.g;b.Mr=!0;Ci(this);this.mayDragIn()&&(this.$b("Drop"),Wi(this,b.ec.Yj(),!0),Ii(this,this.ic,!1),null!==this.ic&&a.LG(this.ic.Yj()),Ti(this,a.U.ha),a.yc(),b=a.selection,null!==this.ic?this.Pf="ExternalCopy":b=new L(F),this.ic=null,a.doFocus(),a.Ja("ExternalObjectsDropped",b,c),this.bl())}}};
function Wi(a,b,c){if(null===a.ic){var d=a.g;if(null!==d&&!d.mb&&!d.Ff){d.Eb=!c;d.br=!c;a.al=d.U.ha;d=d.hq(b,d,!0);c=D.Nf();Gi(b,c);var e=c.x+c.width/2,g=c.y+c.height/2;D.Mb(c);var h=a.Uw;c=new ma(F);var k=D.P();for(b=b.j;b.next();){var l=b.value;if(l.oe()&&l.canCopy()){var m=l.location,l=d.oa(l);k.m(h.x-(e-m.x),h.y-(g-m.y));l.location=k;l.hf();c.add(l,ki(k))}}D.A(k);for(d=d.j;d.next();)e=d.value,e instanceof J&&e.canCopy()&&c.add(e,ki());a.ic=c;Uh(a,c.Yj());null!==a.qd&&(c=a.qd,d=c.qo,c.wm(a.al.x-
(d.x+d.width/2),a.al.y-(d.y+d.height/2)))}}}Mh.prototype.doSimulatedDragOut=function(){var a=this.g;null!==a&&(this.mayCopy()||this.mayMove()?a.jc="":a.jc="no-drop")};function xi(a){this.point=a;this.RG=Gd}D.ja("DraggingInfo",xi);function Ji(a,b,c){this.Vc=a;this.info=b;this.SI=c}
function Xi(){0<arguments.length&&D.td(Xi);Sg.call(this);this.RD=100;this.qD=!1;var a=new J,b=new z;b.Gf=!0;b.stroke="blue";a.add(b);b=new z;b.Wq="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.Jf="Tool";this.jE=a;a=new G;b=new z;b.sd="";b.Jb="Rectangle";b.fill=null;b.stroke="magenta";b.jb=2;b.Ea=$d;a.add(b);a.$k=!1;a.Jf="Tool";this.hE=a;this.iE=b;a=new G;b=new z;b.sd="";b.Jb="Rectangle";b.fill=null;b.stroke="magenta";b.jb=2;b.Ea=$d;a.add(b);a.$k=!1;a.Jf="Tool";this.kE=a;this.lE=b;this.PD=this.OD=
this.KD=this.JD=this.LD=null;this.mD=!0;this.EH=new ma(P,"boolean");this.SD=this.Gl=this.eE=null}D.Sa(Xi,Sg);D.ja("LinkingBaseTool",Xi);Xi.prototype.doStop=function(){var a=this.g;null!==a&&yi(a);this.dh=this.bh=this.ah=this.$g=this.rc=null;this.Ky.clear();this.Mf=null};D.defineProperty(Xi,{pG:"portGravity"},function(){return this.RD},function(a){D.h(a,"number",Xi,"portGravity");0<=a&&(this.RD=a)});
D.defineProperty(Xi,{Aq:"isUnconnectedLinkValid"},function(){return this.qD},function(a){D.h(a,"boolean",Xi,"isUnconnectedLinkValid");this.qD=a});D.defineProperty(Xi,{hh:"temporaryLink"},function(){return this.jE},function(a){D.l(a,J,Xi,"temporaryLink");this.jE=a});D.defineProperty(Xi,{ae:"temporaryFromNode"},function(){return this.hE},function(a){D.l(a,G,Xi,"temporaryFromNode");this.hE=a});
D.defineProperty(Xi,{wo:"temporaryFromPort"},function(){return this.iE},function(a){D.l(a,P,Xi,"temporaryFromPort");this.iE=a});D.defineProperty(Xi,{be:"temporaryToNode"},function(){return this.kE},function(a){D.l(a,G,Xi,"temporaryToNode");this.kE=a});D.defineProperty(Xi,{xo:"temporaryToPort"},function(){return this.lE},function(a){D.l(a,P,Xi,"temporaryToPort");this.lE=a});D.defineProperty(Xi,{rc:"originalLink"},function(){return this.LD},function(a){null!==a&&D.l(a,J,Xi,"originalLink");this.LD=a});
D.defineProperty(Xi,{$g:"originalFromNode"},function(){return this.JD},function(a){null!==a&&D.l(a,G,Xi,"originalFromNode");this.JD=a});D.defineProperty(Xi,{ah:"originalFromPort"},function(){return this.KD},function(a){null!==a&&D.l(a,P,Xi,"originalFromPort");this.KD=a});D.defineProperty(Xi,{bh:"originalToNode"},function(){return this.OD},function(a){null!==a&&D.l(a,G,Xi,"originalToNode");this.OD=a});
D.defineProperty(Xi,{dh:"originalToPort"},function(){return this.PD},function(a){null!==a&&D.l(a,P,Xi,"originalToPort");this.PD=a});D.defineProperty(Xi,{Yd:"isForwards"},function(){return this.mD},function(a){D.h(a,"boolean",Xi,"isForwards");this.mD=a});D.w(Xi,{Ky:"validPortsCache"},function(){return this.EH});D.defineProperty(Xi,{Mf:"targetPort"},function(){return this.eE},function(a){null!==a&&D.l(a,P,Xi,"targetPort");this.eE=a});
Xi.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){d.Ea=b.$.size;e?(d.Hb=b.Hb,d.Dm=b.Dm):(d.Gb=b.Gb,d.nm=b.nm);c.Kf=gc;var g=D.P();c.location=b.eb(gc,g);D.A(g);d.angle=b.Rn();null!==this.sy&&this.sy(a,b,c,d,e)}};Xi.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.Ea=$d,b.Gb=bc,b.Hb=bc);null!==a&&null!==this.g&&(a.location=this.g.U.ha);null!==this.sy&&this.sy(null,null,a,b,c)};Xi.prototype.doMouseDown=function(){this.wa&&this.doMouseMove()};
Xi.prototype.doMouseMove=function(){if(this.wa){var a=this.g;if(null!==a){this.Mf=this.findTargetPort(this.Yd);if(null!==this.Mf&&this.Mf.Y instanceof G){var b=this.Mf.Y;this.Yd?this.copyPortProperties(b,this.Mf,this.be,this.xo,!0):this.copyPortProperties(b,this.Mf,this.ae,this.wo,!1)}else this.Yd?this.setNoTargetPortProperties(this.be,this.xo,!0):this.setNoTargetPortProperties(this.ae,this.wo,!1);(a.ye||a.ze)&&a.CA(a.U.qe)}}};
Xi.prototype.findValidLinkablePort=function(a,b){if(null===a)return null;var c=a.Y;if(!(c instanceof G))return null;for(;null!==a;){var d=b?a.$G:a.sF;if(!0===d&&(null!==a.sd||a instanceof G)&&(b?this.isValidTo(c,a):this.isValidFrom(c,a)))return a;if(!1===d)break;a=a.Q}return null};
Xi.prototype.findTargetPort=function(a){var b=this.g,c=b.U.ha,d=this.pG;0>=d&&(d=.1);for(var e=this,g=b.On(c,d,function(b){return e.findValidLinkablePort(b,a)},null,!0),d=Infinity,b=null,g=g.j;g.next();){var h=g.value,k=h.Y;if(k instanceof G){var l=h.eb(gc,D.P()),m=c.x-l.x,n=c.y-l.y;D.A(l);l=m*m+n*n;l<d&&(m=this.Ky.oa(h),null!==m?m&&(b=h,d=l):a&&this.isValidLink(this.$g,this.ah,k,h)||!a&&this.isValidLink(k,h,this.bh,this.dh)?(this.Ky.add(h,!0),b=h,d=l):this.Ky.add(h,!1))}}return null!==b&&(c=b.Y,
c instanceof G&&(null===c.layer||c.layer.Vt))?b:null};Xi.prototype.isValidFrom=function(a,b){if(null===a||null===b)return this.Aq;if(null!==this.g&&this.g.gb===this&&(null!==a.layer&&!a.layer.Vt||!0!==b.sF))return!1;var c=b.MA;if(Infinity>c){if(null!==this.rc&&a===this.$g&&b===this.ah)return!0;var d=b.sd;null===d&&(d="");if(a.Hx(d).count>=c)return!1}return!0};
Xi.prototype.isValidTo=function(a,b){if(null===a||null===b)return this.Aq;if(null!==this.g&&this.g.gb===this&&(null!==a.layer&&!a.layer.Vt||!0!==b.$G))return!1;var c=b.tK;if(Infinity>c){if(null!==this.rc&&a===this.bh&&b===this.dh)return!0;var d=b.sd;null===d&&(d="");if(a.Vg(d).count>=c)return!1}return!0};Xi.prototype.isInSameNode=function(a,b){if(null===a||null===b)return!1;if(a===b)return!0;var c=a.Y,d=b.Y;return null!==c&&c===d};
Xi.prototype.isLinked=function(a,b){if(null===a||null===b)return!1;var c=a.Y;if(!(c instanceof G))return!1;var d=a.sd;null===d&&(d="");var e=b.Y;if(!(e instanceof G))return!1;var g=b.sd;null===g&&(g="");for(e=e.Vg(g);e.next();)if(g=e.value,g.aa===c&&g.cg===d)return!0;return!1};
Xi.prototype.isValidLink=function(a,b,c,d){if(!this.isValidFrom(a,b)||!this.isValidTo(c,d)||!(null===b||null===d||(b.HI&&d.sK||!this.isInSameNode(b,d))&&(b.GI&&d.rK||!this.isLinked(b,d)))||null!==this.rc&&(null!==a&&this.isLabelDependentOnLink(a,this.rc)||null!==c&&this.isLabelDependentOnLink(c,this.rc))||null!==a&&null!==c&&(null===a.data&&null!==c.data||null!==a.data&&null===c.data)||!this.isValidCycle(a,c,this.rc))return!1;if(null!==a){var e=a.gy;if(null!==e&&!e(a,b,c,d,this.rc))return!1}if(null!==
c&&(e=c.gy,null!==e&&!e(a,b,c,d,this.rc)))return!1;e=this.gy;return null!==e?e(a,b,c,d,this.rc):!0};Xi.prototype.isLabelDependentOnLink=function(a,b){if(null===a)return!1;var c=a.zc;if(null===c)return!1;if(c===b)return!0;var d=new L(G);d.add(a);return Yi(this,c,b,d)};function Yi(a,b,c,d){if(b===c)return!0;var e=b.aa;if(null!==e&&e.tf&&(d.add(e),Yi(a,e.zc,c,d)))return!0;b=b.da;return null!==b&&b.tf&&(d.add(b),Yi(a,b.zc,c,d))?!0:!1}
Xi.prototype.isValidCycle=function(a,b,c){void 0===c&&(c=null);if(null===a||null===b)return this.Aq;var d=null!==this.g?this.g.zK:Zi;if(d!==Zi){if(d===$i){if(null!==c&&!c.Uc)return!0;for(d=b.Gd;d.next();){var e=d.value;if(e!==c&&e.Uc&&e.da===b)return!1}return!aj(this,a,b,c,!0)}if(d===bj){if(null!==c&&!c.Uc)return!0;for(d=a.Gd;d.next();)if(e=d.value,e!==c&&e.Uc&&e.aa===a)return!1;return!aj(this,a,b,c,!0)}if(d===cj)return a===b?a=!0:(d=new L(G),d.add(b),a=dj(this,d,a,b,c)),!a;if(d===ej)return!aj(this,
a,b,c,!1);if(d===fj)return a===b?a=!0:(d=new L(G),d.add(b),a=gj(this,d,a,b,c)),!a}return!0};function aj(a,b,c,d,e){if(b===c)return!0;if(null===b||null===c)return!1;for(var g=b.Gd;g.next();){var h=g.value;if(h!==d&&(!e||h.Uc)&&h.da===b&&(h=h.aa,h!==b&&aj(a,h,c,d,e)))return!0}return!1}function dj(a,b,c,d,e){if(c===d)return!0;if(null===c||null===d||b.contains(c))return!1;b.add(c);for(var g=c.Gd;g.next();){var h=g.value;if(h!==e&&h.da===c&&(h=h.aa,h!==c&&dj(a,b,h,d,e)))return!0}return!1}
function gj(a,b,c,d,e){if(c===d)return!0;if(null===c||null===d||b.contains(c))return!1;b.add(c);for(var g=c.Gd;g.next();){var h=g.value;if(h!==e){var k=h.aa,h=h.da,k=k===c?h:k;if(k!==c&&gj(a,b,k,d,e))return!0}}return!1}D.defineProperty(Xi,{gy:"linkValidation"},function(){return this.Gl},function(a){null!==a&&D.h(a,"function",Xi,"linkValidation");this.Gl=a});D.defineProperty(Xi,{sy:"portTargeted"},function(){return this.SD},function(a){null!==a&&D.h(a,"function",Xi,"portTargeted");this.SD=a});
function ra(){0<arguments.length&&D.td(ra);Xi.call(this);this.name="Linking";this.az={};this.$y=null;this.fa=hj;this.$D=null}D.Sa(ra,Xi);D.ja("LinkingTool",ra);var hj;ra.Either=hj=D.s(ra,"Either",0);var ij;ra.ForwardsOnly=ij=D.s(ra,"ForwardsOnly",0);var jj;ra.BackwardsOnly=jj=D.s(ra,"BackwardsOnly",0);D.defineProperty(ra,{QH:"archetypeLinkData"},function(){return this.az},function(a){null!==a&&D.l(a,Object,ra,"archetypeLinkData");a instanceof P&&D.l(a,J,ra,"archetypeLinkData");this.az=a});
D.defineProperty(ra,{HE:"archetypeLabelNodeData"},function(){return this.$y},function(a){null!==a&&D.l(a,Object,ra,"archetypeLabelNodeData");a instanceof P&&D.l(a,G,ra,"archetypeLabelNodeData");this.$y=a});D.defineProperty(ra,{direction:"direction"},function(){return this.fa},function(a){D.Ca(a,ra,ra,"direction");this.fa=a});D.defineProperty(ra,{UG:"startObject"},function(){return this.$D},function(a){null!==a&&D.l(a,P,ra,"startObject");this.$D=a});
ra.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;if(null===a||a.mb||a.Ff||!a.Vt)return!1;var b=a.ga;return(b instanceof Y||b instanceof wg)&&a.U.left&&(a.gb===this||this.isBeyondDragSize())?null!==this.findLinkablePort():!1};
ra.prototype.findLinkablePort=function(){var a=this.g;if(null===a)return null;var b=this.UG;null===b&&(b=a.Ge(a.Kc.ha,null,null));if(null===b||!(b.Y instanceof G))return null;a=this.direction;if(a===hj||a===ij){var c=this.findValidLinkablePort(b,!1);if(null!==c)return this.Yd=!0,c}if(a===hj||a===jj)if(c=this.findValidLinkablePort(b,!0),null!==c)return this.Yd=!1,c;return null};
ra.prototype.doActivate=function(){var a=this.g;if(null!==a){var b=this.findLinkablePort();null!==b&&(this.$b(this.name),a.jf=!0,a.jc="pointer",this.Yd?(null===this.be||this.be.location.F()||(this.be.location=a.U.ha),this.ah=b,b=this.ah.Y,b instanceof G&&(this.$g=b),this.copyPortProperties(this.$g,this.ah,this.ae,this.wo,!1)):(null===this.ae||this.ae.location.F()||(this.ae.location=a.U.ha),this.dh=b,b=this.dh.Y,b instanceof G&&(this.bh=b),this.copyPortProperties(this.bh,this.dh,this.be,this.xo,!0)),
a.add(this.ae),a.add(this.be),null!==this.hh&&(null!==this.ae&&(this.hh.aa=this.ae),null!==this.be&&(this.hh.da=this.be),this.hh.fc(),a.add(this.hh)),this.wa=!0)}};ra.prototype.doDeactivate=function(){this.wa=!1;var a=this.g;null!==a&&(a.remove(this.hh),a.remove(this.ae),a.remove(this.be),a.jf=!1,a.jc="",this.bl())};ra.prototype.doStop=function(){Xi.prototype.doStop.call(this);this.UG=null};
ra.prototype.doMouseUp=function(){if(this.wa){var a=this.g;if(null===a)return;var b=this.Pf=null,c=null,d=null,e=null,g=this.Mf=this.findTargetPort(this.Yd);if(null!==g){var h=g.Y;h instanceof G&&(this.Yd?(null!==this.$g&&(b=this.$g,c=this.ah),d=h,e=g):(b=h,c=g,null!==this.bh&&(d=this.bh,e=this.dh)))}else this.Yd?null!==this.$g&&this.Aq&&(b=this.$g,c=this.ah):null!==this.bh&&this.Aq&&(d=this.bh,e=this.dh);null!==b||null!==d?(h=this.insertLink(b,c,d,e),null!==h?(null===g&&(this.Yd?h.jq=a.U.ha:h.iq=
a.U.ha),a.Bf&&a.select(h),this.Pf=this.name,a.Ja("LinkDrawn",h)):(a.ga.ME(),this.doNoLink(b,c,d,e))):this.Yd?this.doNoLink(this.$g,this.ah,null,null):this.doNoLink(null,null,this.bh,this.dh)}this.stopTool()};
ra.prototype.insertLink=function(a,b,c,d){var e=this.g;if(null===e)return null;var g=e.ga;if(g instanceof wg){var h=a;b=c;e.$d||(h=c,b=a);if(null!==h&&null!==b)return g.Hi(b.data,g.Cb(h.data)),b.Pn()}else if(g instanceof Y)if(h="",null!==a&&(null===b&&(b=a),h=b.sd,null===h&&(h="")),b="",null!==c&&(null===d&&(d=c),b=d.sd,null===b&&(b="")),d=this.QH,d instanceof J){if(Kh(d),g=d.copy(),null!==g)return g.aa=a,g.cg=h,g.da=c,g.jh=b,e.add(g),a=this.HE,a instanceof G&&(Kh(a),a=a.copy(),null!==a&&(a.zc=g,
e.add(a))),g}else if(null!==d&&(d=g.vx(d),D.Ta(d)))return null!==a&&g.BB(d,g.Cb(a.data)),g.CB(d,h),null!==c&&g.HB(d,g.Cb(c.data)),g.IB(d,b),g.Qt(d),a=this.HE,null===a||a instanceof G||(a=g.copyNodeData(a),D.Ta(a)&&(g.Vl(a),a=g.Cb(a),void 0!==a&&g.CE(d,a))),g=e.bg(d);return null};ra.prototype.doNoLink=function(){};
function Xh(){0<arguments.length&&D.td(Xh);Xi.call(this);this.name="Relinking";var a=new z;a.Jb="Diamond";a.Ea=be;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="pointer";a.Te=0;this.$C=a;a=new z;a.Jb="Diamond";a.Ea=be;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="pointer";a.Te=-1;this.mE=a;this.mc=null;this.MD=new B}D.Sa(Xh,Xi);D.ja("RelinkingTool",Xh);
Xh.prototype.updateAdornments=function(a){if(null!==a&&a instanceof J){var b="RelinkFrom",c=null;if(a.hb&&null!==this.g&&!this.g.mb){var d=a.ro;null!==d&&a.canRelinkFrom()&&a.$.F()&&a.isVisible()&&d.$.F()&&d.Nj()&&(c=a.nq(b),null===c&&(c=this.makeAdornment(d,!1),a.Ul(b,c)))}null===c&&a.Tj(b);b="RelinkTo";c=null;a.hb&&null!==this.g&&!this.g.mb&&(d=a.ro,null!==d&&a.canRelinkTo()&&a.$.F()&&a.isVisible()&&d.$.F()&&d.Nj()&&(c=a.nq(b),null===c&&(c=this.makeAdornment(d,!0),a.Ul(b,c))));null===c&&a.Tj(b)}};
Xh.prototype.makeAdornment=function(a,b){var c=new da;c.type=kj;var d=b?this.qK:this.FI;null!==d&&c.add(d.copy());c.zb=a;return c};D.defineProperty(Xh,{FI:"fromHandleArchetype"},function(){return this.$C},function(a){null!==a&&D.l(a,P,Xh,"fromHandleArchetype");this.$C=a});D.defineProperty(Xh,{qK:"toHandleArchetype"},function(){return this.mE},function(a){null!==a&&D.l(a,P,Xh,"toHandleArchetype");this.mE=a});D.w(Xh,{handle:"handle"},function(){return this.mc});
Xh.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;if(null===a||a.mb||a.Ff||!a.Cn)return!1;var b=a.ga;if(!(b instanceof Y||b instanceof wg)||!a.U.left)return!1;b=this.findToolHandleAt(a.Kc.ha,"RelinkFrom");null===b&&(b=this.findToolHandleAt(a.Kc.ha,"RelinkTo"));return null!==b};
Xh.prototype.doActivate=function(){var a=this.g;if(null!==a){if(null===this.rc){var b=this.findToolHandleAt(a.Kc.ha,"RelinkFrom");null===b&&(b=this.findToolHandleAt(a.Kc.ha,"RelinkTo"));if(null===b)return;var c=b.Y;if(!(c instanceof da&&c.Zf instanceof J))return;this.mc=b;this.Yd=null===c||"RelinkTo"===c.Dd;this.rc=c.Zf}this.$b(this.name);a.jf=!0;a.jc="pointer";this.ah=this.rc.dd;this.$g=this.rc.aa;this.dh=this.rc.Ld;this.bh=this.rc.da;this.MD.set(this.rc.$);null!==this.rc&&0<this.rc.ta&&(null===
this.rc.aa&&(null!==this.wo&&(this.wo.Ea=Zd),null!==this.ae&&(this.ae.location=this.rc.n(0))),null===this.rc.da&&(null!==this.xo&&(this.xo.Ea=Zd),null!==this.be&&(this.be.location=this.rc.n(this.rc.ta-1))));this.copyPortProperties(this.$g,this.ah,this.ae,this.wo,!1);this.copyPortProperties(this.bh,this.dh,this.be,this.xo,!0);a.add(this.ae);a.add(this.be);null!==this.hh&&(null!==this.ae&&(this.hh.aa=this.ae),null!==this.be&&(this.hh.da=this.be),this.copyLinkProperties(this.rc,this.hh),this.hh.fc(),
a.add(this.hh));this.wa=!0}};Xh.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.St=a.St;b.yA=a.yA;var c=a.gf;if(c===lj||c===mj)c=nj;b.gf=c;b.yx=a.yx;b.Ay=a.Ay;b.Tq=a.Tq;b.Gb=a.Gb;b.nm=a.nm;b.nu=a.nu;b.ou=a.ou;b.Hb=a.Hb;b.Dm=a.Dm;b.fv=a.fv;b.gv=a.gv}};Xh.prototype.doDeactivate=function(){this.wa=!1;var a=this.g;null!==a&&(a.remove(this.hh),a.remove(this.ae),a.remove(this.be),a.jf=!1,a.jc="",this.bl())};Xh.prototype.doStop=function(){Xi.prototype.doStop.call(this);this.mc=null};
Xh.prototype.doMouseUp=function(){if(this.wa){var a=this.g;if(null===a)return;this.Pf=null;var b=this.$g,c=this.ah,d=this.bh,e=this.dh,g=this.rc;this.Mf=this.findTargetPort(this.Yd);if(null!==this.Mf){var h=this.Mf.Y;h instanceof G&&(this.Yd?(d=h,e=this.Mf):(b=h,c=this.Mf))}else this.Aq?this.Yd?e=d=null:c=b=null:g=null;null!==g?(this.reconnectLink(g,this.Yd?d:b,this.Yd?e:c,this.Yd),null===this.Mf&&(this.Yd?g.jq=a.U.ha:g.iq=a.U.ha,g.fc()),a.Bf&&(g.hb=!0),this.Pf=this.name,a.Ja("LinkRelinked",g,this.Yd?
this.dh:this.ah)):this.doNoRelink(this.rc,this.Yd);oj(this.rc,this.MD)}this.stopTool()};Xh.prototype.reconnectLink=function(a,b,c,d){if(null===this.g)return!1;c=null!==c&&null!==c.sd?c.sd:"";d?(a.da=b,a.jh=c):(a.aa=b,a.cg=c);return!0};Xh.prototype.doNoRelink=function(){};function Si(a,b,c,d,e){null!==a.g&&(null!==b?(a.copyPortProperties(b,c,a.ae,a.wo,!1),a.g.add(a.ae)):a.g.remove(a.ae),null!==d?(a.copyPortProperties(d,e,a.be,a.xo,!0),a.g.add(a.be)):a.g.remove(a.be))}
function xj(){0<arguments.length&&D.td(xj);Sg.call(this);this.name="LinkReshaping";var a=new z;a.Jb="Rectangle";a.Ea=ae;a.fill="lightblue";a.stroke="dodgerblue";this.vl=a;a=new z;a.Jb="Diamond";a.Ea=ae;a.fill="lightblue";a.stroke="dodgerblue";this.xD=a;this.TD=3;this.Yy=this.mc=null;this.Dp=new O;this.Aw=null}D.Sa(xj,Sg);D.ja("LinkReshapingTool",xj);var yj;xj.None=yj=D.s(xj,"None",0);var zj;xj.Horizontal=zj=D.s(xj,"Horizontal",1);var Aj;xj.Vertical=Aj=D.s(xj,"Vertical",2);var Mj;
xj.All=Mj=D.s(xj,"All",3);xj.prototype.getReshapingBehavior=xj.prototype.wF=function(a){return a&&a.Uz?a.Uz:yj};xj.prototype.setReshapingBehavior=xj.prototype.$u=function(a,b){D.l(a,P,xj,"setReshapingBehavior:obj");D.Ca(b,xj,xj,"setReshapingBehavior:behavior");a.Uz=b};
xj.prototype.updateAdornments=function(a){if(null!==a&&a instanceof J){if(a.hb&&null!==this.g&&!this.g.mb){var b=a.path;if(null!==b&&a.canReshape()&&a.$.F()&&a.isVisible()&&b.$.F()&&b.Nj()){var c=a.nq(this.name);if(null===c||c.FD!==a.ta||c.vE!==a.Vu)c=this.makeAdornment(b),null!==c&&(c.FD=a.ta,c.vE=a.Vu,a.Ul(this.name,c));if(null!==c){c.location=a.position;return}}}a.Tj(this.name)}};
xj.prototype.makeAdornment=function(a){var b=a.Y,c=b.ta,d=b.qc,e=null;if(null!==b.points&&1<c){e=new da;e.type=kj;var c=b.ju,g=b.ay,h=d?1:0;if(b.Vu&&b.gf!==Nj)for(var k=c+h;k<g-h;k++){var l=this.makeResegmentHandle(a,k);null!==l&&(l.Te=k,l.zB=.5,l.MA=999,e.add(l))}for(k=c+1;k<g;k++)if(l=this.makeHandle(a,k),null!==l){l.Te=k;if(k!==c)if(k===c+1&&d){var h=b.n(c),m=b.n(c+1);Q(h.x,m.x)&&Q(h.y,m.y)&&(m=b.n(c-1));Q(h.x,m.x)?(this.$u(l,Aj),l.cursor="n-resize"):Q(h.y,m.y)&&(this.$u(l,zj),l.cursor="w-resize")}else k===
g-1&&d?(h=b.n(g-1),m=b.n(g),Q(h.x,m.x)&&Q(h.y,m.y)&&(h=b.n(g+1)),Q(h.x,m.x)?(this.$u(l,Aj),l.cursor="n-resize"):Q(h.y,m.y)&&(this.$u(l,zj),l.cursor="w-resize")):k!==g&&(this.$u(l,Mj),l.cursor="move");e.add(l)}e.zb=a}return e};xj.prototype.makeHandle=function(){var a=this.qu;return null===a?null:a.copy()};D.defineProperty(xj,{qu:"handleArchetype"},function(){return this.vl},function(a){null!==a&&D.l(a,P,xj,"handleArchetype");this.vl=a});
xj.prototype.makeResegmentHandle=function(){var a=this.FJ;return null===a?null:a.copy()};D.defineProperty(xj,{FJ:"midHandleArchetype"},function(){return this.xD},function(a){null!==a&&D.l(a,P,xj,"midHandleArchetype");this.xD=a});D.w(xj,{handle:"handle"},function(){return this.mc});D.w(xj,{Tt:"adornedLink"},function(){return this.Yy});xj.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;return null!==a&&!a.mb&&a.lx&&a.U.left?null!==this.findToolHandleAt(a.Kc.ha,this.name):!1};
xj.prototype.doActivate=function(){var a=this.g;if(null!==a&&(this.mc=this.findToolHandleAt(a.Kc.ha,this.name),null!==this.mc)){var b=this.mc.Y.Zf;if(b instanceof J){this.Yy=b;a.jf=!0;this.$b(this.name);if(b.Vu&&999===this.mc.MA){var c=b.points.copy(),d=this.mc.eb(gc);c.Xd(this.mc.Te+1,d);b.qc&&c.Xd(this.mc.Te+1,d);b.points=c;b.ne();this.mc=this.findToolHandleAt(a.Kc.ha,this.name);if(null===this.mc){this.doDeactivate();return}}this.Dp=b.n(this.mc.Te);this.Aw=b.points.copy();this.wa=!0}}};
xj.prototype.doDeactivate=function(){this.bl();this.Yy=this.mc=null;var a=this.g;null!==a&&(a.jf=!1);this.wa=!1};xj.prototype.doCancel=function(){var a=this.Tt;null!==a&&(a.points=this.Aw);this.stopTool()};xj.prototype.doMouseMove=function(){var a=this.g;this.wa&&null!==a&&(a=this.computeReshape(a.U.ha),this.reshape(a))};
xj.prototype.doMouseUp=function(){var a=this.g;if(this.wa&&null!==a){var b=this.computeReshape(a.U.ha);this.reshape(b);b=this.Tt;if(null!==b&&b.Vu){var c=this.handle.Te,d=b.n(c-1),e=b.n(c),g=b.n(c+1);if(b.qc){if(c>b.ju+1&&c<b.ay-1){var h=b.n(c-2);if(Math.abs(d.x-e.x)<this.Th&&Math.abs(d.y-e.y)<this.Th&&(Oj(this,h,d,e,g,!0)||Oj(this,h,d,e,g,!1))){var k=b.points.copy();Oj(this,h,d,e,g,!0)?(k.qg(c-2,new O(h.x,(g.y+h.y)/2)),k.qg(c+1,new O(g.x,(g.y+h.y)/2))):(k.qg(c-2,new O((g.x+h.x)/2,h.y)),k.qg(c+1,
new O((g.x+h.x)/2,g.y)));k.jd(c);k.jd(c-1);b.points=k;b.ne()}else h=b.n(c+2),Math.abs(e.x-g.x)<this.Th&&Math.abs(e.y-g.y)<this.Th&&(Oj(this,d,e,g,h,!0)||Oj(this,d,e,g,h,!1))&&(k=b.points.copy(),Oj(this,d,e,g,h,!0)?(k.qg(c-1,new O(d.x,(d.y+h.y)/2)),k.qg(c+2,new O(h.x,(d.y+h.y)/2))):(k.qg(c-1,new O((d.x+h.x)/2,d.y)),k.qg(c+2,new O((d.x+h.x)/2,h.y))),k.jd(c+1),k.jd(c),b.points=k,b.ne())}}else h=D.P(),fb(d.x,d.y,g.x,g.y,e.x,e.y,h)&&h.Cf(e)<this.Th*this.Th&&(k=b.points.copy(),k.jd(c),b.points=k,b.ne()),
D.A(h)}a.yc();this.Pf=this.name;a.Ja("LinkReshaped",this.Tt,this.Aw)}this.stopTool()};function Oj(a,b,c,d,e,g){return g?Math.abs(b.y-c.y)<a.Th&&Math.abs(c.y-d.y)<a.Th&&Math.abs(d.y-e.y)<a.Th:Math.abs(b.x-c.x)<a.Th&&Math.abs(c.x-d.x)<a.Th&&Math.abs(d.x-e.x)<a.Th}D.defineProperty(xj,{Th:"resegmentingDistance"},function(){return this.TD},function(a){D.h(a,"number",xj,"resegmentingDistance");this.TD=a});
xj.prototype.reshape=function(a){var b=this.Tt;b.zm();var c=this.handle.Te,d=this.wF(this.handle);if(b.qc)if(c===b.ju+1)c=b.ju+1,d===Aj?(b.ia(c,b.n(c-1).x,a.y),b.ia(c+1,b.n(c+2).x,a.y)):d===zj&&(b.ia(c,a.x,b.n(c-1).y),b.ia(c+1,a.x,b.n(c+2).y));else if(c===b.ay-1)c=b.ay-1,d===Aj?(b.ia(c-1,b.n(c-2).x,a.y),b.ia(c,b.n(c+1).x,a.y)):d===zj&&(b.ia(c-1,a.x,b.n(c-2).y),b.ia(c,a.x,b.n(c+1).y));else{var d=c,e=b.n(d),g=b.n(d-1),h=b.n(d+1);Q(g.x,e.x)&&Q(e.y,h.y)?(Q(g.x,b.n(d-2).x)&&!Q(g.y,b.n(d-2).y)?(b.B(d,a.x,
g.y),c++,d++):b.ia(d-1,a.x,g.y),Q(h.y,b.n(d+2).y)&&!Q(h.x,b.n(d+2).x)?b.B(d+1,h.x,a.y):b.ia(d+1,h.x,a.y)):Q(g.y,e.y)&&Q(e.x,h.x)?(Q(g.y,b.n(d-2).y)&&!Q(g.x,b.n(d-2).x)?(b.B(d,g.x,a.y),c++,d++):b.ia(d-1,g.x,a.y),Q(h.x,b.n(d+2).x)&&!Q(h.y,b.n(d+2).y)?b.B(d+1,a.x,h.y):b.ia(d+1,a.x,h.y)):Q(g.x,e.x)&&Q(e.x,h.x)?(Q(g.x,b.n(d-2).x)&&!Q(g.y,b.n(d-2).y)?(b.B(d,a.x,g.y),c++,d++):b.ia(d-1,a.x,g.y),Q(h.x,b.n(d+2).x)&&!Q(h.y,b.n(d+2).y)?b.B(d+1,a.x,h.y):b.ia(d+1,a.x,h.y)):Q(g.y,e.y)&&Q(e.y,h.y)&&(Q(g.y,b.n(d-
2).y)&&!Q(g.x,b.n(d-2).x)?(b.B(d,g.x,a.y),c++,d++):b.ia(d-1,g.x,a.y),Q(h.y,b.n(d+2).y)&&!Q(h.x,b.n(d+2).x)?b.B(d+1,h.x,a.y):b.ia(d+1,h.x,a.y));b.ia(c,a.x,a.y)}else b.ia(c,a.x,a.y),1===c&&b.computeSpot(!0).Zd()&&(e=b.aa,g=b.dd,null===e||e.isVisible()||(e=e.findVisibleNode(),e!==b.aa&&(g=e.km(""))),d=g.eb(gc,D.P()),e=b.getLinkPointFromPoint(e,g,d,a,!0,D.P()),b.ia(0,e.x,e.y),D.A(d),D.A(e)),c===b.ta-2&&b.computeSpot(!1).Zd()&&(c=b.da,e=b.Ld,null===c||c.isVisible()||(c=c.findVisibleNode(),c!==b.da&&(e=
c.km(""))),d=e.eb(gc,D.P()),e=b.getLinkPointFromPoint(c,e,d,a,!1,D.P()),b.ia(b.ta-1,e.x,e.y),D.A(d),D.A(e));b.Aj()};xj.prototype.computeReshape=function(a){var b=this.Tt,c=this.handle.Te;switch(this.wF(this.handle)){case Mj:return a;case Aj:return b=b.n(c),new O(b.x,a.y);case zj:return b=b.n(c),new O(a.x,b.y);default:case yj:return b.n(c)}};D.w(xj,{dM:"originalPoint"},function(){return this.Dp});D.w(xj,{eM:"originalPoints"},function(){return this.Aw});
function Pj(){0<arguments.length&&D.td(Pj);Sg.call(this);this.name="Resizing";this.li=(new Ca(1,1)).freeze();this.ki=(new Ca(9999,9999)).freeze();this.bk=(new Ca(NaN,NaN)).freeze();this.fs=!1;this.Pc=null;var a=new z;a.Gh=gc;a.Jb="Rectangle";a.Ea=ae;a.fill="lightblue";a.stroke="dodgerblue";a.jb=1;a.cursor="pointer";this.vl=a;this.mc=null;this.Dp=new O;this.HD=new Ca;this.ND=new O;this.yz=new Ca(0,0);this.xz=new Ca(Infinity,Infinity);this.wz=new Ca(1,1);this.ED=!0}D.Sa(Pj,Sg);D.ja("ResizingTool",Pj);
Pj.prototype.updateAdornments=function(a){if(!(null===a||a instanceof J)){if(a.hb&&null!==this.g&&!this.g.mb){var b=a.CG;if(null!==b&&a.canResize()&&a.$.F()&&a.isVisible()&&b.$.F()&&b.Nj()){var c=a.nq(this.name);if(null===c||c.zb!==b)c=this.makeAdornment(b);if(null!==c){var d=b.Rn();c.angle=d;var e=b.eb(c.Kf,D.P()),g=b.Fj();c.location=e;D.A(e);e=c.placeholder;if(null!==e){var b=b.Ga,h=D.Cm();h.m(b.width*g,b.height*g);e.Ea=h;D.Rk(h)}this.updateResizeHandles(c,d);a.Ul(this.name,c);return}}}a.Tj(this.name)}};
Pj.prototype.makeAdornment=function(a){var b=null,b=a.Y.BG;if(null===b){b=new da;b.type=Qj;b.Kf=gc;var c=new Rj;c.Gf=!0;b.add(c);b.add(this.makeHandle(a,cc));b.add(this.makeHandle(a,ec));b.add(this.makeHandle(a,rc));b.add(this.makeHandle(a,pc));b.add(this.makeHandle(a,Yc));b.add(this.makeHandle(a,fd));b.add(this.makeHandle(a,gd));b.add(this.makeHandle(a,ed))}else if(Kh(b),b=b.copy(),null===b)return null;b.zb=a;return b};
Pj.prototype.makeHandle=function(a,b){var c=this.qu;if(null===c)return null;c=c.copy();c.alignment=b;return c};
Pj.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.ed()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.Zd()&&(c=gc);var d=b;if(0>=c.x)d=0>=c.y?d+225:1<=c.y?d+135:d+180;else if(1<=c.x)0>=c.y?d+=315:1<=c.y&&(d+=45);else if(0>=c.y)d+=270;else if(1<=c.y)d+=90;else break a;0>d?d+=360:360<=d&&(d-=360);a.cursor=22.5>d?"e-resize":67.5>d?"se-resize":112.5>d?"s-resize":157.5>d?"sw-resize":202.5>d?"w-resize":247.5>d?"nw-resize":292.5>d?"n-resize":337.5>d?
"ne-resize":"e-resize"}else if(a instanceof x)for(c=a.elements;c.next();)this.updateResizeHandles(c.value,b)};D.defineProperty(Pj,{qu:"handleArchetype"},function(){return this.vl},function(a){null!==a&&D.l(a,P,Pj,"handleArchetype");this.vl=a});D.w(Pj,{handle:"handle"},function(){return this.mc});D.defineProperty(Pj,{zb:"adornedObject"},function(){return this.Pc},function(a){null!==a&&D.l(a,P,Pj,"adornedObject");this.Pc=a});
Pj.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;return null!==a&&!a.mb&&a.Wt&&a.U.left?null!==this.findToolHandleAt(a.Kc.ha,this.name):!1};
Pj.prototype.doActivate=function(){var a=this.g;null!==a&&(this.mc=this.findToolHandleAt(a.Kc.ha,this.name),null!==this.mc&&(this.Pc=this.mc.Y.zb,this.Dp.set(this.zb.eb(this.handle.alignment.kG())),this.ND.set(this.Pc.Y.location),this.HD.set(this.Pc.Ea),this.wz=this.computeCellSize(),this.yz=this.computeMinSize(),this.xz=this.computeMaxSize(),a.jf=!0,this.ED=a.Xa.isEnabled,a.Xa.isEnabled=!1,this.$b(this.name),this.wa=!0))};
Pj.prototype.doDeactivate=function(){var a=this.g;null!==a&&(this.bl(),this.Pc=this.mc=null,this.wa=a.jf=!1,a.Xa.isEnabled=this.ED)};Pj.prototype.doCancel=function(){null!==this.zb&&(this.zb.Ea=this.lG,this.zb.Y.location=this.OJ);this.stopTool()};Pj.prototype.doMouseMove=function(){var a=this.g;if(this.wa&&null!==a){var b=this.yz,c=this.xz,d=this.wz,e=this.zb.uF(a.U.ha,D.P()),g=this.computeReshape(),b=this.computeResize(e,this.handle.alignment,b,c,d,g);this.resize(b);a.gg();D.A(e)}};
Pj.prototype.doMouseUp=function(){var a=this.g;if(this.wa&&null!==a){var b=this.yz,c=this.xz,d=this.wz,e=this.zb.uF(a.U.ha,D.P()),g=this.computeReshape(),b=this.computeResize(e,this.handle.alignment,b,c,d,g);this.resize(b);D.A(e);a.yc();this.Pf=this.name;a.Ja("PartResized",this.zb,this.lG)}this.stopTool()};
Pj.prototype.resize=function(a){if(null!==this.g){var b=this.zb,c=b.Y;b.Ea=a.size;c.hf();a=this.zb.eb(this.handle.alignment.kG());c instanceof I?(a=c.position.copy().vo(a).add(this.Dp),c.move(a)):c.location=c.location.copy().vo(a).add(this.Dp)}};
Pj.prototype.computeResize=function(a,b,c,d,e,g){b.Zd()&&(b=gc);var h=this.zb.Ga,k=h.x,l=h.y,m=h.x+h.width,n=h.y+h.height,p=1;if(!g){var p=h.width,q=h.height;0>=p&&(p=1);0>=q&&(q=1);p=q/p}q=D.P();gb(a.x,a.y,k,l,e.width,e.height,q);a=h.copy();0>=b.x?0>=b.y?(a.x=Math.max(q.x,m-d.width),a.x=Math.min(a.x,m-c.width),a.width=Math.max(m-a.x,c.width),a.y=Math.max(q.y,n-d.height),a.y=Math.min(a.y,n-c.height),a.height=Math.max(n-a.y,c.height),g||(b=a.height/a.width,p<b?(a.height=p*a.width,a.y=n-a.height):(a.width=
a.height/p,a.x=m-a.width))):1<=b.y?(a.x=Math.max(q.x,m-d.width),a.x=Math.min(a.x,m-c.width),a.width=Math.max(m-a.x,c.width),a.height=Math.max(Math.min(q.y-l,d.height),c.height),g||(b=a.height/a.width,p<b?a.height=p*a.width:(a.width=a.height/p,a.x=m-a.width))):(a.x=Math.max(q.x,m-d.width),a.x=Math.min(a.x,m-c.width),a.width=m-a.x,g||(a.height=p*a.width,a.y=l+.5*(n-l-a.height))):1<=b.x?0>=b.y?(a.width=Math.max(Math.min(q.x-k,d.width),c.width),a.y=Math.max(q.y,n-d.height),a.y=Math.min(a.y,n-c.height),
a.height=Math.max(n-a.y,c.height),g||(b=a.height/a.width,p<b?(a.height=p*a.width,a.y=n-a.height):a.width=a.height/p)):1<=b.y?(a.width=Math.max(Math.min(q.x-k,d.width),c.width),a.height=Math.max(Math.min(q.y-l,d.height),c.height),g||(b=a.height/a.width,p<b?a.height=p*a.width:a.width=a.height/p)):(a.width=Math.max(Math.min(q.x-k,d.width),c.width),g||(a.height=p*a.width,a.y=l+.5*(n-l-a.height))):0>=b.y?(a.y=Math.max(q.y,n-d.height),a.y=Math.min(a.y,n-c.height),a.height=n-a.y,g||(a.width=a.height/p,a.x=
k+.5*(m-k-a.width))):1<=b.y&&(a.height=Math.max(Math.min(q.y-l,d.height),c.height),g||(a.width=a.height/p,a.x=k+.5*(m-k-a.width)));D.A(q);return a};Pj.prototype.computeReshape=function(){var a=Sj;this.zb instanceof z&&(a=Tj(this.zb));return!(a===Uj||a===Vj||null!==this.g&&this.g.U.shift)};Pj.prototype.computeMinSize=function(){var a=this.zb.hg.copy(),b=this.hg;!isNaN(b.width)&&b.width>a.width&&(a.width=b.width);!isNaN(b.height)&&b.height>a.height&&(a.height=b.height);return a};
Pj.prototype.computeMaxSize=function(){var a=this.zb.kf.copy(),b=this.kf;!isNaN(b.width)&&b.width<a.width&&(a.width=b.width);!isNaN(b.height)&&b.height<a.height&&(a.height=b.height);return a};
Pj.prototype.computeCellSize=function(){var a=new Ca(NaN,NaN),b=this.zb.Y;if(null!==b){var c=b.XJ;!isNaN(c.width)&&0<c.width&&(a.width=c.width);!isNaN(c.height)&&0<c.height&&(a.height=c.height)}c=this.bq;isNaN(a.width)&&!isNaN(c.width)&&0<c.width&&(a.width=c.width);isNaN(a.height)&&!isNaN(c.height)&&0<c.height&&(a.height=c.height);b=this.g;(isNaN(a.width)||isNaN(a.height))&&b&&(c=b.kb.De,null!==c&&c.Tx&&(c=c.CF,isNaN(a.width)&&!isNaN(c.width)&&0<c.width&&(a.width=c.width),isNaN(a.height)&&!isNaN(c.height)&&
0<c.height&&(a.height=c.height)),b=b.Vn,null!==b&&b.visible&&this.Tx&&(c=b.Ox,isNaN(a.width)&&!isNaN(c.width)&&0<c.width&&(a.width=c.width),isNaN(a.height)&&!isNaN(c.height)&&0<c.height&&(a.height=c.height)));if(isNaN(a.width)||0===a.width||Infinity===a.width)a.width=1;if(isNaN(a.height)||0===a.height||Infinity===a.height)a.height=1;return a};
D.defineProperty(Pj,{hg:"minSize"},function(){return this.li},function(a){D.l(a,Ca,Pj,"minSize");if(!this.li.O(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.li.m(b,a)}});D.defineProperty(Pj,{kf:"maxSize"},function(){return this.ki},function(a){D.l(a,Ca,Pj,"maxSize");if(!this.ki.O(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity);this.ki.m(b,a)}});
D.defineProperty(Pj,{bq:"cellSize"},function(){return this.bk},function(a){D.l(a,Ca,Pj,"cellSize");this.bk.O(a)||this.bk.assign(a)});D.defineProperty(Pj,{Tx:"isGridSnapEnabled"},function(){return this.fs},function(a){D.h(a,"boolean",Pj,"isGridSnapEnabled");this.fs=a});D.w(Pj,{lG:"originalDesiredSize"},function(){return this.HD});D.w(Pj,{OJ:"originalLocation"},function(){return this.ND});
function Wj(){0<arguments.length&&D.td(Wj);Sg.call(this);this.name="Rotating";this.YD=45;this.XD=2;this.Pc=null;var a=new z;a.Jb="Ellipse";a.Ea=be;a.fill="lightblue";a.stroke="dodgerblue";a.jb=1;a.cursor="pointer";this.vl=a;this.mc=null;this.zw=0;this.UD=new O}D.Sa(Wj,Sg);D.ja("RotatingTool",Wj);
Wj.prototype.updateAdornments=function(a){if(!(null===a||a instanceof J)){if(a.hb&&null!==this.g&&!this.g.mb){var b=a.GG;if(null!==b&&a.canRotate()&&a.$.F()&&a.isVisible()&&b.$.F()&&b.Nj()){var c=a.nq(this.name);if(null===c||c.zb!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.Rn();var d=null,e=null;b===a||b===a.uf?(d=a.uf,e=a.Kf):(d=b,e=gc);for(var g=d.Ga,e=D.Fb(g.width*e.x+e.offsetX,g.height*e.y+e.offsetY);null!==d&&d!==b;)d.transform.vb(e),d=d.Q;var d=e.y,g=Math.max(e.x-b.Ga.width,0),h=D.P();
c.location=b.eb(new R(1,0,50+g,d),h);D.A(h);D.A(e);a.Ul(this.name,c);return}}}a.Tj(this.name)}};Wj.prototype.makeAdornment=function(a){var b=null,b=a.Y.ZJ;if(null===b){b=new da;b.type=Xj;b.Kf=gc;var c=this.qu;null!==c&&b.add(c.copy())}else if(Kh(b),b=b.copy(),null===b)return null;b.zb=a;return b};D.defineProperty(Wj,{qu:"handleArchetype"},function(){return this.vl},function(a){null!==a&&D.l(a,P,Wj,"handleArchetype");this.vl=a});D.w(Wj,{handle:"handle"},function(){return this.mc});
D.defineProperty(Wj,{zb:"adornedObject"},function(){return this.Pc},function(a){null!==a&&D.l(a,P,Wj,"adornedObject");this.Pc=a});Wj.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;return null!==a&&!a.mb&&a.mx&&a.U.left?null!==this.findToolHandleAt(a.Kc.ha,this.name):!1};
Wj.prototype.doActivate=function(){var a=this.g;if(null!==a&&(this.mc=this.findToolHandleAt(a.Kc.ha,this.name),null!==this.mc)){this.Pc=this.mc.Y.zb;var b=this.Pc.Y,c=b.uf;this.UD=this.Pc===b||this.Pc===c?c.eb(b.Kf):this.Pc.eb(gc);this.zw=this.Pc.angle;a.jf=!0;a.AA=!0;this.$b(this.name);this.wa=!0}};Wj.prototype.doDeactivate=function(){var a=this.g;null!==a&&(this.bl(),this.Pc=this.mc=null,this.wa=a.jf=!1)};Wj.prototype.doCancel=function(){var a=this.g;null!==a&&(a.AA=!1);this.rotate(this.zw);this.stopTool()};
Wj.prototype.doMouseMove=function(){var a=this.g;this.wa&&null!==a&&(a=this.computeRotate(a.U.ha),this.rotate(a))};Wj.prototype.doMouseUp=function(){var a=this.g;if(this.wa&&null!==a){a.AA=!1;var b=this.computeRotate(a.U.ha);this.rotate(b);a.yc();this.Pf=this.name;a.Ja("PartRotated",this.Pc,this.zw)}this.stopTool()};Wj.prototype.rotate=function(a){v&&D.p(a,Wj,"rotate:newangle");null!==this.Pc&&(this.Pc.angle=a)};
Wj.prototype.computeRotate=function(a){a=this.UD.Jc(a);var b=this.Pc.Q;null!==b&&(a-=b.Rn(),360<=a?a-=360:0>a&&(a+=360));var b=Math.min(Math.abs(this.kK),180),c=Math.min(Math.abs(this.jK),b/2);(null===this.g||!this.g.U.shift)&&0<b&&0<c&&(a%b<c?a=Math.floor(a/b)*b:a%b>b-c&&(a=(Math.floor(a/b)+1)*b));360<=a?a-=360:0>a&&(a+=360);return a};D.defineProperty(Wj,{kK:"snapAngleMultiple"},function(){return this.YD},function(a){D.h(a,"number",Wj,"snapAngleMultiple");this.YD=a});
D.defineProperty(Wj,{jK:"snapAngleEpsilon"},function(){return this.XD},function(a){D.h(a,"number",Wj,"snapAngleEpsilon");this.XD=a});D.w(Wj,{cM:"originalAngle"},function(){return this.zw});function Yj(){Sg.call(this);0<arguments.length&&D.td(Yj);this.name="ClickSelecting"}D.Sa(Yj,Sg);D.ja("ClickSelectingTool",Yj);Yj.prototype.canStart=function(){return!this.isEnabled||null===this.g||this.isBeyondDragSize()?!1:!0};
Yj.prototype.doMouseUp=function(){this.wa&&(this.standardMouseSelect(),!this.standardMouseClick()&&null!==this.g&&this.g.U.Lj&&this.g.kb.doToolTip());this.stopTool()};function Zj(){Sg.call(this);0<arguments.length&&D.td(Zj);this.name="Action";this.Do=null}D.Sa(Zj,Sg);D.ja("ActionTool",Zj);
Zj.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;if(null===a)return!1;var b=a.U,c=a.Ge(b.ha,function(a){for(;null!==a.Q&&!a.tu;)a=a.Q;return a});if(null!==c){if(!c.tu)return!1;this.Do=c;a.Qo=a.Ge(b.ha,null,null);return!0}return!1};Zj.prototype.doMouseDown=function(){if(this.wa){var a=this.g.U,b=this.Do;null!==b&&(a.We=b,null!==b.yE&&b.yE(a,b))}else this.canStart()&&this.doActivate()};
Zj.prototype.doMouseMove=function(){if(this.wa){var a=this.g.U,b=this.Do;null!==b&&(a.We=b,null!==b.zE&&b.zE(a,b))}};Zj.prototype.doMouseUp=function(){if(this.wa){var a=this.g,b=a.U,c=this.Do;if(null===c)return;b.We=c;null!==c.AE&&c.AE(b,c);this.isBeyondDragSize()||Rh(c,b,a)}this.stopTool()};Zj.prototype.doCancel=function(){var a=this.g;if(null!==a){var a=a.U,b=this.Do;if(null===b)return;a.We=b;null!==b.xE&&b.xE(a,b)}this.stopTool()};Zj.prototype.doStop=function(){this.Do=null};
function ta(){Sg.call(this);0<arguments.length&&D.td(ta);this.name="ClickCreating";this.ol=null;this.kD=!0;this.ZC=new O(0,0)}D.Sa(ta,Sg);D.ja("ClickCreatingTool",ta);
ta.prototype.canStart=function(){if(!this.isEnabled||null===this.pA)return!1;var a=this.g;if(null===a||a.mb||a.Ff||!a.Zp||!a.U.left||this.isBeyondDragSize())return!1;if(this.eJ){if(1===a.U.Oe&&(this.ZC=a.U.qe.copy()),2!==a.U.Oe||this.isBeyondDragSize(this.ZC))return!1}else if(1!==a.U.Oe)return!1;return a.gb!==this&&null!==a.iu(a.U.ha,!0)?!1:!0};ta.prototype.doMouseUp=function(){var a=this.g;this.wa&&null!==a&&this.insertPart(a.U.ha);this.stopTool()};
ta.prototype.insertPart=function(a){var b=this.g;if(null===b)return null;var c=this.pA;if(null===c)return null;this.$b(this.name);var d=null;c instanceof F?c.oe()&&(Kh(c),d=c.copy(),null!==d&&b.add(d)):null!==c&&(c=b.ga.copyNodeData(c),D.Ta(c)&&(b.ga.Vl(c),d=b.Nh(c)));null!==d&&(d.location=a,b.Bf&&b.select(d));b.yc();this.Pf=this.name;b.Ja("PartCreated",d);this.bl();return d};
D.defineProperty(ta,{pA:"archetypeNodeData"},function(){return this.ol},function(a){null!==a&&D.l(a,Object,ta,"archetypeNodeData");this.ol=a});D.defineProperty(ta,{eJ:"isDoubleClick"},function(){return this.kD},function(a){D.h(a,"boolean",ta,"isDoubleClick");this.kD=a});function ak(){this.sE=this.vD=this.Fz=this.$z=null}D.ja("HTMLInfo",ak);D.defineProperty(ak,{cB:"mainElement"},function(){return this.vD},function(a){null!==a&&D.l(a,HTMLElement,ak,"mainElement");this.vD=a});
D.defineProperty(ak,{show:"show"},function(){return this.$z},function(a){this.$z!==a&&(null!==a&&D.h(a,"function",ak,"show"),this.$z=a)});D.defineProperty(ak,{Wn:"hide"},function(){return this.Fz},function(a){this.Fz!==a&&(null!==a&&D.h(a,"function",ak,"hide"),this.Fz=a)});D.defineProperty(ak,{YB:"valueFunction"},function(){return this.sE},function(a){this.sE=a});function bk(a,b,c){this.text=a;this.OE=b;this.visible=c}
function ck(){Sg.call(this);0<arguments.length&&D.td(ck);this.name="ContextMenu";this.CC=this.iz=this.zC=null;this.BD=new O;this.kz=this.Nm=null;var a=this;this.gA=function(){a.stopTool()};dk(this)}D.Sa(ck,Sg);D.ja("ContextMenuTool",ck);
function dk(a){var b=new ak;b.show=function(a,b,c){c.showDefaultContextMenu()};b.Wn=function(a,b){b.hideDefaultContextMenu()};a.Nm=b;a.gA=function(){a.stopTool()};if(!1===D.WE){var b=D.createElement("div"),c=D.createElement("div");b.style.cssText="top: 0px;z-index:300;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px";c.style.cssText="z-index:299;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";
var d=D.createElement("style");window.document.getElementsByTagName("head")[0].appendChild(d);d.sheet.insertRule(".goCXul { list-style: none; }",0);d.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }",0);d.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }",0);b.addEventListener("contextmenu",ek,!1);b.addEventListener("selectstart",ek,!1);
c.addEventListener("contextmenu",ek,!1);window.document.body&&(window.document.body.appendChild(b),window.document.body.appendChild(c));D.au=b;D.$t=c;D.WE=!0}}function ek(a){a.preventDefault();return!1}ck.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;return null===a||this.isBeyondDragSize()||!a.U.right?!1:null!==this.Nm&&a.U.Lj||null!==this.findObjectWithContextMenu()?!0:!1};ck.prototype.doStart=function(){var a=this.g;null!==a&&this.BD.set(a.Kc.ha)};
ck.prototype.doStop=function(){this.hideContextMenu();this.xx=null};ck.prototype.findObjectWithContextMenu=function(a){void 0===a&&(a=null);var b=this.g;if(null===b)return null;var c=b.U,d=null;a instanceof E||(d=a instanceof P?a:b.Ge(c.ha,null,function(a){return!a.layer.Tc}));if(null!==d){for(a=d;null!==a;){if(null!==a.contextMenu)return a;a=a.Q}if(null!==this.Nm&&b.U.Lj)return d.Y}else if(null!==b.contextMenu)return b;return null};ck.prototype.doActivate=function(){};
ck.prototype.doMouseDown=function(){Sg.prototype.doMouseDown.call(this);null!==this.g&&this.g.kb.lf.contains(this)&&fk(this)};ck.prototype.doMouseUp=function(){fk(this)};function fk(a){var b=a.g;if(null!==b)if(a.wa){var c=a.dm;if(null!==c){if(!(c instanceof ak)){var d=b.Ge(b.U.ha,null,null);null!==d&&d.tm(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.gb=a,a.doMouseUp())}}else a.canStart()&&(Ph(a,!0),a.wa||a.stopTool())}
function Ph(a,b,c){void 0===c&&(c=null);b&&a.standardMouseSelect();if(!a.standardMouseClick())if(a.wa=!0,b=a.Nm,null===c&&(c=a.findObjectWithContextMenu()),null!==c){var d=c.contextMenu;null!==d?(a.xx=c instanceof P?c:null,a.showContextMenu(d,a.xx)):null!==b&&a.showContextMenu(b,a.xx)}else null!==b&&a.showContextMenu(b,null)}ck.prototype.doMouseMove=function(){this.wa&&null!==this.g&&this.g.kb.doMouseMove()};
ck.prototype.showContextMenu=function(a,b){!v||a instanceof da||a instanceof ak||D.k("showContextMenu:contextMenu must be an Adornment or HTMLInfo.");null!==b&&D.l(b,P,ck,"showContextMenu:obj");var c=this.g;if(null!==c){a!==this.dm&&this.hideContextMenu();if(a instanceof da){a.Jf="Tool";a.$k=!1;a.scale=1/c.scale;a.Dd=this.name;null!==a.placeholder&&(a.placeholder.scale=c.scale);c.add(a);if(null!==b){var c=null,d=b.lm();null!==d&&(c=d.data);a.zb=b;a.data=c}else a.data=c.ga;a.hf();this.positionContextMenu(a,
b)}else a instanceof ak&&a.show(b,c,this);this.dm=a}};ck.prototype.positionContextMenu=function(a){if(null===a.placeholder){var b=this.g;if(null!==b){var c=b.U.ha.copy(),d=a.Fa,e=b.xb;b.U.Lj&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5);c.x<e.x&&(c.x=e.x);c.y+d.height>e.bottom&&(c.y-=d.height+5);c.y<e.y&&(c.y=e.y);a.position=c}}};
ck.prototype.hideContextMenu=function(){var a=this.g;if(null!==a){var b=this.dm;null!==b&&(b instanceof da?(a.remove(b),null!==this.iz&&this.iz.Tj(b.Dd),b.data=null,b.zb=null):b instanceof ak&&(null!==b.Wn?b.Wn(a,this):null!==b.cB&&(b.cB.style.display="none")),this.dm=null,this.standardMouseOver())}};
function gk(a){if(null===a.g)return null;a=new K(bk);a.add(new bk("Copy",function(a){a.wb.copySelection()},function(a){return a.wb.canCopySelection()}));a.add(new bk("Cut",function(a){a.wb.cutSelection()},function(a){return a.wb.canCutSelection()}));a.add(new bk("Delete",function(a){a.wb.deleteSelection()},function(a){return a.wb.canDeleteSelection()}));a.add(new bk("Paste",function(a){a.wb.pasteSelection(a.U.ha)},function(a){return a.wb.canPasteSelection()}));a.add(new bk("Select All",function(a){a.wb.selectAll()},
function(a){return a.wb.canSelectAll()}));a.add(new bk("Undo",function(a){a.wb.undo()},function(a){return a.wb.canUndo()}));a.add(new bk("Redo",function(a){a.wb.redo()},function(a){return a.wb.canRedo()}));a.add(new bk("Scroll To Part",function(a){a.wb.scrollToPart()},function(a){return a.wb.canScrollToPart()}));a.add(new bk("Zoom To Fit",function(a){a.wb.zoomToFit()},function(a){return a.wb.canZoomToFit()}));a.add(new bk("Reset Zoom",function(a){a.wb.resetZoom()},function(a){return a.wb.canResetZoom()}));
a.add(new bk("Group Selection",function(a){a.wb.groupSelection()},function(a){return a.wb.canGroupSelection()}));a.add(new bk("Ungroup Selection",function(a){a.wb.ungroupSelection()},function(a){return a.wb.canUngroupSelection()}));a.add(new bk("Edit Text",function(a){a.wb.editTextBlock()},function(a){return a.wb.canEditTextBlock()}));return a}
ck.prototype.showDefaultContextMenu=function(){var a=this.g;if(null!==a){null===this.kz&&(this.kz=gk(this));D.au.innerHTML="";D.$t.addEventListener("click",this.gA,!1);var b=this,c=D.createElement("ul");c.className="goCXul";D.au.appendChild(c);c.innerHTML="";for(var d=this.kz.j;d.next();){var e=d.value,g=e.visible;if("function"===typeof e.OE&&("function"!==typeof g||g(a))){g=D.createElement("li");g.className="goCXli";var h=D.createElement("a");h.className="goCXa";h.href="#";h.pH=e.OE;h.addEventListener("click",
function(c){this.pH(a);b.stopTool();c.preventDefault();return!1},!1);h.textContent=e.text;g.appendChild(h);c.appendChild(g)}}D.au.style.display="block";D.$t.style.display="block"}};ck.prototype.hideDefaultContextMenu=function(){null!==this.dm&&this.dm===this.Nm&&(D.au.style.display="none",D.$t.style.display="none",D.$t.removeEventListener("click",this.gA,!1),this.dm=null)};
D.defineProperty(ck,{dm:"currentContextMenu"},function(){return this.zC},function(a){!v||null===a||a instanceof da||a instanceof ak||D.k("ContextMenuTool.currentContextMenu must be an Adornment or HTMLInfo.");this.zC=a;this.iz=a instanceof da?a.Zf:null});D.defineProperty(ck,{tL:"defaultTouchContextMenu"},function(){return this.Nm},function(a){!v||null===a||a instanceof da||a instanceof ak||D.k("ContextMenuTool.defaultTouchContextMenu must be an Adornment or HTMLInfo.");this.Nm=a});
D.defineProperty(ck,{xx:"currentObject"},function(){return this.CC},function(a){null!==a&&D.l(a,P,ck,"currentObject");this.CC=a});D.w(ck,{XL:"mouseDownPoint"},function(){return this.BD});function hk(){Sg.call(this);0<arguments.length&&D.td(hk);this.name="DragSelecting";this.Wo=175;this.pD=!1;var a=new F;a.Jf="Tool";a.$k=!1;var b=new z;b.name="SHAPE";b.Jb="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.Jm=a}D.Sa(hk,Sg);D.ja("DragSelectingTool",hk);
hk.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;if(null===a||!a.Bf)return!1;var b=a.U;return!b.left||a.gb!==this&&(!this.isBeyondDragSize()||b.timestamp-a.Kc.timestamp<this.XE||null!==a.iu(b.ha,!0))?!1:!0};hk.prototype.doActivate=function(){var a=this.g;null!==a&&(this.wa=!0,a.jf=!0,a.Eb=!0,a.add(this.Jh),this.doMouseMove())};hk.prototype.doDeactivate=function(){var a=this.g;null!==a&&(yi(a),a.remove(this.Jh),a.Eb=!1,this.wa=a.jf=!1)};
hk.prototype.doMouseMove=function(){var a=this.g;if(null!==a&&this.wa&&null!==this.Jh){var b=this.computeBoxBounds(),c=this.Jh.Ed("SHAPE");null===c&&(c=this.Jh.Vd());c.Ea=b.size;this.Jh.position=b.position;(a.ye||a.ze)&&a.CA(a.U.qe)}};hk.prototype.doMouseUp=function(){if(this.wa){var a=this.g;a.remove(this.Jh);try{a.jc="wait",this.selectInRect(this.computeBoxBounds())}finally{a.jc=""}}this.stopTool()};
hk.prototype.computeBoxBounds=function(){var a=this.g;return null===a?new B(0,0,0,0):new B(a.Kc.ha,a.U.ha)};
hk.prototype.selectInRect=function(a){var b=this.g;if(null!==b){var c=b.U;b.Ja("ChangingSelection");a=b.Qk(a,null,function(a){return a instanceof F?a.canSelect():!1},this.kJ);if(D.Vk?c.Hu:c.control)if(c.shift)for(a=a.j;a.next();)c=a.value,c.hb&&(c.hb=!1);else for(a=a.j;a.next();)c=a.value,c.hb=!c.hb;else{if(!c.shift){for(var c=new K(F),d=b.selection.j;d.next();){var e=d.value;a.contains(e)||c.add(e)}for(c=c.j;c.next();)c.value.hb=!1}for(a=a.j;a.next();)c=a.value,c.hb||(c.hb=!0)}b.Ja("ChangedSelection")}};
D.defineProperty(hk,{XE:"delay"},function(){return this.Wo},function(a){D.h(a,"number",hk,"delay");this.Wo=a});D.defineProperty(hk,{kJ:"isPartialInclusion"},function(){return this.pD},function(a){D.h(a,"boolean",hk,"isPartialInclusion");this.pD=a});D.defineProperty(hk,{Jh:"box"},function(){return this.Jm},function(a){null!==a&&D.l(a,F,hk,"box");this.Jm=a});
function ik(){Sg.call(this);0<arguments.length&&D.td(ik);this.name="Panning";this.Sz=new O;this.ak=!1;var a=this;this.bE=function(){window.document.removeEventListener("scroll",a.bE,!1);a.stopTool()}}D.Sa(ik,Sg);D.ja("PanningTool",ik);ik.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;return null===a||!a.ye&&!a.ze||!a.U.left||a.gb!==this&&!this.isBeyondDragSize()?!1:!0};
ik.prototype.doActivate=function(){var a=this.g;null!==a&&(this.ak?(a.U.bubbles=!0,window.document.addEventListener("scroll",this.bE,!1)):(a.jc="move",a.jf=!0,this.Sz=a.position.copy()),this.wa=!0)};ik.prototype.doDeactivate=function(){var a=this.g;null!==a&&(a.jc="",this.wa=a.jf=!1)};ik.prototype.doCancel=function(){var a=this.g;null!==a&&(a.position=this.Sz,a.jf=!1);this.stopTool()};ik.prototype.doMouseMove=function(){this.move()};ik.prototype.doMouseUp=function(){this.move();this.stopTool()};
ik.prototype.move=function(){var a=this.g;if(this.wa&&a)if(this.ak)a.U.bubbles=!0;else{var b=a.position,c=a.Kc.ha,d=a.U.ha,e=b.x+c.x-d.x,c=b.y+c.y-d.y;a.ye||(e=b.x);a.ze||(c=b.y);a.position=new O(e,c)}};D.defineProperty(ik,{bubbles:"bubbles"},function(){return this.ak},function(a){D.h(a,"boolean",ik,"bubbles");this.ak=a});D.w(ik,{fM:"originalPosition"},function(){return this.Sz});
function jk(){0<arguments.length&&D.td(jk);Sg.call(this);this.name="TextEditing";this.eA=this.Ck=null;this.aE=kk;this.Ql=null;this.$a=lk;this.Ll=null;this.yD=1;this.VD=!0;var a=new ak;this.EC=null;this.MC=a;this.lz=null;mk(this,a)}D.ja("TextEditingTool",jk);D.Sa(jk,Sg);var nk;jk.LostFocus=nk=D.s(jk,"LostFocus",0);var ok;jk.MouseDown=ok=D.s(jk,"MouseDown",1);var pk;jk.Tab=pk=D.s(jk,"Tab",2);var qk;jk.Enter=qk=D.s(jk,"Enter",3);jk.SingleClick=D.s(jk,"SingleClick",0);var kk;
jk.SingleClickSelected=kk=D.s(jk,"SingleClickSelected",1);var rk;jk.DoubleClick=rk=D.s(jk,"DoubleClick",2);var lk;jk.StateNone=lk=D.s(jk,"StateNone",0);var sk;jk.StateActive=sk=D.s(jk,"StateActive",1);var tk;jk.StateEditing=tk=D.s(jk,"StateEditing",2);var uk;jk.StateValidating=uk=D.s(jk,"StateValidating",3);var vk;jk.StateInvalid=vk=D.s(jk,"StateInvalid",4);var wk;jk.StateValidated=wk=D.s(jk,"StateValidated",5);
function mk(a,b){var c=D.createElement("textarea");a.lz=c;c.addEventListener("input",function(){if(null!==a.ih){var b=a.CJ(this.value),c=this.pK;this.style.width=20+b.Fa.width*c+"px";this.style.height=10+b.Fa.height*c+"px";this.rows=b.rJ}},!1);c.addEventListener("keydown",function(b){if(null!==a.ih){var c=b.which;13===c?(!1===a.ih.Xx&&b.preventDefault(),a.acceptText(qk)):9===c?(a.acceptText(pk),b.preventDefault()):27===c&&(a.doCancel(),null!==a.g&&a.g.doFocus())}},!1);c.addEventListener("focus",function(){xk(a)},
!1);c.addEventListener("blur",function(){yk(a)},!1);b.YB=function(){return c.value};b.cB=c;b.show=function(a,b,g){if(g.state===vk)c.style.border="3px solid red",c.focus();else{var h=a.eb(gc),k=b.position,l=b.scale,m=a.Fj()*l;m<g.fG&&(m=g.fG);var n=a.Ga.width*m+6,p=a.Ga.height*m+2,q=(h.x-k.x)*l,h=(h.y-k.y)*l;c.value=a.text;b.Dj.style.font=a.font;c.style.cssText="position: absolute;z-index: 100;font: inherit;fontSize: "+100*m+"%;lineHeight: normal;width: "+n+"px;height: "+p+"px;left: "+((q-n/2|0)-1)+
"px;top: "+((h-p/2|0)-1)+"px;textAlign: "+a.textAlign+";margin: 0;padding: 1px;border: 0;outline: none;white-space: pre-wrap;overflow: hidden;";c.pK=m;b.Dj.appendChild(c);c.focus();g.Dy&&(c.select(),c.setSelectionRange(0,9999))}};b.Wn=function(a){a.Dj.removeChild(c)}}D.defineProperty(jk,{ih:"textBlock"},function(){return this.eA},function(a){null!==a&&D.l(a,na,jk,"textBlock");this.eA=a});D.defineProperty(jk,{Bj:"currentTextEditor"},function(){return this.EC},function(a){this.EC=a});
D.defineProperty(jk,{oI:"defaultTextEditor"},function(){return this.MC},function(a){!v||a instanceof HTMLElement||a instanceof ak||D.k("TextEditingTool.defaultTextEditor must be an Element or HTMLInfo.");this.MC=a});D.defineProperty(jk,{VG:"starting"},function(){return this.aE},function(a){D.Ca(a,jk,jk,"starting");this.aE=a});
jk.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;if(null===a||a.mb||!a.U.left||this.isBeyondDragSize())return!1;var b=a.Ge(a.U.ha,null,function(a){return a instanceof na});if(null===b||!b.FA||!b.Y.canEdit())return!1;b=b.Y;return null===b||this.VG===kk&&!b.hb||this.VG===rk&&2>a.U.Oe?!1:!0};jk.prototype.doStart=function(){this.wa||null===this.ih||this.doActivate()};
jk.prototype.doActivate=function(){if(!this.wa){var a=this.g;if(null!==a){var b=this.ih;null===b&&(b=a.Ge(a.U.ha,function(a){return a instanceof na?a:null}));if(null!==b&&(this.ih=b,null!==b.Y)){this.wa=!0;this.$a=sk;var c=this.oI;null!==b.ZG&&(c=b.ZG);this.Ck=this.ih.copy();var d=new B(this.ih.eb(cc),this.ih.eb(rc));a.dK(d);if(c instanceof ak)c.show(b,a,this);else{c.style.position="absolute";c.style.zIndex="100";c.textEditingTool=this;if("function"===typeof c.onActivate)c.onActivate();"function"===
typeof c.focus&&c.focus();"function"===typeof c.select&&this.Dy&&(c.select(),c.setSelectionRange(0,9999));a.Dj.appendChild(c)}this.Bj=c}}}};jk.prototype.doCancel=function(){null!==this.Ll&&this.Bj instanceof HTMLElement&&(this.Bj.style.border=this.Ll,this.Ll=null);this.stopTool()};jk.prototype.doMouseUp=function(){!this.wa&&this.canStart()&&this.doActivate()};jk.prototype.doMouseDown=function(){this.wa&&this.acceptText(ok)};
jk.prototype.acceptText=function(a){switch(a){case ok:if(this.$a===wk)this.Bj instanceof HTMLElement&&this.Bj.focus();else if(this.$a===sk||this.$a===vk||this.$a===tk)this.$a=uk,zk(this);break;case nk:case qk:case pk:if(qk===a&&!0===this.eA.Xx)break;if(this.$a===sk||this.$a===vk||this.$a===tk)this.$a=uk,zk(this)}};
function zk(a){var b=a.ih,c=a.g,d=a.Bj;if(null!==b&&null!==d){var e=b.text,g="";d instanceof ak?null!==d.YB&&(g=d.YB()):(g=d.value,g="function"===typeof g?g():g);a.isValidText(b,e,g)?(a.$b(a.name),a.$a=wk,d instanceof ak?d.show(b,c,a):null!==a.Ll&&(d.style.border=a.Ll,a.Ll=null),a.Pf=a.name,b.text=g,null!==b.YG&&b.YG(b,e,g),null!==c&&c.Ja("TextEdited",b,e),a.bl(),a.stopTool(),null!==c&&c.doFocus()):(a.$a=vk,null!==b.HA&&b.HA(a,e,g),d instanceof ak?d.show(b,c,a):(null===a.Ll&&(a.Ll=d.style.border,
d.style.border="3px solid red"),"function"===typeof d.focus&&d.focus()))}}jk.prototype.doDeactivate=function(){var a=this.g;if(null!==a){this.$a=lk;this.ih=null;if(null!==this.Bj){var b=this.Bj;if(b instanceof ak)b.Wn(a,this);else{if("function"===typeof b.onDeactivate)b.onDeactivate();null!==b&&a.Dj.removeChild(b)}}this.wa=!1}};jk.prototype.doFocus=function(){v&&D.Nn("TextEditingTool.doFocus","2.0");xk(this)};jk.prototype.doBlur=function(){v&&D.Nn("TextEditingTool.doBlur","2.0");yk(this)};
function xk(a){if(null!==a.Bj){var b=a.lz;a.$a===sk&&(a.$a=tk);"function"===typeof b.select&&a.Dy&&(b.select(),b.setSelectionRange(0,9999))}}function yk(a){if(null!==a.Bj){var b=a.lz;"function"===typeof b.focus&&b.focus();"function"===typeof b.select&&a.Dy&&(b.select(),b.setSelectionRange(0,9999))}}jk.prototype.isValidText=function(a,b,c){D.l(a,na,jk,"isValidText:textblock");var d=this.NB;if(null!==d&&!d(a,b,c))return!1;d=a.NB;return null===d||d(a,b,c)?!0:!1};
D.defineProperty(jk,{NB:"textValidation"},function(){return this.Ql},function(a){null!==a&&D.h(a,"function",jk,"textValidation");this.Ql=a});D.defineProperty(jk,{fG:"minimumEditorScale"},function(){return this.yD},function(a){null!==a&&D.h(a,"number",jk,"minimumEditorScale");this.yD=a});D.defineProperty(jk,{Dy:"selectsTextOnActivate"},function(){return this.VD},function(a){null!==a&&D.h(a,"boolean",jk,"selectsTextOnActivate");this.VD=a});
D.defineProperty(jk,{state:"state"},function(){return this.$a},function(a){this.$a!==a&&(D.Ca(a,jk,jk,"starting"),this.$a=a)});jk.prototype.measureTemporaryTextBlock=jk.prototype.CJ=function(a){var b=this.Ck;b.text=a;Ak(b,this.ih.tp,Infinity);return b};function Hh(){Sg.call(this);this.name="ToolManager";this.uH=new K(Sg);this.vH=new K(Sg);this.wH=new K(Sg);this.cD=this.dD=850;this.RC=(new Ca(2,2)).Na();this.nE=5E3;this.CD=Th;this.aD=Bk;this.Jv=this.FC=null;this.xn=-1}D.Sa(Hh,Sg);
D.ja("ToolManager",Hh);var Th;Hh.WheelScroll=Th=D.s(Hh,"WheelScroll",0);var Sh;Hh.WheelZoom=Sh=D.s(Hh,"WheelZoom",1);Hh.WheelNone=D.s(Hh,"WheelNone",2);var Bk;Hh.GestureZoom=Bk=D.s(Hh,"GestureZoom",3);var Ck;Hh.GestureCancel=Ck=D.s(Hh,"GestureCancel",4);var Dk;Hh.GestureNone=Dk=D.s(Hh,"GestureNone",5);D.defineProperty(Hh,{Ku:"mouseWheelBehavior"},function(){return this.CD},function(a){D.Ca(a,Hh,Hh,"mouseWheelBehavior");this.CD=a});
D.defineProperty(Hh,{rq:"gestureBehavior"},function(){return this.aD},function(a){D.Ca(a,Hh,Hh,"gestureBehavior");this.aD=a});Hh.prototype.initializeStandardTools=function(){this.GH=new Zj;this.rG=new Xh;this.uJ=new xj;this.EG=new Pj;this.aK=new Wj;this.bG=new ra;this.De=new Mh;this.sI=new hk;this.PJ=new ik;this.vA=new ck;this.MB=new jk;this.XH=new ta;this.YH=new Yj};
Hh.prototype.updateAdornments=function(a){var b=this.em;if(b instanceof da&&this.Jv===a){var c=b.zb;(null!==a?c.Y===a:null===c)?this.showToolTip(b,c):this.hideToolTip()}};
Hh.prototype.doMouseDown=function(){var a=this.g;if(null!==a){var b=a.U;b.Lj&&this.rq===Ck&&(b.bubbles=!1);if(b.yu){this.cancelWaitAfter();if(this.rq===Dk){b.bubbles=!0;return}if(this.rq===Ck)return;if(a.gb.canStartMultiTouch()){a.gb.standardPinchZoomStart();return}}var c=a.ra;c.rA&&0!==c.Vh&&D.trace("WARNING: In ToolManager.doMouseDown: UndoManager.transactionLevel is not zero");for(var c=this.lf.length,d=0;d<c;d++){var e=this.lf.ea(d);null===e.g&&e.Xc(this.g);if(e.canStart()){a.doFocus();a.gb=e;
a.gb===e&&(e.wa||e.doActivate(),e.doMouseDown());return}}1===a.U.button&&(this.Ku===Th?this.Ku=Sh:this.Ku===Sh&&(this.Ku=Th));this.doActivate();this.standardWaitAfter(this.GF,b)}};
Hh.prototype.doMouseMove=function(){var a=this.g;if(null!==a){var b=a.U;if(b.yu){if(this.rq===Dk){b.bubbles=!0;return}if(this.rq===Ck)return;if(a.gb.canStartMultiTouch()){a.gb.standardPinchZoomMove();return}}if(this.wa)for(var c=this.ig.length,d=0;d<c;d++){var e=this.ig.ea(d);null===e.g&&e.Xc(this.g);if(e.canStart()){a.doFocus();a.gb=e;a.gb===e&&(e.wa||e.doActivate(),e.doMouseMove());return}}Ek(this,a);null===b.event||"mousemove"!==b.event.type&&b.event.cancelable||(b.bubbles=!0)}};
function Ek(a,b){a.standardMouseOver();a.isBeyondDragSize()&&a.standardWaitAfter(a.wa?a.GF:a.XI,b.U)}Hh.prototype.doCurrentObjectChanged=function(a,b){var c=this.em;null===c||null!==b&&c instanceof da&&(b===c||b.tm(c))||this.hideToolTip()};Hh.prototype.doWaitAfter=function(a){var b=this.g;null!==b&&b.Lb&&(this.doMouseHover(),this.wa||this.doToolTip(),a.Lj&&!b.U.Lc&&(a=a.copy(),a.button=2,a.buttons=2,b.U=a,b.Dt=!0,b.doMouseUp()))};
Hh.prototype.doMouseHover=function(){var a=this.g;if(null!==a){var b=a.U;null===b.We&&(b.We=a.Ge(b.ha,null,null));var c=b.We;if(null!==c)for(b.Lc=!1;null!==c;){a=this.wa?c.iB:c.jB;if(null!==a&&(a(b,c),b.Lc))break;c=c.Q}else c=this.wa?a.iB:a.jB,null!==c&&c(b)}};
Hh.prototype.doToolTip=function(){var a=this.g;if(null!==a){var b=a.U;null===b.We&&(b.We=a.Ge(b.ha,null,null));b=b.We;if(null!==b){if(a=this.em,!(a instanceof da)||b!==a&&!b.tm(a)){for(;null!==b;){a=b.PB;if(null!==a){this.showToolTip(a,b);return}b=b.Q}this.hideToolTip()}}else a=a.PB,null!==a?this.showToolTip(a,null):this.hideToolTip()}};
Hh.prototype.showToolTip=function(a,b){!v||a instanceof da||a instanceof ak||D.k("showToolTip:tooltip must be an Adornment or HTMLInfo.");null!==b&&D.l(b,P,Hh,"showToolTip:obj");var c=this.g;if(null!==c){a!==this.em&&this.hideToolTip();if(a instanceof da){a.Jf="Tool";a.$k=!1;a.scale=1/c.scale;a.Dd="ToolTip";null!==a.placeholder&&(a.placeholder.scale=c.scale);c.add(a);if(null!==b){var c=null,d=b.lm();null!==d&&(c=d.data);a.zb=b;a.data=c}else a.data=c.ga;a.hf();this.positionToolTip(a,b)}else a instanceof
ak&&a!==this.em&&a.show(b,c,this);this.em=a;-1!==this.xn&&(D.clearTimeout(this.xn),this.xn=-1);c=this.uK;if(0<c&&Infinity!==c){var e=this;this.xn=D.setTimeout(function(){e.hideToolTip()},c)}}};Hh.prototype.positionToolTip=function(a){if(null===a.placeholder){var b=this.g;if(null!==b){var c=b.U.ha.copy(),d=a.Fa,e=b.xb;b.U.Lj&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5);c.x<e.x&&(c.x=e.x);c.y=c.y+20+d.height>e.bottom?c.y-(d.height+5):c.y+20;c.y<e.y&&(c.y=e.y);a.position=c}}};
Hh.prototype.hideToolTip=function(){-1!==this.xn&&(D.clearTimeout(this.xn),this.xn=-1);var a=this.g;if(null!==a){var b=this.em;null!==b&&(b instanceof da?(a.remove(b),null!==this.Jv&&this.Jv.Tj(b.Dd),b.data=null,b.zb=null):b instanceof ak&&null!==b.Wn&&b.Wn(a,this),this.em=null)}};
D.defineProperty(Hh,{em:"currentToolTip"},function(){return this.FC},function(a){!v||null===a||a instanceof da||a instanceof ak||D.k("ToolManager.currentToolTip must be an Adornment or HTMLInfo.");this.FC=a;this.Jv=null!==a&&a instanceof da?a.Zf:null});
Hh.prototype.doMouseUp=function(){this.cancelWaitAfter();var a=this.g;if(null!==a){if(this.wa)for(var b=this.jg.length,c=0;c<b;c++){var d=this.jg.ea(c);null===d.g&&d.Xc(this.g);if(d.canStart()){a.doFocus();a.gb=d;a.gb===d&&(d.wa||d.doActivate(),d.doMouseUp());return}}a.doFocus();this.doDeactivate()}};Hh.prototype.doMouseWheel=function(){this.standardMouseWheel()};Hh.prototype.doKeyDown=function(){var a=this.g;null!==a&&a.wb.doKeyDown()};Hh.prototype.doKeyUp=function(){var a=this.g;null!==a&&a.wb.doKeyUp()};
Hh.prototype.doCancel=function(){null!==Vh&&Vh.doCancel();Sg.prototype.doCancel.call(this)};Hh.prototype.findTool=function(a){D.h(a,"string",Hh,"findTool:name");for(var b=this.lf.length,c=0;c<b;c++){var d=this.lf.ea(c);if(d.name===a)return d}b=this.ig.length;for(c=0;c<b;c++)if(d=this.ig.ea(c),d.name===a)return d;b=this.jg.length;for(c=0;c<b;c++)if(d=this.jg.ea(c),d.name===a)return d;return null};
Hh.prototype.replaceTool=function(a,b){D.h(a,"string",Hh,"replaceTool:name");null!==b&&(D.l(b,Sg,Hh,"replaceTool:newtool"),b.g&&b.g!==this.g&&D.k("Cannot share tools between Diagrams: "+b.toString()),b.Xc(this.g));for(var c=this.lf.length,d=0;d<c;d++){var e=this.lf.ea(d);if(e.name===a)return null!==b?this.lf.qg(d,b):this.lf.jd(d),e}c=this.ig.length;for(d=0;d<c;d++)if(e=this.ig.ea(d),e.name===a)return null!==b?this.ig.qg(d,b):this.ig.jd(d),e;c=this.jg.length;for(d=0;d<c;d++)if(e=this.jg.ea(d),e.name===
a)return null!==b?this.jg.qg(d,b):this.jg.jd(d),e;return null};function Fk(a,b,c,d){D.h(b,"string",Hh,"replaceStandardTool:name");D.l(d,K,Hh,"replaceStandardTool:list");null!==c&&(D.l(c,Sg,Hh,"replaceStandardTool:newtool"),c.g&&c.g!==a.g&&D.k("Cannot share tools between Diagrams: "+c.toString()),c.name=b,c.Xc(a.g));a.findTool(b)?a.replaceTool(b,c):null!==c&&d.add(c)}D.w(Hh,{lf:"mouseDownTools"},function(){return this.uH});D.w(Hh,{ig:"mouseMoveTools"},function(){return this.vH});
D.w(Hh,{jg:"mouseUpTools"},function(){return this.wH});D.defineProperty(Hh,{XI:"hoverDelay"},function(){return this.dD},function(a){D.h(a,"number",Hh,"hoverDelay");this.dD=a});D.defineProperty(Hh,{GF:"holdDelay"},function(){return this.cD},function(a){D.h(a,"number",Hh,"holdDelay");this.cD=a});D.defineProperty(Hh,{tI:"dragSize"},function(){return this.RC},function(a){D.l(a,Ca,Hh,"dragSize");this.RC=a.V()});
D.defineProperty(Hh,{uK:"toolTipDuration"},function(){return this.nE},function(a){D.h(a,"number",Hh,"toolTipDuration");this.nE=a});D.defineProperty(Hh,{GH:"actionTool"},function(){return this.findTool("Action")},function(a){Fk(this,"Action",a,this.lf)});D.defineProperty(Hh,{rG:"relinkingTool"},function(){return this.findTool("Relinking")},function(a){Fk(this,"Relinking",a,this.lf)});
D.defineProperty(Hh,{uJ:"linkReshapingTool"},function(){return this.findTool("LinkReshaping")},function(a){Fk(this,"LinkReshaping",a,this.lf)});D.defineProperty(Hh,{EG:"resizingTool"},function(){return this.findTool("Resizing")},function(a){Fk(this,"Resizing",a,this.lf)});D.defineProperty(Hh,{aK:"rotatingTool"},function(){return this.findTool("Rotating")},function(a){Fk(this,"Rotating",a,this.lf)});
D.defineProperty(Hh,{bG:"linkingTool"},function(){return this.findTool("Linking")},function(a){Fk(this,"Linking",a,this.ig)});D.defineProperty(Hh,{De:"draggingTool"},function(){return this.findTool("Dragging")},function(a){Fk(this,"Dragging",a,this.ig)});D.defineProperty(Hh,{sI:"dragSelectingTool"},function(){return this.findTool("DragSelecting")},function(a){Fk(this,"DragSelecting",a,this.ig)});
D.defineProperty(Hh,{PJ:"panningTool"},function(){return this.findTool("Panning")},function(a){Fk(this,"Panning",a,this.ig)});D.defineProperty(Hh,{vA:"contextMenuTool"},function(){return this.findTool("ContextMenu")},function(a){Fk(this,"ContextMenu",a,this.jg)});D.defineProperty(Hh,{MB:"textEditingTool"},function(){return this.findTool("TextEditing")},function(a){Fk(this,"TextEditing",a,this.jg)});
D.defineProperty(Hh,{XH:"clickCreatingTool"},function(){return this.findTool("ClickCreating")},function(a){Fk(this,"ClickCreating",a,this.jg)});D.defineProperty(Hh,{YH:"clickSelectingTool"},function(){return this.findTool("ClickSelecting")},function(a){Fk(this,"ClickSelecting",a,this.jg)});
function dh(){this.GC=Tk;this.Hr=this.Ir=this.ba=null;this.Go=this.Jr=this.Kr=0;this.Ho=this.vc=this.op=this.nk=!1;this.ok=this.mf=!0;this.Hv=this.Gv=this.BC=null;this.AC=0;this.Iv=null;this.vv=new L("string");this.sz=600;this.xH=new O(0,0);this.pC=this.oC=this.rE=!1;this.gn=new ma(P,Zk)}D.ja("AnimationManager",dh);dh.prototype.Xc=function(a){this.ba=a};function Tk(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}D.w(dh,{ZK:"animationReasons"},function(){return this.vv});
dh.prototype.canStart=function(){return!0};dh.prototype.prepareAutomaticAnimation=dh.prototype.oo=function(a){this.mf&&(this.ok||this.ba.Zn)&&(this.vv.add(a),this.canStart(a)&&(this.nk&&this.Ii(),this.vc=!0))};function $k(a){if(a.mf&&(a.vv.clear(),a.vc))if(!a.Ho)a.vc=!1;else if(0===a.Go){var b=+new Date;a.Go=b;requestAnimationFrame(function(){if(!1!==a.vc&&!a.nk&&a.Go===b){var c=a.ba;c.Gj("temporaryPixelRatio")&&(c.Bk=1);al(c);a.vc=!1;c.Ja("AnimationStarting");bl(a,b)}})}}
function cl(a,b,c,d,e,g){if(a.vc&&(v&&D.l(b,P,dh,"addPropToAnimation:obj"),!("position"===c&&d.O(e)||b instanceof F&&!b.KF))){var h=a.gn;if(h.contains(b)){var h=h.oa(b),k=h.start,l=h.end;void 0===k[c]&&(k[c]=dl(d));h.wx&&void 0!==l[c]?h.fu[c]=dl(e):(g||(h.fu[c]=dl(e)),l[c]=dl(e));g&&0===c.indexOf("position:")&&b instanceof F&&(h.fu.location=dl(b.location))}else k=new la,l=new la,k[c]=dl(d),l[c]=dl(e),d=l,e=k.position,e instanceof O&&!e.F()&&a.vv.contains("Expand SubGraph")&&e.assign(d.position),k=
new Zk(k,l,g),g&&0===c.indexOf("position:")&&b instanceof F&&(k.fu.location=dl(b.location)),h.add(b,k);a.Ho=!0}}function dl(a){return a instanceof O?a.copy():a instanceof Ca?a.copy():a}
function bl(a,b){var c;function d(){if(!1!==g.nk&&g.Go===b){var a=+new Date,c=a>s?m:a-r;el(g);fl(g,e,q,h,c,m);g.Gv&&g.Gv();Vi(e);gl(g);a>s?hl(g):requestAnimationFrame(d)}}void 0===c&&(c=new la);var e=a.ba;if(null!==e){a.nk=!0;var g=a,h=c.BL||a.GC,k=c.aM||null,l=c.bM||null,m=c.duration||a.sz,n=a.xH;for(c=a.gn.j;c.next();){var p=c.value.start.position;p instanceof O&&(p.F()||p.assign(n))}a.BC=h;a.Gv=k;a.Hv=l;a.AC=m;a.Iv=a.gn;var q=a.Iv;for(c=q.j;c.next();)k=c.value.end,k["position:placeholder"]&&(l=
k["position:placeholder"],n=l.eb(cc),n.x+=l.padding.left,n.y+=l.padding.top,k["position:placeholder"]=n);el(a);fl(a,e,q,h,0,m);Vi(a.ba);gl(a);var r=+new Date,s=r+m;g.Go===b&&requestAnimationFrame(function(){d()})}}function el(a){if(!a.op){var b=a.ba;a.rE=b.Eb;a.oC=b.Ue;a.pC=b.cv;b.Eb=!0;b.Ue=!0;b.cv=!0;a.op=!0}}function gl(a){var b=a.ba;b.Eb=a.rE;b.Ue=a.oC;b.cv=a.pC;a.op=!1}
function fl(a,b,c,d,e,g){for(c=c.j;c.next();){var h=c.key,k=c.value,l=k.start,k=k.end,m;for(m in k)if(("position"!==m||!k["position:placeholder"]&&!k["position:node"])&&void 0!==il[m])il[m](h,l[m],k[m],d,e,g)}d=b.YA;b.YA=!0;m=a.GC;0!==a.Kr&&0!==a.Jr&&(c=a.Kr,b.Bb=m(e,c,a.Jr-c,g));null!==a.Ir&&null!==a.Hr&&(c=a.Ir,a=a.Hr,b.qb=new O(m(e,c.x,a.x-c.x,g),m(e,c.y,a.y-c.y,g)));b.YA=d}
dh.prototype.stopAnimation=dh.prototype.Ii=function(){!0===this.vc&&(this.vc=!1,this.Ho&&this.ba.Se());this.nk&&this.mf&&hl(this)};
function hl(a){a.nk=!1;a.Ho=!1;el(a);for(var b=a.ba,c=a.BC,d=a.AC,e=a.Iv.j;e.next();){var g=e.key,h=e.value,k=h.start,l=h.end,m=h.fu,n;for(n in l)if(void 0!==il[n]){var p=n;!h.wx||"position:node"!==p&&"position:placeholder"!==p||(p="position");il[p](g,k[n],void 0!==m[n]?m[n]:h.wx?k[n]:l[n],c,d,d)}h.wx&&void 0!==m.location&&g instanceof F&&(g.location=m.location);h.vy&&g instanceof F&&g.Hd(!1)}for(c=a.ba.links;c.next();)d=c.value,null!==d.Jp&&(d.points=d.Jp,d.Jp=null);b.hy.clear();b.Bk=null;b.yc();
b.qa();b.gg();jl(b);gl(a);a.Hv&&a.Hv();a.Go=0;a.Iv=null;a.Hv=null;a.Gv=null;a.Ir=null;a.Hr=null;a.Kr=0;a.Jr=0;a.gn=new ma(P,Zk);b.Ja("AnimationFinished");b.Se()}
function kl(a,b,c){var d=b.$,e=c.$,g=null;c instanceof I&&(g=c.placeholder);null!==g?(d=g.eb(cc),d.x+=g.padding.left,d.y+=g.padding.top,cl(a,b,"position",d,b.position,!1)):cl(a,b,"position",new O(e.x+e.width/2-d.width/2,e.y+e.height/2-d.height/2),b.position,!1);cl(a,b,"scale",.01,b.scale,!1);if(b instanceof I)for(b=b.Mc;b.next();)g=b.value,g instanceof G&&kl(a,g,c)}
function ll(a,b,c){if(b.isVisible()){var d=null;c instanceof I&&(d=c.placeholder);null!==d?cl(a,b,"position:placeholder",b.position,d,!0):cl(a,b,"position:node",b.position,c,!0);cl(a,b,"scale",b.scale,.01,!0);a.vc&&(d=a.gn,d.contains(b)&&(d.oa(b).vy=!0));if(b instanceof I)for(b=b.Mc;b.next();)d=b.value,d instanceof G&&ll(a,d,c)}}function ml(a,b,c){a.vc&&(null===a.Ir&&b.F()&&null===a.Hr&&(a.Ir=b.copy()),a.Hr=c.copy(),a.Ho=!0)}
function nl(a,b,c){a.vc&&a.ba.Zn&&(0===a.Kr&&0===a.Jr&&(a.Kr=b),a.Jr=c,a.Ho=!0)}D.defineProperty(dh,{isEnabled:"isEnabled"},function(){return this.mf},function(a){D.h(a,"boolean",dh,"isEnabled");this.mf=a});D.defineProperty(dh,{duration:"duration"},function(){return this.sz},function(a){D.h(a,"number",dh,"duration");1>a&&D.ua(a,">= 1",dh,"duration");this.sz=a});D.w(dh,{sf:"isAnimating"},function(){return this.nk});D.w(dh,{lJ:"isTicking"},function(){return this.op});
D.defineProperty(dh,{SF:"isInitial"},function(){return this.ok},function(a){D.h(a,"boolean",dh,"isInitial");this.ok=a});function Zk(a,b,c){this.start=a;this.end=b;this.fu=new la;this.wx=c;this.vy=!1}
var il={opacity:function(a,b,c,d,e,g){a.opacity=d(e,b,c-b,g)},position:function(a,b,c,d,e,g){e!==g?a.Hy(d(e,b.x,c.x-b.x,g),d(e,b.y,c.y-b.y,g)):a.position=new O(d(e,b.x,c.x-b.x,g),d(e,b.y,c.y-b.y,g))},"position:node":function(a,b,c,d,e,g){var h=a.$,k=c.$;c=k.x+k.width/2-h.width/2;h=k.y+k.height/2-h.height/2;e!==g?a.Hy(d(e,b.x,c-b.x,g),d(e,b.y,h-b.y,g)):a.position=new O(d(e,b.x,c-b.x,g),d(e,b.y,h-b.y,g))},"position:placeholder":function(a,b,c,d,e,g){e!==g?a.Hy(d(e,b.x,c.x-b.x,g),d(e,b.y,c.y-b.y,g)):
a.position=new O(d(e,b.x,c.x-b.x,g),d(e,b.y,c.y-b.y,g))},scale:function(a,b,c,d,e,g){a.scale=d(e,b,c-b,g)},visible:function(a,b,c,d,e,g){a.visible=e!==g?b:c}};function Rg(){0<arguments.length&&D.td(Rg);D.tc(this);this.ba=null;this.pb=new K(F);this.Xb="";this.Fc=1;this.Jz=!1;this.Ml=this.jA=this.ll=this.kl=this.jl=this.il=this.gl=this.hl=this.fl=this.nl=this.el=this.ml=this.dl=this.cl=!0;this.Gz=!1;this.Bw=[]}D.ja("Layer",Rg);Rg.prototype.Xc=function(a){this.ba=a};
Rg.prototype.toString=function(a){void 0===a&&(a=0);var b='Layer "'+this.name+'"';if(0>=a)return b;for(var c=0,d=0,e=0,g=0,h=0,k=this.pb.j;k.next();){var l=k.value;l instanceof I?e++:l instanceof G?d++:l instanceof J?g++:l instanceof da?h++:c++}k="";0<c&&(k+=c+" Parts ");0<d&&(k+=d+" Nodes ");0<e&&(k+=e+" Groups ");0<g&&(k+=g+" Links ");0<h&&(k+=h+" Adornments ");if(1<a)for(a=this.pb.j;a.next();)c=a.value,k+="\n    "+c.toString(),d=c.data,null!==d&&D.Fd(d)&&(k+=" #"+D.Fd(d)),c instanceof G?k+=" "+
ja(d):c instanceof J&&(k+=" "+ja(c.aa)+" "+ja(c.da));return b+" "+this.pb.count+": "+k};
Rg.prototype.findObjectAt=Rg.prototype.Ge=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.Ml)return null;v&&!a.F()&&D.k("findObjectAt: Point must have a real value, not: "+a.toString());var d=!1;null!==this.g&&this.g.xb.Oa(a)&&(d=!0);for(var e=D.P(),g=this.pb.o,h=g.length;h--;){var k=g[h];if((!0!==d||!1!==ol(k))&&k.isVisible()&&(e.assign(a),hb(e,k.Hh),k=k.Ge(e,b,c),null!==k&&(null!==b&&(k=b(k)),null!==k&&(null===c||c(k)))))return D.A(e),k}D.A(e);return null};
Rg.prototype.findObjectsAt=Rg.prototype.hu=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof K||d instanceof L||(d=new L(P));if(!1===this.Ml)return d;v&&!a.F()&&D.k("findObjectsAt: Point must have a real value, not: "+a.toString());var e=!1;null!==this.g&&this.g.xb.Oa(a)&&(e=!0);for(var g=D.P(),h=this.pb.o,k=h.length;k--;){var l=h[k];if((!0!==e||!1!==ol(l))&&l.isVisible()){g.assign(a);hb(g,l.Hh);var m=l;l.hu(g,b,c,d)&&(null!==b&&(m=b(m)),null===m||null!==c&&!c(m)||(d instanceof
L&&d.add(m),d instanceof K&&d.add(m)))}}D.A(g);return d};
Rg.prototype.findObjectsIn=Rg.prototype.Qk=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof K||e instanceof L||(e=new L(P));if(!1===this.Ml)return e;v&&!a.F()&&D.k("findObjectsIn: Rect must have a real value, not: "+a.toString());var g=!1;null!==this.g&&this.g.xb.Nk(a)&&(g=!0);for(var h=this.pb.o,k=h.length;k--;){var l=h[k];if((!0!==g||!1!==ol(l))&&l.isVisible()){var m=l;l.Qk(a,b,c,d,e)&&(null!==b&&(m=b(m)),null===m||null!==c&&!c(m)||(e instanceof L&&e.add(m),
e instanceof K&&e.add(m)))}}return e};Rg.prototype.IA=function(a,b,c,d,e,g,h){if(!1===this.Ml)return e;for(var k=this.pb.o,l=k.length;l--;){var m=k[l];if((!0!==h||!1!==ol(m))&&g(m)&&m.isVisible()){var n=m;m.Qk(a,b,c,d,e)&&(null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||(e instanceof L&&e.add(n),e instanceof K&&e.add(n)))}}return e};
Rg.prototype.findObjectsNear=Rg.prototype.On=function(a,b,c,d,e,g){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof K||e instanceof L)g=e;e=!0}g instanceof K||g instanceof L||(g=new L(P));if(!1===this.Ml)return g;v&&!a.F()&&D.k("findObjectsNear: Point must have a real value, not: "+a.toString());var h=!1;null!==this.g&&this.g.xb.Oa(a)&&(h=!0);for(var k=D.P(),l=D.P(),m=this.pb.o,n=m.length;n--;){var p=m[n];if((!0!==h||!1!==ol(p))&&p.isVisible()){k.assign(a);
hb(k,p.Hh);l.m(a.x+b,a.y);hb(l,p.Hh);var q=p;p.On(k,l,c,d,e,g)&&(null!==c&&(q=c(q)),null===q||null!==d&&!d(q)||(g instanceof L&&g.add(q),g instanceof K&&g.add(q)))}}D.A(k);D.A(l);return g};f=Rg.prototype;
f.Lf=function(a,b){if(this.visible){var c;c=void 0===b?a.xb:b;for(var d=this.pb.o,e=d.length,g=0;g<e;g++){var h=d[g];h.uD=g;if(!(h instanceof J&&!1===h.lh)){if(h instanceof da){var k=h;if(null!==k.Zf)continue}if(Lb(h.$,c))for(h.Lf(!0),pl(h),h=h.jx;h.next();)k=h.value,Ak(k,Infinity,Infinity),k.oc(),k.Lf(!0);else h.Lf(!1),null!==h.jx&&0<h.jx.count&&pl(h)}}}};
f.Ee=function(a,b,c){if(this.visible&&0!==this.Fc&&(void 0===c&&(c=!0),c||!this.Tc)){c=this.pb.o;var d=c.length;if(0!==d){1!==this.Fc&&(a.globalAlpha=this.Fc);var e=this.Bw;e.length=0;for(var g=b.scale,h=0;h<d;h++){var k=c[h];if(ol(k)){if(k instanceof J){var l=k;l.qc&&e.push(l);if(!1===l.lh)continue}l=k.$;1<l.width*g||1<l.height*g?k.Ee(a,b):ql(k,a)}}a.globalAlpha=1}}};
function rl(a,b,c,d){if(a.visible&&0!==a.Fc){1!==a.Fc&&(b.globalAlpha=a.Fc);var e=a.Bw;e.length=0;var g=c.scale;a=a.pb.o;for(var h=a.length,k=d.length,l=0;l<h;l++){var m=a[l];if(ol(m)){if(m instanceof J){var n=m;n.qc&&e.push(n);if(!1===n.lh)continue}var n=sl(m,m.$),p;a:{p=n;for(var q=d,r=k,s=2/g,u=4/g,t=0;t<r;t++){var y=q[t];if(0!==y.width&&0!==y.height&&p.IF(y.x-s,y.y-s,y.width+u,y.height+u)){p=!0;break a}}p=!1}p&&(1<n.width*g||1<n.height*g?m.Ee(b,c):ql(m,b))}}b.globalAlpha=1}}
f.i=function(a,b,c,d,e){var g=this.g;null!==g&&g.hd(cg,a,this,b,c,d,e)};f.uq=function(a,b,c){var d=this.pb;b.kw=this;if(a>=d.count)a=d.count;else if(d.ea(a)===b)return-1;d.Xd(a,b);b.ru(c);d=this.g;null!==d&&(c?d.qa():d.uq(b));tl(this,a,b);return a};
f.rf=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.rf(a,b,c);var d=this.pb;if(0>a||a>=d.length){if(a=d.indexOf(b),0>a)return-1}else if(d.ea(a)!==b&&(a=d.indexOf(b),0>a))return-1;b.su(c);d.jd(a);d=this.g;null!==d&&(c?d.qa():d.rf(b));b.kw=null;return a};
function tl(a,b,c){b=ul(a,b,c);if(c instanceof I&&null!==c&&isNaN(c.Bo)){if(0!==c.Mc.count){for(var d=-1,e=a.pb.o,g=e.length,h=0;h<g;h++){var k=e[h];if(k===c&&(b=h,0<=d))break;if(0>d&&k.Pa===c&&(d=h,0<=b))break}!(0>d)&&d<b&&(e=a.pb,e.jd(b),e.Xd(d,c))}c=c.Pa;null!==c&&tl(a,-1,c)}}
function ul(a,b,c){var d=c.Bo;if(isNaN(d))return b;a=a.pb;var e=a.count;if(1>=e)return b;0>b&&(b=a.indexOf(c));if(0>b)return-1;for(var g=b-1,h=NaN;0<=g;){h=a.ea(g).Bo;if(!isNaN(h))break;g--}for(var k=b+1,l=NaN;k<e;){l=a.ea(k).Bo;if(!isNaN(l))break;k++}if(!isNaN(h)&&h>d)for(;;){if(-1===g||h<=d){g++;if(g===b)break;a.jd(b);a.Xd(g,c);return g}for(h=NaN;0<=--g&&(h=a.ea(g).Bo,isNaN(h)););}else if(!isNaN(l)&&l<d)for(;;){if(k===e||l>=d){k--;if(k===b)break;a.jd(b);a.Xd(k,c);return k}for(l=NaN;++k<e&&(l=a.ea(k).Bo,
isNaN(l)););}return b}f.clear=function(){for(var a=this.pb.lc(),b=a.length,c=0;c<b;c++)a[c].Lf(!1),this.rf(-1,a[c],!1)};D.w(Rg,{Gi:"parts"},function(){return this.pb.j});D.w(Rg,{kM:"partsBackwards"},function(){return this.pb.$n});D.w(Rg,{g:"diagram"},function(){return this.ba});
D.defineProperty(Rg,{name:"name"},function(){return this.Xb},function(a){D.h(a,"string",Rg,"name");var b=this.Xb;if(b!==a){var c=this.g;if(null!==c)for(""===b&&D.k("Cannot rename default Layer to: "+a),c=c.ao;c.next();)c.value.name===a&&D.k("Layer.name is already present in this diagram: "+a);this.Xb=a;this.i("name",b,a);for(a=this.pb.j;a.next();)a.value.Jf=this.Xb}});
D.defineProperty(Rg,{opacity:"opacity"},function(){return this.Fc},function(a){var b=this.Fc;b!==a&&(D.h(a,"number",Rg,"opacity"),(0>a||1<a)&&D.ua(a,"0 <= value <= 1",Rg,"opacity"),this.Fc=a,this.i("opacity",b,a),a=this.g,null!==a&&a.qa())});D.defineProperty(Rg,{Tc:"isTemporary"},function(){return this.Jz},function(a){var b=this.Jz;b!==a&&(D.h(a,"boolean",Rg,"isTemporary"),this.Jz=a,this.i("isTemporary",b,a))});
D.defineProperty(Rg,{visible:"visible"},function(){return this.jA},function(a){var b=this.jA;if(b!==a){D.h(a,"boolean",Rg,"visible");this.jA=a;this.i("visible",b,a);for(b=this.pb.j;b.next();)b.value.Hd(a);a=this.g;null!==a&&a.qa()}});D.defineProperty(Rg,{pg:"pickable"},function(){return this.Ml},function(a){var b=this.Ml;b!==a&&(D.h(a,"boolean",Rg,"pickable"),this.Ml=a,this.i("pickable",b,a))});
D.defineProperty(Rg,{LF:"isBoundsIncluded"},function(){return this.Gz},function(a){this.Gz!==a&&(this.Gz=a,null!==this.g&&this.g.yc())});D.defineProperty(Rg,{Kk:"allowCopy"},function(){return this.cl},function(a){var b=this.cl;b!==a&&(D.h(a,"boolean",Rg,"allowCopy"),this.cl=a,this.i("allowCopy",b,a))});D.defineProperty(Rg,{Bn:"allowDelete"},function(){return this.dl},function(a){var b=this.dl;b!==a&&(D.h(a,"boolean",Rg,"allowDelete"),this.dl=a,this.i("allowDelete",b,a))});
D.defineProperty(Rg,{nx:"allowTextEdit"},function(){return this.ml},function(a){var b=this.ml;b!==a&&(D.h(a,"boolean",Rg,"allowTextEdit"),this.ml=a,this.i("allowTextEdit",b,a))});D.defineProperty(Rg,{kx:"allowGroup"},function(){return this.el},function(a){var b=this.el;b!==a&&(D.h(a,"boolean",Rg,"allowGroup"),this.el=a,this.i("allowGroup",b,a))});
D.defineProperty(Rg,{ox:"allowUngroup"},function(){return this.nl},function(a){var b=this.nl;b!==a&&(D.h(a,"boolean",Rg,"allowUngroup"),this.nl=a,this.i("allowUngroup",b,a))});D.defineProperty(Rg,{Vt:"allowLink"},function(){return this.fl},function(a){var b=this.fl;b!==a&&(D.h(a,"boolean",Rg,"allowLink"),this.fl=a,this.i("allowLink",b,a))});
D.defineProperty(Rg,{Cn:"allowRelink"},function(){return this.hl},function(a){var b=this.hl;b!==a&&(D.h(a,"boolean",Rg,"allowRelink"),this.hl=a,this.i("allowRelink",b,a))});D.defineProperty(Rg,{Yl:"allowMove"},function(){return this.gl},function(a){var b=this.gl;b!==a&&(D.h(a,"boolean",Rg,"allowMove"),this.gl=a,this.i("allowMove",b,a))});
D.defineProperty(Rg,{lx:"allowReshape"},function(){return this.il},function(a){var b=this.il;b!==a&&(D.h(a,"boolean",Rg,"allowReshape"),this.il=a,this.i("allowReshape",b,a))});D.defineProperty(Rg,{Wt:"allowResize"},function(){return this.jl},function(a){var b=this.jl;b!==a&&(D.h(a,"boolean",Rg,"allowResize"),this.jl=a,this.i("allowResize",b,a))});
D.defineProperty(Rg,{mx:"allowRotate"},function(){return this.kl},function(a){var b=this.kl;b!==a&&(D.h(a,"boolean",Rg,"allowRotate"),this.kl=a,this.i("allowRotate",b,a))});D.defineProperty(Rg,{Bf:"allowSelect"},function(){return this.ll},function(a){var b=this.ll;b!==a&&(D.h(a,"boolean",Rg,"allowSelect"),this.ll=a,this.i("allowSelect",b,a))});
function E(a){function b(){window.document.removeEventListener("DOMContentLoaded",b,!1);vl(c)}1<arguments.length&&D.k("Diagram constructor can only take one optional argument, the DIV HTML element or its id.");D.tc(this);wl=[];this.Zc=!0;this.mC=new dh;this.mC.Xc(this);this.Rd=17;this.hs=!1;this.Vz="default";var c=this;null!==window.document.body?vl(this):window.document.addEventListener("DOMContentLoaded",b,!1);this.bc=new K(Rg);this.Rb=this.Ob=0;this.yk=this.Sb=this.md=this.Lb=null;this.yG();this.lp=
null;this.xG();this.qb=(new O(NaN,NaN)).freeze();this.Bb=1;this.aw=(new O(NaN,NaN)).freeze();this.bw=NaN;this.tw=1E-4;this.qw=100;this.Hc=new Da;this.hx=(new O(NaN,NaN)).freeze();this.Tv=(new B(NaN,NaN,NaN,NaN)).freeze();this.Mw=(new Hb(0,0,0,0)).freeze();this.Nw=xl;this.Jw=this.Hw=null;this.Im=Nh;this.No=Tc;this.yl=Nh;this.ip=Tc;this.cw=this.$v=cc;this.Me=!0;this.ds=!1;this.Cg=new L(F);this.sl=new ma(J,B);this.Yo=!0;this.jr=250;this.Io=-1;this.yv=(new Hb(16,16,16,16)).freeze();this.Mv=this.Yf=!1;
this.cp=!0;this.Zi=new Zf;this.bd=new Zf;this.Tb=new Zf;this.wh=this.Oi=null;this.Dt=!1;this.oz=this.pz=null;yl(this);this.Cp=new L(G);this.Rl=new L(I);this.wp=new L(J);this.pb=new L(F);this.iw=!0;this.$w=zl;this.gD=!1;this.bx=Zi;this.jz=this.mz=this.fA=null;this.Fv="";this.Gr="auto";this.Si=this.uj=this.ij=this.ww=this.jj=this.kj=this.lj=this.Ri=this.Wi=this.Pi=null;this.Qz=!1;this.QD={};this.Gw=0;this.pj=[null,null];this.gz=null;this.br=this.nz=this.aA=this.WD=this.tj=!1;this.rD=!0;this.Iz=this.ge=
!1;this.ve=null;var d=this;this.zD=function(a){if(a.ga===d.ga&&d.ab){d.ab=!1;try{var b=a.Ic;""===a.wf&&b===cg&&Al(d,a.object,a.propertyName)}finally{d.ab=!0}}};this.AD=function(a){Bl(d,a)};this.uE=!0;this.sh=-2;this.Ti=new ma(Object,F);this.ck=new ma(Object,J);this.Wm=new ma(Object,Array);this.Ep=new ma("string",Array);this.Tz=new K(Cl);this.aj=!1;this.dl=this.cl=this.nv=this.mf=!0;this.pv=this.ov=!1;this.uv=this.sv=this.ll=this.kl=this.jl=this.il=this.gl=this.hl=this.fl=this.rv=this.nl=this.el=this.ml=
!0;this.Um=this.oD=!1;this.tv=this.qv=this.Yv=this.Xv=!0;this.Pw=this.Lw=16;this.Xz=this.Kw=!1;this.lt=this.Ow=null;this.Yz=this.Zz=0;this.of=(new Hb(5)).freeze();this.Sw=(new L(F)).freeze();this.rw=999999999;this.Zv=(new L(F)).freeze();this.zl=this.Sm=this.mk=!0;this.wl=this.lk=!1;this.te=null;this.wv=!0;this.th=!1;this.tH=new L(J);this.eD=new L(Dl);this.Qd=null;this.GD=1;this.ZD=0;this.Fh={scale:1,position:new O,bounds:new B,isScroll:!1};this.tE=(new B(NaN,NaN,NaN,NaN)).freeze();this.Nv=(new B(NaN,
NaN,NaN,NaN)).freeze();this.Pv=null;this.Cw=new L(El);Fl(this);this.mw=this.Vv=this.xw=this.JC=this.IC=this.KC=this.rk=this.ul=this.mj=null;Gl(this);this.zd=null;this.Uv=!1;this.Qo=null;this.kb=new Hh;this.kb.initializeStandardTools();this.gb=this.cu=this.kb;this.wb=new oa;this.ga=new Y;this.tj=!0;this.Vb=new Tg;this.tj=!1;this.WC=this.rz=null;this.od=1;this.Bk=null;var e=D.vfo.split(".");!0!==D.Bx.licenseKey&&"1"===e[0]&&7>parseInt(e[1],10)&&(D.trace("Warning: You have entered a license key for GoJS version 1.7 or later, but this library is version "+
D.vfo+". This license key will do nothing until you upgrade to GoJS 1.7 or later."),D.Bx.licenseKey=!0);this.Dl=1;this.Ym=0;this.tD=new O;this.pE=500;this.xv=new O;this.ut=null;this.Al=!1;this.preventDefault=this.uy=this.nG=this.oG=this.mG=this.ko=this.Zg=this.lo=this.io=this.jo=this.$B=this.QB=this.RB=this.SB=this.Ol=this.ht=this.Nl=this.gt=null;this.xl=new Hl;void 0!==a&&Il(this,a);this.fw=!1;this.DD=1;this.Zc=!1}D.ja("Diagram",E);
E.prototype.clear=E.prototype.clear=function(){var a=null;null!==this.zd&&(a=this.zd.Y);this.ga.clear();for(var b=this.bc.length,c=0;c<b;c++)this.bc.o[c].clear();this.Cg.clear();this.sl.clear();this.Cp.clear();this.Rl.clear();this.wp.clear();this.pb.clear();this.Ti.clear();this.ck.clear();this.Wm.clear();this.Sw.Ya();this.Sw.clear();this.Sw.freeze();this.Zv.Ya();this.Zv.clear();this.Zv.freeze();nh=this.Qo=null;Gh="";this.Nv=(new B(NaN,NaN,NaN,NaN)).freeze();null!==a&&(this.add(a),this.pb.remove(a));
this.qa()};
E.prototype.reset=E.prototype.reset=function(){this.Zc=!0;this.clear();this.bc=new K(Rg);this.yG();this.xG();this.qb=(new O(NaN,NaN)).freeze();this.Bb=1;this.aw=(new O(NaN,NaN)).freeze();this.bw=NaN;this.tw=1E-4;this.qw=100;this.hx=(new O(NaN,NaN)).freeze();this.Tv=(new B(NaN,NaN,NaN,NaN)).freeze();this.Mw=(new Hb(0,0,0,0)).freeze();this.Nw=xl;this.Jw=this.Hw=null;this.Im=Nh;this.No=Tc;this.yl=Nh;this.ip=Tc;this.cw=this.$v=cc;this.jr=250;this.yv=(new Hb(16,16,16,16)).freeze();this.iw=!0;this.$w=zl;
this.bx=Zi;this.Gr="auto";this.Si=this.uj=this.ij=this.ww=this.jj=this.kj=this.lj=this.Ri=this.Wi=this.Pi=null;this.aj=!1;this.dl=this.cl=this.nv=this.mf=!0;this.pv=this.ov=!1;this.tv=this.qv=this.Yv=this.Xv=this.uv=this.sv=this.ll=this.kl=this.jl=this.il=this.gl=this.hl=this.fl=this.rv=this.nl=this.el=this.ml=!0;this.Pw=this.Lw=16;this.of=(new Hb(5)).freeze();this.rw=999999999;this.te=null;Gl(this);this.zd=null;this.kb=new Hh;this.kb.initializeStandardTools();this.gb=this.cu=this.kb;this.wb=new oa;
this.tj=!0;Fl(this);this.Vb=new Tg;this.tj=!1;this.ga=new Y;this.th=!1;this.cp=!0;this.Zc=this.Yf=!1;this.qa();this.wh=this.Oi=null;yl(this);this.Fv=""};
function Gl(a){a.mj=new ma("string",F);var b=new G,c=new na;c.bind(new ih("text","",ja));b.add(c);a.KC=b;a.mj.add("",b);b=new G;c=new na;c.stroke="brown";c.bind(new ih("text","",ja));b.add(c);a.mj.add("Comment",b);b=new G;b.$k=!1;b.qA=!1;c=new z;c.Jb="Ellipse";c.fill="black";c.stroke=null;c.Ea=(new Ca(3,3)).Na();b.add(c);a.mj.add("LinkLabel",b);a.ul=new ma("string",I);b=new I;b.Cy="GROUPPANEL";b.type=Jl;c=new na;c.font="bold 12pt sans-serif";c.bind(new ih("text","",ja));b.add(c);c=new x(Kl);c.name=
"GROUPPANEL";var d=new z;d.Jb="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new Rj;d.padding=(new Hb(5,5,5,5)).Na();c.add(d);b.add(c);a.IC=b;a.ul.add("",b);a.rk=new ma("string",J);b=new J;c=new z;c.Gf=!0;b.add(c);c=new z;c.Wq="Standard";c.fill="black";c.stroke=null;c.jb=0;b.add(c);a.JC=b;a.rk.add("",b);b=new J;c=new z;c.Gf=!0;c.stroke="brown";b.add(c);a.rk.add("Comment",b);b=new da;b.type=Kl;c=new z;c.fill=null;c.stroke="dodgerblue";c.jb=3;b.add(c);c=new Rj;c.margin=(new Hb(1.5,
1.5,1.5,1.5)).Na();b.add(c);a.xw=b;a.Vv=b;b=new da;b.type=kj;c=new z;c.Gf=!0;c.fill=null;c.stroke="dodgerblue";c.jb=3;b.add(c);a.mw=b}
function vl(a){var b=D.createElement("p");b.style.width="100%";b.style.height="200px";b.style.boxSizing="content-box";var c=D.createElement("div");c.style.position="absolute";c.style.visibility="hidden";c.style.width="200px";c.style.height="150px";c.style.overflow="hidden";c.style.boxSizing="content-box";c.appendChild(b);window.document.body.appendChild(c);var d=b.offsetWidth;c.style.overflow="scroll";b=b.offsetWidth;d===b&&(b=c.clientWidth);window.document.body.removeChild(c);c=d-b;0!==c||D.QF||
(c=11);a.Rd=c;c=D.createElement("div");c.dir="rtl";c.style.cssText="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;";c.textContent="A";window.document.body.appendChild(c);d="reverse";0<c.scrollLeft?d="default":(c.scrollLeft=1,0===c.scrollLeft&&(d="negative"));window.document.body.removeChild(c);a.Vz=d}E.prototype.nc=function(a){a.Ne===E?this.am=a:D.Xj(this,a)};
E.prototype.toString=function(a){void 0===a&&(a=0);var b="";this.Dj&&this.Dj.id&&(b=this.Dj.id);b='Diagram "'+b+'"';if(0>=a)return b;for(var c=this.bc.j;c.next();)b+="\n  "+c.value.toString(a-1);return b};E.fromDiv=function(a){var b=a;"string"===typeof a&&(b=window.document.getElementById(a));return b instanceof HTMLDivElement&&b.ba instanceof E?b.ba:null};
D.defineProperty(E,{Dj:"div"},function(){return this.Sb},function(a){null!==a&&D.l(a,HTMLDivElement,E,"div");if(this.Sb!==a){wl=[];var b=this.Sb;null!==b?(b.ba=void 0,b.innerHTML="",null!==this.Lb&&(this.Lb.removeEventListener("touchstart",this.SB,!1),this.Lb.removeEventListener("touchmove",this.RB,!1),this.Lb.removeEventListener("touchend",this.QB,!1),this.Lb.Ud.ba=null),b=this.kb,null!==b&&(b.lf.each(function(a){a.cancelWaitAfter()}),b.ig.each(function(a){a.cancelWaitAfter()}),b.jg.each(function(a){a.cancelWaitAfter()})),
b.cancelWaitAfter(),this.gb.doCancel(),this.md=this.Lb=null,window.removeEventListener("resize",this.$B,!1),window.removeEventListener("mousemove",this.jo,!0),window.removeEventListener("mousedown",this.io,!0),window.removeEventListener("mouseup",this.lo,!0),window.removeEventListener("mousewheel",this.Zg,!0),window.removeEventListener("DOMMouseScroll",this.Zg,!0),window.removeEventListener("mouseout",this.ko,!0)):this.th=!1;this.Sb=null;if(null!==a){if(b=a.ba)b.Dj=null;Il(this,a);this.Hq()}}});
function Ll(a){var b=a.Lb;b.addEventListener("touchstart",a.SB,!1);b.addEventListener("touchmove",a.RB,!1);b.addEventListener("touchend",a.QB,!1);b.addEventListener("mousemove",a.jo,!1);b.addEventListener("mousedown",a.io,!1);b.addEventListener("mouseup",a.lo,!1);b.addEventListener("mousewheel",a.Zg,!1);b.addEventListener("DOMMouseScroll",a.Zg,!1);b.addEventListener("mouseout",a.ko,!1);b.addEventListener("keydown",a.nJ,!1);b.addEventListener("keyup",a.oJ,!1);b.addEventListener("selectstart",function(a){a.preventDefault();
return!1},!1);b.addEventListener("contextmenu",function(a){a.preventDefault();return!1},!1);b.addEventListener("gesturechange",function(b){a.kb.rq===Ck&&b.preventDefault()},!1);b.addEventListener("pointerdown",a.mG,!1);b.addEventListener("pointermove",a.oG,!1);b.addEventListener("pointerleave",a.nG,!1);window.addEventListener("resize",a.$B,!1)}E.prototype.computePixelRatio=function(){return null!==this.Bk?this.Bk:this.DD};E.prototype.doMouseMove=function(){this.gb.doMouseMove()};
E.prototype.doMouseDown=function(){this.gb.doMouseDown()};E.prototype.doMouseUp=function(){this.gb.doMouseUp()};E.prototype.doMouseWheel=function(){this.gb.doMouseWheel()};E.prototype.doKeyDown=function(){this.gb.doKeyDown()};E.prototype.doKeyUp=function(){this.gb.doKeyUp()};E.prototype.doFocus=function(){this.focus()};E.prototype.focus=E.prototype.focus=function(){this.Lb&&this.Lb.focus()};
function al(a){if(null!==a.Lb){var b=a.Sb;if(0!==b.clientWidth&&0!==b.clientHeight){var c=a.wl?a.Rd:0,d=a.lk?a.Rd:0,e=a.od;a.od=a.computePixelRatio();a.od!==e&&(a.ds=!0,a.Se());if(b.clientWidth!==a.Ob+c||b.clientHeight!==a.Rb+d)a.Sm=!0,a.Me=!0,b=a.Vb,null!==b&&b.Zx&&a.am===Nh&&b.N(),a.ge||a.Se()}}}
function Fl(a){var b=new Rg;b.name="Background";a.Pt(b);b=new Rg;b.name="";a.Pt(b);b=new Rg;b.name="Foreground";a.Pt(b);b=new Rg;b.name="Adornment";b.Tc=!0;a.Pt(b);b=new Rg;b.name="Tool";b.Tc=!0;b.LF=!0;a.Pt(b);b=new Rg;b.name="Grid";b.Bf=!1;b.pg=!1;b.Tc=!0;a.LH(b,a.jm("Background"))}
function Ml(a){a.zd=new x(Nl);a.zd.name="GRID";var b=new z;b.Jb="LineH";b.stroke="lightgray";b.jb=.5;b.interval=1;a.zd.add(b);b=new z;b.Jb="LineH";b.stroke="gray";b.jb=.5;b.interval=5;a.zd.add(b);b=new z;b.Jb="LineH";b.stroke="gray";b.jb=1;b.interval=10;a.zd.add(b);b=new z;b.Jb="LineV";b.stroke="lightgray";b.jb=.5;b.interval=1;a.zd.add(b);b=new z;b.Jb="LineV";b.stroke="gray";b.jb=.5;b.interval=5;a.zd.add(b);b=new z;b.Jb="LineV";b.stroke="gray";b.jb=1;b.interval=10;a.zd.add(b);b=new F;b.add(a.zd);
b.Jf="Grid";b.Bo=0;b.Ux=!1;b.KF=!1;b.pg=!1;b.iy="GRID";a.add(b);a.pb.remove(b);a.zd.visible=!1}function Ol(){this.ba.isEnabled?this.ba.rI(this):Pl(this.ba)}function Ql(a){this.ba.isEnabled?(this.ba.Xz=!0,this.ba.Zz=a.target.scrollTop,this.ba.Yz=a.target.scrollLeft):Pl(this.ba)}
E.prototype.diagramScroll=E.prototype.rI=function(a){if(this.Xz&&null!==this.Lb){this.Kw=!0;var b=this.cd,c=this.xb,d=b.width,e=c.width,g=b.height,h=c.height,k=b.right,l=c.right,m=b.bottom,n=c.bottom,p=b.x,q=c.x,b=b.y,c=c.y,r=this.scale,s;s=a.scrollLeft;if(this.hs)switch(this.Vz){case "negative":s=s+a.scrollWidth-a.clientWidth;break;case "reverse":s=a.scrollWidth-s-a.clientWidth}var u=s;e<d||h<g?(s=D.Fb(this.position.x,this.position.y),this.ye&&this.Yz!==u&&(s.x=u/r+p,this.Yz=u),this.ze&&this.Zz!==
a.scrollTop&&(s.y=a.scrollTop/r+b,this.Zz=a.scrollTop),this.position=s,D.A(s),this.Sm=this.Kw=!1):(s=D.P(),a.zH&&this.ye&&(p<q&&(this.position=s.m(u+p,this.position.y)),k>l&&(this.position=s.m(-(this.Ow.scrollWidth-this.Ob)+u-this.Ob/r+k,this.position.y))),a.AH&&this.ze&&(b<c&&(this.position=s.m(this.position.x,a.scrollTop+b)),m>n&&(this.position=s.m(this.position.x,-(this.Ow.scrollHeight-this.Rb)+a.scrollTop-this.Rb/r+m))),D.A(s),Rl(this),this.Sm=this.Kw=!1,b=this.cd,c=this.xb,k=b.right,l=c.right,
m=b.bottom,n=c.bottom,p=b.x,q=c.x,b=b.y,c=c.y,e>=d&&p>=q&&k<=l&&(this.lt.style.width="1px"),h>=g&&b>=c&&m<=n&&(this.lt.style.height="1px"))}};E.prototype.computeBounds=E.prototype.Kh=function(){0<this.Cg.count&&Li(this);return Sl(this)};
function Sl(a){if(a.rF.F()){var b=a.rF.copy();b.ix(a.padding);return b}for(var c=!0,d=a.bc.o,e=d.length,g=0;g<e;g++){var h=d[g];if(h.visible&&(!h.Tc||h.LF))for(var h=h.pb.o,k=h.length,l=0;l<k;l++){var m=h[l];m.Ux&&m.isVisible()&&(m=m.$,m.F()&&(c?(c=!1,b=m.copy()):b.Wh(m)))}}c&&(b=new B(0,0,0,0));b.ix(a.padding);return b}
E.prototype.computePartsBounds=function(a,b){void 0===b&&(b=!1);for(var c=null,d=a.j;d.next();){var e=d.value;!b&&e instanceof J||(e.hf(),null===c?c=e.$.copy():c.Wh(e.$))}return null===c?new B(NaN,NaN,0,0):c};
function Tl(a,b){if((b||a.th)&&!a.Zc&&null!==a.Lb&&!a.Xa.sf&&a.cd.F()){a.Zc=!0;var c=a.Im;b&&a.yl!==Nh&&(c=a.yl);var d=c!==Nh?Ul(a,c):a.scale,c=a.xb.copy(),e=a.Ob/d,g=a.Rb/d,h=null,k=a.Xa;k.vc&&(h=a.qb.copy());a.position.Ya();var l=a.No;b&&!l.fd()&&a.ip.fd()&&(l=a.ip);Vl(a,a.qb,a.cd,e,g,l,b);a.position.freeze();null!==h&&ml(k,h,a.qb);e=a.scale;a.scale=d;a.Zc=!1;d=a.xb;d.Sc(c)||a.Pu(c,d,e,a.scale,!1)}}
function Ul(a,b){var c=a.wb.zx;if(null===a.Lb)return c;a.mk&&Wl(a,a.Kh());var d=a.cd;if(!d.F())return c;var e=d.width,d=d.height,g=a.Ob,h=a.Rb,k=g/e,l=h/d;return b===Xl?(e=Math.min(l,k),e>c&&(e=c),e<a.Qh&&(e=a.Qh),e>a.Ph&&(e=a.Ph),e):b===Yl?(e=l>k?(h-a.Rd)/d:(g-a.Rd)/e,e>c&&(e=c),e<a.Qh&&(e=a.Qh),e>a.Ph&&(e=a.Ph),e):a.scale}E.prototype.zoomToFit=E.prototype.zoomToFit=function(){this.scale=Ul(this,Xl)};
E.prototype.zoomToRect=function(a,b){void 0===b&&(b=Xl);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===Xl||b===Yl)if(isNaN(c))e=this.xb.height*this.scale/d;else if(isNaN(d))e=this.xb.width*this.scale/c;else var e=this.Ob,g=this.Rb,e=b===Yl?g/d>e/c?(g-(this.lk?this.Rd:0))/d:(e-(this.wl?this.Rd:0))/c:Math.min(g/d,e/c);this.scale=e;this.position=new O(a.x,a.y)}};D.defineProperty(E,{YA:null},function(){return this.Zc},function(a){this.Zc=a});
E.prototype.alignDocument=function(a,b){this.mk&&Wl(this,this.Kh());var c=this.cd,d=this.xb;this.position=new O(c.x+(a.x*c.width+a.offsetX)-(b.x*d.width-b.offsetX),c.y+(a.y*c.height+a.offsetY)-(b.y*d.height-b.offsetY))};
function Vl(a,b,c,d,e,g,h){var k=b.x,l=b.y;if(h||a.yB===xl)g.fd()&&(d>c.width&&(k=c.x+(g.x*c.width+g.offsetX)-(g.x*d-g.offsetX)),e>c.height&&(l=c.y+(g.y*c.height+g.offsetY)-(g.y*e-g.offsetY))),g=a.IG,h=d-c.width,d<c.width+g.left+g.right?(k=Math.min(k+d/2,c.right+Math.max(h,g.right)-d/2),k=Math.max(k,c.left-Math.max(h,g.left)+d/2),k-=d/2):k>c.left?k=c.left:k<c.right-d&&(k=c.right-d),d=e-c.height,e<c.height+g.top+g.bottom?(l=Math.min(l+e/2,c.bottom+Math.max(d,g.bottom)-e/2),l=Math.max(l,c.top-Math.max(d,
g.top)+e/2),l-=e/2):l>c.top?l=c.top:l<c.bottom-e&&(l=c.bottom-e);b.x=isFinite(k)?k:-a.padding.left;b.y=isFinite(l)?l:-a.padding.top;null!==a.qG&&(a=a.qG(a,b),b.x=a.x,b.y=a.y)}E.prototype.findPartAt=E.prototype.iu=function(a,b){var c=b?Pi(this,a,function(a){return a.Y},function(a){return a.canSelect()}):Pi(this,a,function(a){return a.Y});return c instanceof F?c:null};
E.prototype.findObjectAt=E.prototype.Ge=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);Li(this);for(var d=this.bc.$n;d.next();){var e=d.value;if(e.visible&&(e=e.Ge(a,b,c),null!==e))return e}return null};function Pi(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);Li(a);for(a=a.bc.$n;a.next();){var e=a.value;if(e.visible&&!e.Tc&&(e=e.Ge(b,c,d),null!==e))return e}return null}
E.prototype.findObjectsAt=E.prototype.hu=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof K||d instanceof L||(d=new L(P));Li(this);for(var e=this.bc.$n;e.next();){var g=e.value;g.visible&&g.hu(a,b,c,d)}return d};E.prototype.findObjectsIn=E.prototype.Qk=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof K||e instanceof L||(e=new L(P));Li(this);for(var g=this.bc.$n;g.next();){var h=g.value;h.visible&&h.Qk(a,b,c,d,e)}return e};
E.prototype.IA=function(a,b,c,d,e,g){var h=new L(P);Li(this);for(var k=this.bc.$n;k.next();){var l=k.value;l.visible&&l.IA(a,b,c,d,h,e,g)}return h};E.prototype.findObjectsNear=E.prototype.On=function(a,b,c,d,e,g){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof K||e instanceof L)g=e;e=!0}g instanceof K||g instanceof L||(g=new L(P));Li(this);for(var h=this.bc.$n;h.next();){var k=h.value;k.visible&&k.On(a,b,c,d,e,g)}return g};
E.prototype.acceptEvent=function(a){var b=this.bd;this.bd=this.Tb;this.Tb=b;Zl(this,this,a,b,a instanceof MouseEvent);return b};
function Zl(a,b,c,d,e){d.g=b;d.event=c;e?$l(a,c,d):(d.qe=b.Tb.qe,d.ha=b.Tb.ha);a=0;c.ctrlKey&&(a+=1);c.altKey&&(a+=2);c.shiftKey&&(a+=4);c.metaKey&&(a+=8);d.Jd=a;d.button=c.button;void 0===c.buttons||D.gJ||(d.buttons=c.buttons);D.Vk&&0===c.button&&c.ctrlKey&&(d.button=2);d.im=!1;d.up=!1;d.Oe=1;d.hm=0;d.Lc=!1;d.bubbles=!1;d.timestamp=Date.now();d.yu=!1;d.fh=c.target.ba?c.target.ba:null;d.We=null}
function am(a,b,c,d,e){d.g=a;$l(a,c,d);d.Jd=0;d.button=0;d.buttons=1;d.im=!0;d.up=!1;d.Oe=1;d.hm=0;d.Lc=!1;d.bubbles=!0;d.event=b;d.timestamp=Date.now();d.yu=e;d.fh=b.target.ba?b.target.ba:null;d.We=null;a.Zi=d.copy();Vh=null}
function bm(a,b,c,d,e){var g=null;d.g=a;null!==c?((g=window.document.elementFromPoint(c.clientX,c.clientY))&&g.ba?g=g.ba:(c=b.changedTouches[0],g=a),d.fh=g,$l(a,c,d)):null!==a.bd?(d.ha=a.bd.ha,d.qe=a.bd.qe,d.fh=a.bd.fh):null!==a.Zi&&(d.ha=a.Zi.ha,d.qe=a.Zi.qe,d.fh=a.Zi.fh);d.Jd=0;d.button=0;d.buttons=1;d.im=!1;d.up=!1;d.Oe=1;d.hm=0;d.Lc=!1;d.bubbles=!1;d.event=b;d.timestamp=Date.now();d.yu=e;d.We=null}
function ga(a,b,c){if(b.bubbles)return v&&v.FF&&D.trace("NOT handled "+c.type+" "+b.toString()),!0;v&&v.FF&&D.trace("handled "+c.type+" "+a.gb.name+" "+b.toString());void 0!==c.stopPropagation&&c.stopPropagation();(void 0===c.touches||2>c.touches.length)&&c.preventDefault();c.cancelBubble=!0;return!1}
E.prototype.nJ=function(a){if(!this.ba.isEnabled)return!1;var b=this.ba.Tb;Zl(this.ba,this.ba,a,b,!1);b.key=String.fromCharCode(a.which);b.im=!0;switch(a.which){case 8:b.key="Backspace";break;case 33:b.key="PageUp";break;case 34:b.key="PageDown";break;case 35:b.key="End";break;case 36:b.key="Home";break;case 37:b.key="Left";break;case 38:b.key="Up";break;case 39:b.key="Right";break;case 40:b.key="Down";break;case 45:b.key="Insert";break;case 46:b.key="Del";break;case 48:b.key="0";break;case 187:case 61:case 107:b.key=
"Add";break;case 189:case 173:case 109:b.key="Subtract";break;case 27:b.key="Esc"}this.ba.doKeyDown();return 187!==a.which&&189!==a.which&&48!==a.which&&107!==a.which&&109!==a.which&&61!==a.which&&173!==a.which||!0!==a.ctrlKey?ga(this.ba,b,a):(a.cancelBubble=!0,a.preventDefault(),a.stopPropagation(),!1)};
E.prototype.oJ=function(a){if(!this.ba.isEnabled)return!1;var b=this.ba.Tb;Zl(this.ba,this.ba,a,b,!1);b.key=String.fromCharCode(a.which);b.up=!0;switch(a.which){case 8:b.key="Backspace";break;case 33:b.key="PageUp";break;case 34:b.key="PageDown";break;case 35:b.key="End";break;case 36:b.key="Home";break;case 37:b.key="Left";break;case 38:b.key="Up";break;case 39:b.key="Right";break;case 40:b.key="Down";break;case 45:b.key="Insert";break;case 46:b.key="Del";break;case 93:a.preventDefault()}this.ba.doKeyUp();
return ga(this.ba,b,a)};E.prototype.ep=function(a){var b=this.Lb;if(null===b)return new O(0,0);var c=this.Ob,d=this.Rb,b=b.getBoundingClientRect(),c=a.clientX-c/b.width*b.left;a=a.clientY-d/b.height*b.top;return null!==this.Hc?(a=new O(c,a),hb(a,this.Hc),a):new O(c,a)};
function $l(a,b,c){var d=a.Lb,e=a.Ob,g=a.Rb,h=0,k=0;null!==d&&(d=d.getBoundingClientRect(),h=b.clientX-e/d.width*d.left,k=b.clientY-g/d.height*d.top);c.qe.m(h,k);null!==a.Hc?(b=D.Fb(h,k),a.Hc.Ci(b),c.ha.assign(b),D.A(b)):c.ha.m(h,k)}
function $f(a,b,c,d){var e=null;if(void 0!==b.targetTouches){if(2>b.targetTouches.length)return;e=b.targetTouches[c]}else if(null!==a.pj[0])e=a.pj[c];else return;c=a.Lb;b=a.Ob;a=a.Rb;var g=0,h=0;null!==c&&null!==e&&(c=c.getBoundingClientRect(),g=e.clientX-b/c.width*c.left,h=e.clientY-a/c.height*c.top);d.m(g,h)}E.prototype.invalidateDocumentBounds=E.prototype.yc=function(){this.mk||(this.mk=!0,this.Se(!0))};function jl(a){a.ge||Li(a);a.mk&&Wl(a,a.Kh())}
E.prototype.redraw=E.prototype.Hq=function(){this.Zc||this.ge||(this.qa(),cm(this),Rl(this),this.yc(),this.gg())};E.prototype.isUpdateRequested=function(){return this.Yf};E.prototype.delayInitialization=function(a){void 0===a&&(a=null);var b=this.Xa,c=b.isEnabled;b.Ii();b.isEnabled=!1;Vi(this);this.th=!1;b.isEnabled=c;null!==a&&D.setTimeout(a,1)};
E.prototype.requestUpdate=E.prototype.Se=function(a){void 0===a&&(a=!1);if(!0!==this.Yf&&!(this.Zc||!1===a&&this.ge)){this.Yf=!0;var b=this;requestAnimationFrame(function(){b.Yf&&b.gg()})}};E.prototype.maybeUpdate=E.prototype.gg=function(){if(!this.cp||this.Yf)this.cp&&(this.cp=!1),Vi(this)};function dm(a,b){a.Xa.sf||a.Zc||!a.Sm||Pl(a)||(b&&Li(a),Tl(a,!1))}
function Vi(a){if(!a.ge&&(a.Yf=!1,null!==a.Sb)){a.ge=!0;var b=a.Xa,c=a.Tz;if(!b.op&&0!==c.length){for(var d=c.o,e=d.length,g=0;g<e;g++){var h=d[g];em(h,!1);h.K()}c.clear()}c=a.eD;0<c.count&&(c.each(function(a){a.XB()}),c.clear());d=c=!1;b.sf&&(d=!0,c=a.Eb,a.Eb=!0);b.vc||al(a);dm(a,!1);null!==a.zd&&(a.zd.visible&&!a.Uv&&(fm(a),a.Uv=!0),!a.zd.visible&&a.Uv&&(a.Uv=!1));Li(a);e=!1;if(!a.th||a.wv)a.th?gm(a,!a.Mv):(a.$b("Initial Layout"),!1===b.isEnabled&&b.Ii(),gm(a,!1)),e=!0;a.Mv=!1;Li(a);a.aA||b.sf||
jl(a);dm(a,!0);e&&(a.th||km(a),a.Ja("LayoutCompleted"));Li(a);e&&!a.th&&(a.th=!0,a.Td("Initial Layout"),a.Eb||a.ra.clear(),D.setTimeout(function(){a.Fi=!1},1));Fm(a);$k(b);a.Ee(a.md);d&&(a.Eb=c);a.ge=!1}}D.w(E,{Zn:null},function(){return this.th});
function km(a){var b=a.bc.o;a.Lf(b,b.length,a);a.yl!==Nh?a.scale=Ul(a,a.yl):a.Im!==Nh?a.scale=Ul(a,a.Im):(b=a.aJ,isFinite(b)&&0<b&&(a.scale=b));b=a.$I;if(b.F())a.position=b;else{b=D.P();b.so(a.cd,a.ZI);var c=a.xb,c=D.gh(0,0,c.width,c.height),d=D.P();d.so(c,a.bJ);d.m(b.x-d.x,b.y-d.y);a.position=d;D.Mb(c);D.A(d);D.A(b);cm(a);dm(a,!0);Tl(a,!0)}a.Ja("InitialLayoutCompleted");fm(a)}
function Li(a){if((a.ge||!a.Xa.sf)&&0!==a.Cg.count){for(var b=0;23>b;b++){var c=a.Cg.j;if(null===c||0===a.Cg.count)break;a.Cg=new L(F);a.XB(c,a.Cg);v&&22===b&&D.trace("failure to validate parts")}a.ng.each(function(a){a instanceof I&&0!==(a.Ba&65536)!==!1&&(a.Ba^=65536)})}}
E.prototype.XB=function(a,b){for(a.reset();a.next();){var c=a.value;!c.oe()||c instanceof I||(c.um()?(Ak(c,Infinity,Infinity),c.oc()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof I&&c.isVisible()&&Gm(this,c);for(a.reset();a.next();)c=a.value,c instanceof J&&c.isVisible()&&(c.um()?(Ak(c,Infinity,Infinity),c.oc()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof da&&c.isVisible()&&(c.um()?(Ak(c,Infinity,Infinity),c.oc()):b.add(c))};
function Gm(a,b){for(var c=D.tb(),d=D.tb(),e=b.Mc;e.next();){var g=e.value;g.isVisible()&&(g instanceof I?(Hm(g)||Im(g)||Jm(g))&&Gm(a,g):g instanceof J?g.aa===b||g.da===b?d.push(g):c.push(g):(Ak(g,Infinity,Infinity),g.oc()))}for(var e=c.length,h=0;h<e;h++)g=c[h],Ak(g,Infinity,Infinity),g.oc();D.Aa(c);Ak(b,Infinity,Infinity);b.oc();e=d.length;for(h=0;h<e;h++)g=d[h],Ak(g,Infinity,Infinity),g.oc();D.Aa(d)}E.prototype.Lf=function(a,b,c,d){var e=this.Xa;if(this.zl||e.sf)for(e=0;e<b;e++)a[e].Lf(c,d)};
E.prototype.Ee=function(a,b){void 0===b&&(b=null);null===this.Sb&&D.k("No div specified");var c=this.Lb;null===c&&D.k("No canvas specified");var d=this.Xa;if(!d.vc&&(Km(this),"0"!==this.Sb.style.opacity)){var e=a!==this.md,g=this.bc.o,h=g.length,k=this;this.Lf(g,h,k);if(e)a.Be(!0),Rl(this);else if(!this.Me&&null===b&&!d.nk)return;var h=this.qb,l=this.Bb,m=Math.round(h.x*l)/l,n=Math.round(h.y*l)/l,d=this.Hc;d.reset();1!==l&&d.scale(l);0===h.x&&0===h.y||d.translate(-m,-n);l=this.od;D.Xn?(c.width=c.width,
a.Be(!0),a.scale(l,l)):(a.setTransform(1,0,0,1,0,0),a.scale(l,l),a.clearRect(0,0,this.Ob,this.Rb));a.setTransform(1,0,0,1,0,0);a.scale(l,l);a.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);v&&v.zj&&v.fF(this,a);c=null!==b?function(c){var d=b;if(c.visible&&0!==c.Fc){var e=c.pb.o,g=e.length;if(0!==g){1!==c.Fc&&(a.globalAlpha=c.Fc);c=c.Bw;c.length=0;for(var h=k.scale,l=0;l<g;l++){var m=e[l];if(ol(m)&&!d.contains(m)){if(m instanceof J){var n=m;n.qc&&c.push(n);if(!1===n.lh)continue}n=m.$;1<n.width*h||1<
n.height*h?m.Ee(a,k):ql(m,a)}}a.globalAlpha=1}}}:function(b){b.Ee(a,k)};Lm(this,a);h=g.length;for(m=0;m<h;m++)a.setTransform(1,0,0,1,0,0),a.scale(l,l),a.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy),c(g[m]);this.xl?this.xl.Em(this)&&this.Pv():this.ep=function(){return new O(0,0)};v&&(v.EA||v.zj)&&v.DA(a,this,d);e?(this.md.Be(!0),Rl(this)):this.Me=this.zl=!1}};
function Mm(a,b,c,d,e){null===a.Sb&&D.k("No div specified");var g=a.Lb;null===g&&D.k("No canvas specified");if(!a.Xa.vc){var h=a.md;if(a.Me){Km(a);var k=a.od;D.Xn?(g.width=g.width,h.Be(!0)):(h.setTransform(1,0,0,1,0,0),h.clearRect(0,0,a.Ob*k,a.Rb*k));h.Fy(!1);h.drawImage(a.rz.Ud,0<d?0:Math.round(-d),0<e?0:Math.round(-e));e=a.qb;var g=a.Bb,l=Math.round(e.x*g)/g,m=Math.round(e.y*g)/g;d=a.Hc;d.reset();1!==g&&d.scale(g);0===e.x&&0===e.y||d.translate(-l,-m);h.save();h.beginPath();e=c.length;for(g=0;g<
e;g++)l=c[g],0!==l.width&&0!==l.height&&h.rect(Math.floor(l.x),Math.floor(l.y),Math.ceil(l.width),Math.ceil(l.height));h.clip();h.setTransform(1,0,0,1,0,0);h.scale(k,k);h.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);v&&v.zj&&v.fF(a,h);c=a.bc.o;e=c.length;a.Lf(c,e,a);Lm(a,h);for(g=0;g<e;g++)rl(c[g],h,a,b);h.restore();h.Be(!0);v&&(v.EA||v.zj)&&v.DA(h,a,d);a.xl?a.xl.Em(a)&&a.Pv():a.ep=function(){return new O(0,0)};a.zl=!1;a.Me=!1;a.uy()}}}
function Nm(a,b,c,d,e,g,h,k,l,m){null===a.Sb&&D.k("No div specified");null===a.Lb&&D.k("No canvas specified");void 0===h&&(h=null);void 0===k&&(k=null);void 0===l&&(l=!1);void 0===m&&(m=!1);Km(a);a.md.Be(!0);Rl(a);a.Iz=!0;var n=a.Bb;a.Bb=e;var p=a.bc.o,q=p.length;try{var r=new B(g.x,g.y,d.width/e,d.height/e),s=r.copy();s.ix(c);fm(a,s);Li(a);a.Lf(p,q,a,r);var u=a.od;b.setTransform(1,0,0,1,0,0);b.scale(u,u);b.clearRect(0,0,d.width,d.height);null!==k&&""!==k&&(b.fillStyle=k,b.fillRect(0,0,d.width,d.height));
var t=D.Of();t.reset();t.translate(c.left,c.top);t.scale(e);0===g.x&&0===g.y||t.translate(-g.x,-g.y);b.setTransform(t.m11,t.m12,t.m21,t.m22,t.dx,t.dy);D.He(t);Lm(a,b);var y;if(null!==h){var w=new L(F),C=h.j;for(C.reset();C.next();){var A=C.value;!1===m&&"Grid"===A.layer.name||null===A||w.add(A)}y=function(c){var d=l;if(c.visible&&0!==c.Fc&&(void 0===d&&(d=!0),d||!c.Tc)){var d=c.pb.o,e=d.length;if(0!==e){1!==c.Fc&&(b.globalAlpha=c.Fc);c=c.Bw;c.length=0;for(var g=a.scale,h=0;h<e;h++){var k=d[h];if(ol(k)&&
w.contains(k)){if(k instanceof J){var m=k;m.qc&&c.push(m);if(!1===m.lh)continue}m=k.$;1<m.width*g||1<m.height*g?k.Ee(b,a):ql(k,b)}}b.globalAlpha=1}}}}else if(!l&&m){var N=a.Vn.Y,H=N.layer;y=function(c){c===H?N.Ee(b,a):c.Ee(b,a,l)}}else y=function(c){c.Ee(b,a,l)};for(c=0;c<q;c++)y(p[c]);a.Iz=!1;a.xl?a.xl.Em(a)&&a.Pv():a.ep=function(){return new O(0,0)}}finally{a.Bb=n,a.md.Be(!0),Rl(a),a.Lf(p,q,a),fm(a)}}E.prototype.getRenderingHint=E.prototype.Gj=function(a){return this.yk[a]};
E.prototype.setRenderingHint=E.prototype.hK=function(a,b){this.yk[a]=b;this.Hq()};E.prototype.resetRenderingHints=E.prototype.yG=function(){this.yk=new la;this.yk.drawShadows=!0;this.yk.textGreeking=!0;this.yk.viewportOptimizations=D.QF?!1:!0;this.yk.temporaryPixelRatio=!0;this.yk.pictureRatioOptimization=!0};function Lm(a,b){var c=a.yk;null!==c&&(void 0!==c.imageSmoothingEnabled&&b.Fy(!!c.imageSmoothingEnabled),c=c.defaultFont,void 0!==c&&null!==c&&(b.font=c))}
E.prototype.getInputOption=E.prototype.pu=function(a){return this.lp[a]};E.prototype.setInputOption=function(a,b){this.lp[a]=b};E.prototype.resetInputOptions=E.prototype.xG=function(){this.lp=new la;this.lp.extraTouchArea=10;this.lp.extraTouchThreshold=10;this.lp.hasGestureZoom=!0};E.prototype.setProperties=function(a){D.Zu(this,a)};function Fm(a){if(0===a.ra.Vh&&0!==a.sl.count){for(;0<a.sl.count;){var b=a.sl;a.sl=new ma(J,B);for(b=b.j;b.next();){var c=b.key;oj(c,b.value);c.Re()}}a.qa()}}
E.prototype.qa=function(a){void 0===a&&(a=null);if(null===a)this.Me=!0,this.Se();else{var b=this.xb;null!==a&&a.F()&&b.Wg(a)&&(this.Me=!0,this.Se())}for(b=this.Cw.j;b.next();)b.value.qa(a)};
E.prototype.JF=function(a,b){if(!0!==this.Me){this.Me=!0;var c=!0===this.Gj("temporaryPixelRatio");if(!0===this.Gj("viewportOptimizations")&&this.yB!==Om&&this.IG.Ex(0,0,0,0)&&b.width===a.width&&b.height===a.height){var d=this.scale,e=D.Nf(),g=Math.max(a.x,b.x),h=Math.max(a.y,b.y),k=Math.min(a.x+a.width,b.x+b.width),l=Math.min(a.y+a.height,b.y+b.height);e.x=g;e.y=h;e.width=Math.max(0,k-g)*d;e.height=Math.max(0,l-h)*d;if(0<e.width&&0<e.height){if(!this.ge&&(this.Yf=!1,null!==this.Sb)){this.ge=!0;Fm(this);
this.cd.F()||Wl(this,this.Kh());var m=this.Lb;if(null!==m){var n=this.od,h=this.Ob*n,k=this.Rb*n,g=this.scale*n,d=Math.round(Math.round(b.x*g)-Math.round(a.x*g)),g=Math.round(Math.round(b.y*g)-Math.round(a.y*g)),l=this.rz,p=this.WC;l.width!==h&&(l.width=h);l.height!==k&&(l.height=k);p.clearRect(0,0,h,k);var l=190*this.od,q=70*this.od,r=Math.max(d,0),s=Math.max(g,0),u=Math.floor(h-r),t=Math.floor(k-s);p.Fy(!1);p.drawImage(m.Ud,r,s,u,t,0,0,u,t);this.xl.Em(this)&&p.clearRect(0,0,l,q);var m=D.tb(),p=
D.tb(),t=Math.abs(d),u=Math.abs(g),y=0===r?0:h-t,r=D.Fb(y,0),t=D.Fb(t+y,k);p.push(new B(Math.min(r.x,t.x),Math.min(r.y,t.y),Math.abs(r.x-t.x),Math.abs(r.y-t.y)));var w=this.Hc;w.reset();w.scale(n,n);1!==this.Bb&&w.scale(this.Bb);n=this.qb;(0!==n.x||0!==n.y)&&isFinite(n.x)&&isFinite(n.y)&&w.translate(-n.x,-n.y);hb(r,w);hb(t,w);m.push(new B(Math.min(r.x,t.x),Math.min(r.y,t.y),Math.abs(r.x-t.x),Math.abs(r.y-t.y)));y=0===s?0:k-u;r.m(0,y);t.m(h,u+y);p.push(new B(Math.min(r.x,t.x),Math.min(r.y,t.y),Math.abs(r.x-
t.x),Math.abs(r.y-t.y)));hb(r,w);hb(t,w);m.push(new B(Math.min(r.x,t.x),Math.min(r.y,t.y),Math.abs(r.x-t.x),Math.abs(r.y-t.y)));this.xl.Em(this)&&(h=0<d?0:-d,k=0<g?0:-g,r.m(h,k),t.m(l+h,q+k),p.push(new B(Math.min(r.x,t.x),Math.min(r.y,t.y),Math.abs(r.x-t.x),Math.abs(r.y-t.y))),hb(r,w),hb(t,w),m.push(new B(Math.min(r.x,t.x),Math.min(r.y,t.y),Math.abs(r.x-t.x),Math.abs(r.y-t.y))));D.A(r);D.A(t);dm(this,!1);Mm(this,m,p,d,g);D.Aa(m);D.Aa(p);this.ge=!1}}}else this.gg();D.Mb(e);c&&(this.Bk=1,this.gg(),
this.Bk=null,this.uy())}else c?(this.Bk=1,this.gg(),this.Bk=null,this.uy()):this.gg()}};function cm(a){!1===a.Sm&&(a.Sm=!0)}function Rl(a){!1===a.zl&&(a.zl=!0)}function Km(a){!1!==a.ds&&(a.ds=!1,Pm(a,a.Ob,a.Rb))}function Pm(a,b,c){var d=a.Lb,e=a.od,g=b*e,e=c*e;if(d.width!==g||d.height!==e)d.width=g,d.height=e,d.style.width=b+"px",d.style.height=c+"px",a.Me=!0,a.md.Be(!0)}
function Pl(a){var b=a.Lb;if(null===b)return!0;var c=a.Sb,d=a.Ob,e=a.Rb,g=a.tE.copy();if(!g.F())return!0;var h=!1,k=a.wl?a.Rd:0,l=a.lk?a.Rd:0,m=c.clientWidth||d+k,n=c.clientHeight||e+l;if(m!==d+k||n!==e+l)a.wl=!1,a.lk=!1,l=k=0,a.Ob=m,a.Rb=n,h=a.ds=!0;a.Sm=!1;var p=a.xb,c=a.cd,m=c.width,n=c.height,q=p.width,r=p.height,s=c.x,u=p.x,t=c.right,y=p.right+k,w=c.y,C=p.y,A=c.bottom,p=p.bottom+l,N="1px",H="1px",c=a.scale;a.yB===xl&&m<q+k&&n<r+l||(a.TA&&a.ye&&(N=1,s+1<u&&(N=Math.max((u-s)*c+a.Ob,N)),t>y+1&&
(N=Math.max((t-y)*c+a.Ob,N)),q+k+1<m&&(N=Math.max((m-q+k)*c+a.Ob,N)),N=N.toString()+"px"),a.UA&&a.ze&&(k=1,w+1<C&&(k=Math.max((C-w)*c+a.Rb,k)),A>p+1&&(k=Math.max((A-p)*c+a.Rb,k)),r+l+1<n&&(k=Math.max((n-r+l)*c+a.Rb,k)),H=k.toString()+"px"));l="1px"!==N;k="1px"!==H;if(!(l&&k||!l&&!k)){k&&(y-=a.Rd);l&&(p-=a.Rd);a.TA&&a.ye&&(N=1,s+1<u&&(N=Math.max((u-s)*c+a.Ob,N)),t>y+1&&(N=Math.max((t-y)*c+a.Ob,N)),q+1<m&&(N=Math.max((m-q)*c+a.Ob,N)),N=N.toString()+"px");var l="1px"!==N,W=l!==a.lk?a.Rb-a.Rd:a.Rb;a.UA&&
a.ze&&(k=1,w+1<C&&(k=Math.max((C-w)*c+W,k)),A>p+1&&(k=Math.max((A-p)*c+W,k)),r+1<n&&(k=Math.max((n-r)*c+W,k)),H=k.toString()+"px");k="1px"!==H}if(a.Kw&&l===a.lk&&k===a.wl)return d===a.Ob&&e===a.Rb||a.gg(),!1;l!==a.lk&&(a.Rb="1px"===N?a.Rb+a.Rd:Math.max(a.Rb-a.Rd,1),h=!0);a.lk=l;a.lt.style.width=N;k!==a.wl&&(a.Ob="1px"===H?a.Ob+a.Rd:Math.max(a.Ob-a.Rd,1),h=!0,a.hs&&(l=D.P(),k?(b.style.left=a.Rd+"px",a.position=l.m(a.qb.x+a.Rd/a.scale,a.qb.y)):(b.style.left="0px",a.position=l.m(a.qb.x-a.Rd/a.scale,
a.qb.y)),D.A(l)));a.wl=k;a.lt.style.height=H;b=a.Ow;l=b.scrollLeft;a.TA&&a.ye&&(q+1<m?l=(a.position.x-s)*c:s+1<u?l=b.scrollWidth-b.clientWidth:t>y+1&&(l=a.position.x*c));if(a.hs)switch(a.Vz){case "negative":l=-(b.scrollWidth-l-b.clientWidth);break;case "reverse":l=b.scrollWidth-l-b.clientWidth}b.scrollLeft=l;a.UA&&a.ze&&(r+1<n?b.scrollTop=(a.position.y-w)*c:w+1<C?b.scrollTop=b.scrollHeight-b.clientHeight:A>p+1&&(b.scrollTop=a.position.y*c));h&&(a.ds=!0);m=a.Ob;n=a.Rb;b.style.width=m+(a.wl?a.Rd:0)+
"px";b.style.height=n+(a.lk?a.Rd:0)+"px";a.Xz=!1;return d!==m||e!==n||a.Xa.vc?(p=a.xb,a.Pu(g,p,c,a.scale,h),!1):!0}
E.prototype.add=E.prototype.add=function(a){D.l(a,F,E,"add:part");var b=a.g;if(b!==this){null!==b&&D.k("Cannot add part "+a.toString()+" to "+this.toString()+". It is already a part of "+b.toString());this.br&&(a.El="Tool");var c=a.Jf,b=this.jm(c);null===b&&(b=this.jm(""));null===b&&D.k('Cannot add a Part when unable find a Layer named "'+c+'" and there is no default Layer');a.layer!==b&&(c=b.uq(99999999,a,a.g===this),0<=c&&this.hd(mg,"parts",b,null,a,null,c),b.Tc||this.yc(),a.N(Qm),c=a.by,null!==
c&&c(a,null,b))}};
E.prototype.uq=function(a){if(a instanceof G){if(this.Cp.add(a),a instanceof I){var b=a.Pa;null===b?this.Rl.add(a):b.en.add(a);b=a.Vb;null!==b&&(b.g=this)}}else a instanceof J?this.wp.add(a):a instanceof da||this.pb.add(a);var c=this;Rm(a,function(a){Sm(c,a)});(a instanceof da||a instanceof I&&null!==a.Qb)&&a.K();b=a.data;null!==b&&(a instanceof da||(a instanceof J?this.ck.add(b,a):this.Ti.add(b,a)),Rm(a,function(a){Tm(c,a)}));!0!==Im(a)&&!0!==Jm(a)||this.Cg.add(a);Um(a,!0,this);Vm(a)?(a.$.F()&&this.qa(sl(a,
a.$)),this.yc()):a.isVisible()&&a.$.F()&&this.qa(sl(a,a.$));this.Se()};
E.prototype.rf=function(a){a.Zt();if(a instanceof G){if(this.Cp.remove(a),a instanceof I){var b=a.Pa;null===b?this.Rl.remove(a):b.en.remove(a);b=a.Vb;null!==b&&(b.g=null)}}else a instanceof J?this.wp.remove(a):a instanceof da||this.pb.remove(a);var c=this;Rm(a,function(a){Wm(c,a)});b=a.data;null!==b&&(a instanceof da||(a instanceof J?this.ck.remove(b):this.Ti.remove(b)),Rm(a,function(a){Xm(c,a)}));this.Cg.remove(a);Vm(a)?(a.$.F()&&this.qa(sl(a,a.$)),this.yc()):a.isVisible()&&a.$.F()&&this.qa(sl(a,
a.$));this.Se()};E.prototype.remove=E.prototype.remove=function(a){D.l(a,F,E,"remove:part");Ym(this,a,!0)};function Ym(a,b,c){var d=b.layer;null!==d&&d.g===a&&(b.hb=!1,b.Xg=!1,b.N(Zm),c&&b.Mn(),c=d.rf(-1,b,!1),0<=c&&a.hd(ng,"parts",d,b,null,c,null),a=b.by,null!==a&&a(b,d,null))}
E.prototype.removeParts=E.prototype.vB=function(a,b){if(D.isArray(a))for(var c=D.cb(a),d=0;d<c;d++){var e=D.La(a,d);b&&!e.canDelete()||this.remove(e)}else for(e=new L(F),e.Rc(a),c=e.j;c.next();)e=c.value,b&&!e.canDelete()||this.remove(e)};E.prototype.copyParts=E.prototype.hq=function(a,b,c){return this.wb.hq(a,b,c)};
E.prototype.moveParts=E.prototype.moveParts=function(a,b,c){D.l(b,O,E,"moveParts:offset");var d=this.kb;if(null!==d){d=d.De;null===d&&(d=new Mh,d.Xc(this));var e=new ma(F);if(null!==a)a=a.j;else{for(a=this.Gi;a.next();)Yh(d,e,a.value,c);for(a=this.ng;a.next();)Yh(d,e,a.value,c);a=this.links}for(;a.next();)Yh(d,e,a.value,c);d.moveParts(e,b,c)}};
function $m(a,b,c){D.l(b,Rg,E,"addLayer:layer");null!==b.g&&b.g!==a&&D.k("Cannot share a Layer with another Diagram: "+b+" of "+b.g);null===c?null!==b.g&&D.k("Cannot add an existing Layer to this Diagram again: "+b):(D.l(c,Rg,E,"addLayer:existingLayer"),c.g!==a&&D.k("Existing Layer must be in this Diagram: "+c+" not in "+c.g),b===c&&D.k("Cannot move a Layer before or after itself: "+b));if(b.g!==a){b=b.name;a=a.bc;c=a.count;for(var d=0;d<c;d++)a.ea(d).name===b&&D.k("Cannot add Layer with the name '"+
b+"'; a Layer with the same name is already present in this Diagram.")}}E.prototype.addLayer=E.prototype.Pt=function(a){$m(this,a,null);a.Xc(this);var b=this.bc,c=b.count-1;if(!a.Tc)for(;0<=c&&b.ea(c).Tc;)c--;b.Xd(c+1,a);null!==this.ve&&this.hd(mg,"layers",this,null,a,null,c+1);this.qa();this.yc()};
E.prototype.addLayerBefore=E.prototype.LH=function(a,b){$m(this,a,b);a.Xc(this);var c=this.bc,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.ve&&this.hd(ng,"layers",this,a,null,d,null));for(var e=c.count,g=0;g<e;g++)if(c.ea(g)===b){c.Xd(g,a);break}null!==this.ve&&this.hd(mg,"layers",this,null,a,null,g);this.qa();0>d&&this.yc()};
E.prototype.addLayerAfter=function(a,b){$m(this,a,b);a.Xc(this);var c=this.bc,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.ve&&this.hd(ng,"layers",this,a,null,d,null));for(var e=c.count,g=0;g<e;g++)if(c.ea(g)===b){c.Xd(g+1,a);break}null!==this.ve&&this.hd(mg,"layers",this,null,a,null,g+1);this.qa();0>d&&this.yc()};
E.prototype.removeLayer=function(a){D.l(a,Rg,E,"removeLayer:layer");a.g!==this&&D.k("Cannot remove a Layer from another Diagram: "+a+" of "+a.g);if(""!==a.name){var b=this.bc,c=b.indexOf(a);if(b.remove(a)){for(b=a.pb.copy().j;b.next();){var d=b.value,e=d.Jf;d.Jf=e!==a.name?e:""}null!==this.ve&&this.hd(ng,"layers",this,a,null,c,null);this.qa();this.yc()}}};E.prototype.findLayer=E.prototype.jm=function(a){for(var b=this.ao;b.next();){var c=b.value;if(c.name===a)return c}return null};
E.prototype.addModelChangedListener=E.prototype.NH=function(a){D.h(a,"function",E,"addModelChangedListener:listener");null===this.wh&&(this.wh=new K("function"));this.wh.add(a);this.ga.An(a)};E.prototype.removeModelChangedListener=function(a){D.h(a,"function",E,"removeModelChangedListener:listener");null!==this.wh&&(this.wh.remove(a),0===this.wh.count&&(this.wh=null));this.ga.Su(a)};
E.prototype.addChangedListener=E.prototype.An=function(a){D.h(a,"function",E,"addChangedListener:listener");null===this.Oi&&(this.Oi=new K("function"));this.Oi.add(a)};E.prototype.removeChangedListener=E.prototype.Su=function(a){D.h(a,"function",E,"removeChangedListener:listener");null!==this.Oi&&(this.Oi.remove(a),0===this.Oi.count&&(this.Oi=null))};
E.prototype.qx=function(a){this.Eb||this.ra.EF(a);a.Ic!==dg&&(this.Fi=!0);if(null!==this.Oi){var b=this.Oi,c=b.length;if(1===c)b=b.ea(0),b(a);else if(0!==c)for(var d=b.lc(),e=0;e<c;e++)b=d[e],b(a)}};E.prototype.raiseChangedEvent=E.prototype.hd=function(a,b,c,d,e,g,h){void 0===g&&(g=null);void 0===h&&(h=null);var k=new bg;k.g=this;k.Ic=a;k.propertyName=b;k.object=c;k.oldValue=d;k.Sj=g;k.newValue=e;k.Qj=h;this.qx(k)};
E.prototype.raiseChanged=E.prototype.i=function(a,b,c,d,e){this.hd(cg,a,this,b,c,d,e)};D.w(E,{Xa:"animationManager"},function(){return this.mC});D.w(E,{ra:"undoManager"},function(){return this.ve.ra});D.defineProperty(E,{Eb:"skipsUndoManager"},function(){return this.tj},function(a){D.h(a,"boolean",E,"skipsUndoManager");this.tj=a;this.ve.tj=a});D.defineProperty(E,{AA:"delaysLayout"},function(){return this.nz},function(a){this.nz=a});
E.prototype.En=function(a,b){if(null!==a&&a.g===this){var c=this.Ue;try{this.Ue=!0;var d=a.Ic,e;if(d===cg){var g=a.object,h=a.propertyName,k=a.oa(b);D.Ua(g,h,k);if(g instanceof P){var l,m=g.Y;null!==m&&m.ne()}this.Fi=!0}else if(d===mg){var n=a.object,p=a.Qj,g=a.newValue;if(n instanceof x)if("number"===typeof p&&g instanceof P){l=g;var q=n;b?q.rf(p):q.Xd(p,l);m=n.Y;null!==m&&m.ne()}else{if("number"===typeof p&&g instanceof ch){var r=g,q=n;b?r.Ie?q.wG(p):q.tG(p):(e=r.Ie?q.me(r.index):q.le(r.index),
e.gq(r))}}else if(n instanceof Rg){var s=!0===a.Sj;if("number"===typeof p&&g instanceof F){var m=g,u=n;b?(m.hb=!1,m.Xg=!1,m.ne(),u.rf(s?p:-1,m,s)):u.uq(p,m,s)}}else if(n instanceof E){if("number"===typeof p&&g instanceof Rg){var t=g;b?this.bc.jd(p):(d=t,d.Xc(this),this.bc.Xd(p,d))}}else D.k("unknown ChangedEvent.Insert object: "+a.toString());this.Fi=!0}else d===ng?(n=a.object,p=a.Sj,g=a.oldValue,n instanceof x?"number"===typeof p&&g instanceof P?(q=n,b?q.Xd(p,g):q.rf(p)):"number"===typeof p&&g instanceof
ch&&(r=g,q=n,b?(e=r.Ie?q.me(r.index):q.le(r.index),e.gq(r)):r.Ie?q.wG(p):q.tG(p)):n instanceof Rg?(s=!0===a.Qj,"number"===typeof p&&g instanceof F&&(m=g,u=n,b?u.uq(p,m,s):(m.hb=!1,m.Xg=!1,m.ne(),u.rf(s?p:-1,m,s)))):n instanceof E?"number"===typeof p&&g instanceof Rg&&(t=g,b?(d=t,d.Xc(this),this.bc.Xd(p,d)):this.bc.jd(p)):D.k("unknown ChangedEvent.Remove object: "+a.toString()),this.Fi=!0):d!==dg&&D.k("unknown ChangedEvent: "+a.toString())}finally{this.Ue=c}}};
E.prototype.startTransaction=E.prototype.$b=function(a){return this.ra.$b(a)};E.prototype.commitTransaction=E.prototype.Td=function(a){return this.ra.Td(a)};E.prototype.rollbackTransaction=E.prototype.Kq=function(){return this.ra.Kq()};E.prototype.updateAllTargetBindings=E.prototype.hH=function(a){void 0===a&&(a="");for(var b=this.Gi;b.next();)b.value.Nb(a);for(b=this.ng;b.next();)b.value.Nb(a);for(b=this.links;b.next();)b.value.Nb(a)};
E.prototype.updateAllRelationshipsFromData=E.prototype.yK=function(){for(var a=this.ga,b=new L,c=a.mg,d=0;d<c.length;d++){var e=c[d];b.add(e)}var g=[];this.ng.each(function(a){null===a.data||b.contains(a.data)||g.push(a.data)});this.Gi.each(function(a){null===a.data||b.contains(a.data)||g.push(a.data)});g.forEach(function(b){Yg(a,b,!1)});for(d=0;d<c.length;d++){var e=c[d],h=this.Nh(e);null===h&&Xg(a,e,!1)}if(a instanceof Y){for(var k=new L,c=a.Yg,d=0;d<c.length;d++)e=c[d],k.add(e);var l=[];this.links.each(function(a){null===
a.data||k.contains(a.data)||l.push(a.data)});l.forEach(function(b){hh(a,b,!1)});for(d=0;d<c.length;d++)e=c[d],h=this.bg(e),null===h&&gh(a,e,!1)}for(d=this.Gi;d.next();)h=d.value,h.updateRelationshipsFromData();for(d=this.ng;d.next();)d.value.updateRelationshipsFromData();for(d=this.links;d.next();)h=d.value,h.updateRelationshipsFromData()};
function an(a,b,c){if(a.Zc||a.ge)a.Bb=c,c=a.Xa,c.vc&&nl(c,b,a.Bb);else if(a.Zc=!0,null===a.Lb)a.Bb=c;else{var d=a.xb.copy(),e=a.Ob,g=a.Rb;d.width=a.Ob/b;d.height=a.Rb/b;var h=a.Fm.x,k=a.Fm.y,l=a.RE;isNaN(h)&&(l.Kj()?l.Ij(tc)?h=0:l.Ij(uc)&&(h=e-1):h=l.fd()?l.x*(e-1):e/2);isNaN(k)&&(l.Kj()?l.Ij(sc)?k=0:l.Ij(yc)&&(k=g-1):k=l.fd()?l.y*(g-1):g/2);null!==a.HG&&(c=a.HG(a,c));c<a.Qh&&(c=a.Qh);c>a.Ph&&(c=a.Ph);e=D.Fb(a.qb.x+h/b-h/c,a.qb.y+k/b-k/c);a.position=e;D.A(e);a.Bb=c;a.Pu(d,a.xb,b,c,!1);a.Zc=!1;Tl(a,
!1);c=a.Xa;c.vc&&nl(c,b,a.Bb);a.qa();cm(a)}}E.prototype.Pu=function(a,b,c,d,e){a.O(b)||(void 0===e&&(e=!1),e||cm(this),Rl(this),d=this.Vb,null===d||!d.Zx||this.am!==Nh||e||a.width===b.width&&a.height===b.height||d.N(),d=this.gb,!0===this.Um&&d instanceof Hh&&(this.U.ha=this.UB(this.U.qe),Ek(d,this)),this.Zc||this.JF(a,b),fm(this),this.Fh.scale=c,this.Fh.position.x=a.x,this.Fh.position.y=a.y,this.Fh.bounds.set(a),this.Fh.isScroll=e,this.Ja("ViewportBoundsChanged",this.Fh,a))};
function fm(a,b){void 0===b&&(b=null);var c=a.zd;if(null!==c&&c.visible){for(var d=D.Cm(),e=1,g=1,h=c.xa.o,k=h.length,l=0;l<k;l++){var m=h[l],n=m.interval;2>n||(bn(m.Jb)?g=g*n/$e(g,n):e=e*n/$e(e,n))}h=c.Ox;d.m(g*h.width,e*h.height);h=g=l=k=0;if(null!==b)k=b.width,l=b.height,g=b.x,h=b.y;else{e=D.Nf();g=a.xb;e.m(g.x,g.y,g.width,g.height);for(h=a.Cw.j;h.next();)g=h.value.xb,g.F()&&Ob(e,g.x,g.y,g.width,g.height);if(!e.F()){D.Mb(e);return}k=e.width;l=e.height;g=e.x;h=e.y;D.Mb(e)}c.width=k+2*d.width;c.height=
l+2*d.height;e=D.P();gb(g,h,0,0,d.width,d.height,e);e.offset(-d.width,-d.height);D.Rk(d);c.Y.location=e;D.A(e)}}E.prototype.clearSelection=E.prototype.tx=function(){var a=0<this.selection.count;a&&this.Ja("ChangingSelection");Lh(this);a&&this.Ja("ChangedSelection")};function Lh(a){a=a.selection;if(0<a.count){for(var b=a.lc(),c=b.length,d=0;d<c;d++)b[d].hb=!1;a.Ya();a.clear();a.freeze()}}
E.prototype.select=E.prototype.select=function(a){null!==a&&(D.l(a,F,E,"select:part"),a.layer.g===this&&(!a.hb||1<this.selection.count)&&(this.Ja("ChangingSelection"),Lh(this),a.hb=!0,this.Ja("ChangedSelection")))};
E.prototype.selectCollection=E.prototype.LG=function(a){this.Ja("ChangingSelection");Lh(this);if(D.isArray(a))for(var b=D.cb(a),c=0;c<b;c++){var d=D.La(a,c);d instanceof F||D.k("Diagram.selectCollection given something that is not a Part: "+d);d.hb=!0}else for(a=a.j;a.next();)d=a.value,d instanceof F||D.k("Diagram.selectCollection given something that is not a Part: "+d),d.hb=!0;this.Ja("ChangedSelection")};
E.prototype.clearHighlighteds=E.prototype.WH=function(){var a=this.qm;if(0<a.count){for(var b=a.lc(),c=b.length,d=0;d<c;d++)b[d].Xg=!1;a.Ya();a.clear();a.freeze()}};E.prototype.highlight=function(a){null!==a&&a.layer.g===this&&(D.l(a,F,E,"highlight:part"),!a.Xg||1<this.qm.count)&&(this.WH(),a.Xg=!0)};
E.prototype.highlightCollection=function(a){for(var b=(new L(F)).Rc(a),c=this.qm.copy().wy(b).j;c.next();)a=c.value,a.Xg=!1;for(b=b.j;b.next();)a=b.value,a instanceof F||D.k("Diagram.highlightCollection given something that is not a Part: "+a),a.Xg=!0};
E.prototype.scroll=E.prototype.scroll=function(a,b,c){void 0===c&&(c=1);var d="up"===b||"down"===b,e=0;if("pixel"===a)e=c;else if("line"===a)e=c*(d?this.Yu:this.Xu);else if("page"===a)a=d?this.xb.height:this.xb.width,a*=this.scale,0!==a&&(e=Math.max(a-(d?this.Yu:this.Xu),0),e*=c);else{if("document"===a){e=this.cd;d=this.xb;c=D.P();"up"===b?this.position=c.m(d.x,e.y):"left"===b?this.position=c.m(e.x,d.y):"down"===b?this.position=c.m(d.x,e.bottom-d.height):"right"===b&&(this.position=c.m(e.right-d.width,
d.y));D.A(c);return}D.k("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+a)}e/=this.scale;c=this.position.copy();"up"===b?c.y=this.position.y-e:"down"===b?c.y=this.position.y+e:"left"===b?c.x=this.position.x-e:"right"===b?c.x=this.position.x+e:D.k("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+b);this.position=c};E.prototype.scrollToRect=E.prototype.dK=function(a){var b=this.xb;b.Nk(a)||(a=a.bm,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};
E.prototype.centerRect=E.prototype.VH=function(a){var b=this.xb;a=a.bm;a.x-=b.width/2;a.y-=b.height/2;this.position=a};E.prototype.transformDocToView=E.prototype.TB=function(a){var b=this.Hc;b.reset();1!==this.Bb&&b.scale(this.Bb);var c=this.qb;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return a.copy().transform(this.Hc)};
E.prototype.transformViewToDoc=E.prototype.UB=function(a){var b=this.Hc;b.reset();1!==this.Bb&&b.scale(this.Bb);var c=this.qb;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return hb(a.copy(),this.Hc)};var Nh;E.None=Nh=D.s(E,"None",0);var Xl;E.Uniform=Xl=D.s(E,"Uniform",1);var Yl;E.UniformToFill=Yl=D.s(E,"UniformToFill",2);var Zi;E.CycleAll=Zi=D.s(E,"CycleAll",10);var cj;E.CycleNotDirected=cj=D.s(E,"CycleNotDirected",11);var ej;
E.CycleNotDirectedFast=ej=D.s(E,"CycleNotDirectedFast",12);var fj;E.CycleNotUndirected=fj=D.s(E,"CycleNotUndirected",13);var $i;E.CycleDestinationTree=$i=D.s(E,"CycleDestinationTree",14);var bj;E.CycleSourceTree=bj=D.s(E,"CycleSourceTree",15);var xl;E.DocumentScroll=xl=D.s(E,"DocumentScroll",1);var Om;E.InfiniteScroll=Om=D.s(E,"InfiniteScroll",2);var zl;E.TreeParentCollapsed=zl=D.s(E,"TreeParentCollapsed",21);var cn;E.AllParentsCollapsed=cn=D.s(E,"AllParentsCollapsed",22);var dn;
E.AnyParentsCollapsed=dn=D.s(E,"AnyParentsCollapsed",23);D.defineProperty(E,{zK:"validCycle"},function(){return this.bx},function(a){var b=this.bx;b!==a&&(D.Ca(a,E,E,"validCycle"),this.bx=a,this.i("validCycle",b,a))});D.w(E,{ao:"layers"},function(){return this.bc.j});D.defineProperty(E,{Ff:"isModelReadOnly"},function(){var a=this.ve;return null===a?!1:a.mb},function(a){var b=this.ve;null!==b&&(b.mb=a)});
D.defineProperty(E,{mb:"isReadOnly"},function(){return this.aj},function(a){var b=this.aj;b!==a&&(D.h(a,"boolean",E,"isReadOnly"),this.aj=a,this.i("isReadOnly",b,a))});D.defineProperty(E,{isEnabled:"isEnabled"},function(){return this.mf},function(a){var b=this.mf;b!==a&&(D.h(a,"boolean",E,"isEnabled"),this.mf=a,this.i("isEnabled",b,a))});
D.defineProperty(E,{nA:"allowClipboard"},function(){return this.nv},function(a){var b=this.nv;b!==a&&(D.h(a,"boolean",E,"allowClipboard"),this.nv=a,this.i("allowClipboard",b,a))});D.defineProperty(E,{Kk:"allowCopy"},function(){return this.cl},function(a){var b=this.cl;b!==a&&(D.h(a,"boolean",E,"allowCopy"),this.cl=a,this.i("allowCopy",b,a))});
D.defineProperty(E,{Bn:"allowDelete"},function(){return this.dl},function(a){var b=this.dl;b!==a&&(D.h(a,"boolean",E,"allowDelete"),this.dl=a,this.i("allowDelete",b,a))});D.defineProperty(E,{Ut:"allowDragOut"},function(){return this.ov},function(a){var b=this.ov;b!==a&&(D.h(a,"boolean",E,"allowDragOut"),this.ov=a,this.i("allowDragOut",b,a))});
D.defineProperty(E,{EE:"allowDrop"},function(){return this.pv},function(a){var b=this.pv;b!==a&&(D.h(a,"boolean",E,"allowDrop"),this.pv=a,this.i("allowDrop",b,a))});D.defineProperty(E,{nx:"allowTextEdit"},function(){return this.ml},function(a){var b=this.ml;b!==a&&(D.h(a,"boolean",E,"allowTextEdit"),this.ml=a,this.i("allowTextEdit",b,a))});
D.defineProperty(E,{kx:"allowGroup"},function(){return this.el},function(a){var b=this.el;b!==a&&(D.h(a,"boolean",E,"allowGroup"),this.el=a,this.i("allowGroup",b,a))});D.defineProperty(E,{ox:"allowUngroup"},function(){return this.nl},function(a){var b=this.nl;b!==a&&(D.h(a,"boolean",E,"allowUngroup"),this.nl=a,this.i("allowUngroup",b,a))});
D.defineProperty(E,{Zp:"allowInsert"},function(){return this.rv},function(a){var b=this.rv;b!==a&&(D.h(a,"boolean",E,"allowInsert"),this.rv=a,this.i("allowInsert",b,a))});D.defineProperty(E,{Vt:"allowLink"},function(){return this.fl},function(a){var b=this.fl;b!==a&&(D.h(a,"boolean",E,"allowLink"),this.fl=a,this.i("allowLink",b,a))});
D.defineProperty(E,{Cn:"allowRelink"},function(){return this.hl},function(a){var b=this.hl;b!==a&&(D.h(a,"boolean",E,"allowRelink"),this.hl=a,this.i("allowRelink",b,a))});D.defineProperty(E,{Yl:"allowMove"},function(){return this.gl},function(a){var b=this.gl;b!==a&&(D.h(a,"boolean",E,"allowMove"),this.gl=a,this.i("allowMove",b,a))});
D.defineProperty(E,{lx:"allowReshape"},function(){return this.il},function(a){var b=this.il;b!==a&&(D.h(a,"boolean",E,"allowReshape"),this.il=a,this.i("allowReshape",b,a))});D.defineProperty(E,{Wt:"allowResize"},function(){return this.jl},function(a){var b=this.jl;b!==a&&(D.h(a,"boolean",E,"allowResize"),this.jl=a,this.i("allowResize",b,a))});
D.defineProperty(E,{mx:"allowRotate"},function(){return this.kl},function(a){var b=this.kl;b!==a&&(D.h(a,"boolean",E,"allowRotate"),this.kl=a,this.i("allowRotate",b,a))});D.defineProperty(E,{Bf:"allowSelect"},function(){return this.ll},function(a){var b=this.ll;b!==a&&(D.h(a,"boolean",E,"allowSelect"),this.ll=a,this.i("allowSelect",b,a))});
D.defineProperty(E,{FE:"allowUndo"},function(){return this.sv},function(a){var b=this.sv;b!==a&&(D.h(a,"boolean",E,"allowUndo"),this.sv=a,this.i("allowUndo",b,a))});D.defineProperty(E,{px:"allowZoom"},function(){return this.uv},function(a){var b=this.uv;b!==a&&(D.h(a,"boolean",E,"allowZoom"),this.uv=a,this.i("allowZoom",b,a))});
D.defineProperty(E,{UA:"hasVerticalScrollbar"},function(){return this.Yv},function(a){var b=this.Yv;b!==a&&(D.h(a,"boolean",E,"hasVerticalScrollbar"),this.Yv=a,cm(this),this.qa(),this.i("hasVerticalScrollbar",b,a),Tl(this,!1))});D.defineProperty(E,{TA:"hasHorizontalScrollbar"},function(){return this.Xv},function(a){var b=this.Xv;b!==a&&(D.h(a,"boolean",E,"hasHorizontalScrollbar"),this.Xv=a,cm(this),this.qa(),this.i("hasHorizontalScrollbar",b,a),Tl(this,!1))});
D.defineProperty(E,{ye:"allowHorizontalScroll"},function(){return this.qv},function(a){var b=this.qv;b!==a&&(D.h(a,"boolean",E,"allowHorizontalScroll"),this.qv=a,this.i("allowHorizontalScroll",b,a),Tl(this,!1))});D.defineProperty(E,{ze:"allowVerticalScroll"},function(){return this.tv},function(a){var b=this.tv;b!==a&&(D.h(a,"boolean",E,"allowVerticalScroll"),this.tv=a,this.i("allowVerticalScroll",b,a),Tl(this,!1))});
D.defineProperty(E,{Xu:"scrollHorizontalLineChange"},function(){return this.Lw},function(a){var b=this.Lw;b!==a&&(D.h(a,"number",E,"scrollHorizontalLineChange"),0>a&&D.ua(a,">= 0",E,"scrollHorizontalLineChange"),this.Lw=a,this.i("scrollHorizontalLineChange",b,a))});
D.defineProperty(E,{Yu:"scrollVerticalLineChange"},function(){return this.Pw},function(a){var b=this.Pw;b!==a&&(D.h(a,"number",E,"scrollVerticalLineChange"),0>a&&D.ua(a,">= 0",E,"scrollVerticalLineChange"),this.Pw=a,this.i("scrollVerticalLineChange",b,a))});D.defineProperty(E,{U:"lastInput"},function(){return this.Tb},function(a){v&&D.l(a,Zf,E,"lastInput");this.Tb=a});D.defineProperty(E,{Kc:"firstInput"},function(){return this.Zi},function(a){v&&D.l(a,Zf,E,"firstInput");this.Zi=a});
D.defineProperty(E,{jc:"currentCursor"},function(){return this.Fv},function(a){""===a&&(a=this.Gr);var b=this.Fv;if(b!==a){D.h(a,"string",E,"currentCursor");var c=this.Lb,d=this.Sb;null!==c&&(this.Fv=a,c.style.cursor=a,d.style.cursor=a,c.style.cursor===b&&(c.style.cursor="-webkit-"+a,d.style.cursor="-webkit-"+a,c.style.cursor===b&&(c.style.cursor="-moz-"+a,d.style.cursor="-moz-"+a,c.style.cursor===b&&(c.style.cursor=a,d.style.cursor=a))))}});
D.defineProperty(E,{kL:"defaultCursor"},function(){return this.Gr},function(a){""===a&&(a="auto");var b=this.Gr;b!==a&&(D.h(a,"string",E,"defaultCursor"),this.Gr=a,this.i("defaultCursor",b,a))});D.defineProperty(E,{click:"click"},function(){return this.Pi},function(a){var b=this.Pi;b!==a&&(null!==a&&D.h(a,"function",E,"click"),this.Pi=a,this.i("click",b,a))});
D.defineProperty(E,{du:"doubleClick"},function(){return this.Wi},function(a){var b=this.Wi;b!==a&&(null!==a&&D.h(a,"function",E,"doubleClick"),this.Wi=a,this.i("doubleClick",b,a))});D.defineProperty(E,{uA:"contextClick"},function(){return this.Ri},function(a){var b=this.Ri;b!==a&&(null!==a&&D.h(a,"function",E,"contextClick"),this.Ri=a,this.i("contextClick",b,a))});
D.defineProperty(E,{kB:"mouseOver"},function(){return this.lj},function(a){var b=this.lj;b!==a&&(null!==a&&D.h(a,"function",E,"mouseOver"),this.lj=a,this.i("mouseOver",b,a))});D.defineProperty(E,{jB:"mouseHover"},function(){return this.kj},function(a){var b=this.kj;b!==a&&(null!==a&&D.h(a,"function",E,"mouseHover"),this.kj=a,this.i("mouseHover",b,a))});
D.defineProperty(E,{iB:"mouseHold"},function(){return this.jj},function(a){var b=this.jj;b!==a&&(null!==a&&D.h(a,"function",E,"mouseHold"),this.jj=a,this.i("mouseHold",b,a))});D.defineProperty(E,{KJ:"mouseDragOver"},function(){return this.ww},function(a){var b=this.ww;b!==a&&(null!==a&&D.h(a,"function",E,"mouseDragOver"),this.ww=a,this.i("mouseDragOver",b,a))});
D.defineProperty(E,{hB:"mouseDrop"},function(){return this.ij},function(a){var b=this.ij;b!==a&&(null!==a&&D.h(a,"function",E,"mouseDrop"),this.ij=a,this.i("mouseDrop",b,a))});D.defineProperty(E,{PB:"toolTip"},function(){return this.uj},function(a){var b=this.uj;b!==a&&(!v||null===a||a instanceof da||a instanceof ak||D.k("Diagram.toolTip must be an Adornment or HTMLInfo."),this.uj=a,this.i("toolTip",b,a))});
D.defineProperty(E,{contextMenu:"contextMenu"},function(){return this.Si},function(a){var b=this.Si;b!==a&&(!v||a instanceof da||a instanceof ak||D.k("Diagram.contextMenu must be an Adornment or HTMLInfo."),this.Si=a,this.i("contextMenu",b,a))});D.defineProperty(E,{wb:"commandHandler"},function(){return this.gz},function(a){var b=this.gz;b!==a&&(D.l(a,oa,E,"commandHandler"),null!==a.g&&D.k("Cannot share CommandHandlers between Diagrams: "+a.toString()),null!==b&&b.Xc(null),this.gz=a,a.Xc(this))});
D.defineProperty(E,{kb:"toolManager"},function(){return this.fA},function(a){var b=this.fA;b!==a&&(D.l(a,Hh,E,"toolManager"),null!==a.g&&D.k("Cannot share ToolManagers between Diagrams: "+a.toString()),null!==b&&b.Xc(null),this.fA=a,a.Xc(this))});D.defineProperty(E,{cu:"defaultTool"},function(){return this.mz},function(a){var b=this.mz;b!==a&&(D.l(a,Sg,E,"defaultTool"),this.mz=a,this.gb===b&&(this.gb=a))});
D.defineProperty(E,{gb:"currentTool"},function(){return this.jz},function(a){var b=this.jz;null!==b&&(b.wa&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.cu);null!==a&&(D.l(a,Sg,E,"currentTool"),this.jz=a,a.Xc(this),a.doStart())});D.w(E,{selection:"selection"},function(){return this.Sw});
D.defineProperty(E,{BJ:"maxSelectionCount"},function(){return this.rw},function(a){var b=this.rw;if(b!==a)if(D.h(a,"number",E,"maxSelectionCount"),0<=a&&!isNaN(a)){if(this.rw=a,this.i("maxSelectionCount",b,a),!this.ra.nb&&(a=this.selection.count-a,0<a)){this.Ja("ChangingSelection");for(var b=this.selection.lc(),c=0;c<a;c++)b[c].hb=!1;this.Ja("ChangedSelection")}}else D.ua(a,">= 0",E,"maxSelectionCount")});
D.defineProperty(E,{MJ:"nodeSelectionAdornmentTemplate"},function(){return this.xw},function(a){var b=this.xw;b!==a&&(D.l(a,da,E,"nodeSelectionAdornmentTemplate"),this.xw=a,this.i("nodeSelectionAdornmentTemplate",b,a))});D.defineProperty(E,{TI:"groupSelectionAdornmentTemplate"},function(){return this.Vv},function(a){var b=this.Vv;b!==a&&(D.l(a,da,E,"groupSelectionAdornmentTemplate"),this.Vv=a,this.i("groupSelectionAdornmentTemplate",b,a))});
D.defineProperty(E,{vJ:"linkSelectionAdornmentTemplate"},function(){return this.mw},function(a){var b=this.mw;b!==a&&(D.l(a,da,E,"linkSelectionAdornmentTemplate"),this.mw=a,this.i("linkSelectionAdornmentTemplate",b,a))});D.w(E,{qm:"highlighteds"},function(){return this.Zv});
D.defineProperty(E,{Fi:"isModified"},function(){var a=this.ra;return a.isEnabled?null!==a.Cj?!0:this.fw&&this.sh!==a.Hj:this.fw},function(a){if(this.fw!==a){D.h(a,"boolean",E,"isModified");this.fw=a;var b=this.ra;!a&&b.isEnabled&&(this.sh=b.Hj);a||en(this)}});function en(a){var b=a.Fi;a.uE!==b&&(a.uE=b,a.Ja("Modified"))}
D.defineProperty(E,{ga:"model"},function(){return this.ve},function(a){var b=this.ve;if(b!==a){D.l(a,M,E,"model");this.gb.doCancel();null!==b&&b.ra!==a.ra&&b.ra.RF&&D.k("Do not replace a Diagram.model while a transaction is in progress.");this.Xa.Ii();this.tx();this.th=!1;this.cp=!0;this.sh=-2;this.Yf=!1;var c=this.ge;this.ge=!0;this.Xa.oo("Model");null!==b&&(null!==this.wh&&this.wh.each(function(a){b.Su(a)}),b.Su(this.AD),b instanceof Y&&fn(this,b.Yg),fn(this,b.mg));this.ve=a;a.An(this.zD);gn(this,
a.mg);a instanceof Y&&hn(this,a.Yg);a.Su(this.zD);a.An(this.AD);null!==this.wh&&this.wh.each(function(b){a.An(b)});this.ge=c;this.Zc||this.qa();null!==b&&(a.ra.isEnabled=b.ra.isEnabled)}});D.defineProperty(E,{ab:null},function(){return this.rD},function(a){this.rD=a});D.w(E,{hy:null},function(){return this.tH});
function Bl(a,b){if(b.ga===a.ga){var c=b.Ic,d=b.propertyName;if(c===dg&&"S"===d[0])if("StartingFirstTransaction"===d)c=a.kb,c.lf.each(function(b){b.Xc(a)}),c.ig.each(function(b){b.Xc(a)}),c.jg.each(function(b){b.Xc(a)}),a.ge||a.th||(a.Mv=!0,a.cp&&(a.Yf=!0));else if("StartingUndo"===d||"StartingRedo"===d){var e=a.Xa;e.sf&&!a.Eb&&e.Ii();a.Ja("ChangingSelection")}else"StartedTransaction"===d&&(e=a.Xa,e.sf&&!a.Eb&&e.Ii());else if(a.ab){a.ab=!1;try{var g=b.wf;if(""!==g)if(c===cg){if("linkFromKey"===g){var h=
b.object,k=a.bg(h);if(null!==k){var l=b.newValue,m=a.Qe(l);k.aa=m}}else if("linkToKey"===g)h=b.object,k=a.bg(h),null!==k&&(l=b.newValue,m=a.Qe(l),k.da=m);else if("linkFromPortId"===g){if(h=b.object,k=a.bg(h),null!==k){var n=b.newValue;"string"===typeof n&&(k.cg=n)}}else if("linkToPortId"===g)h=b.object,k=a.bg(h),null!==k&&(n=b.newValue,"string"===typeof n&&(k.jh=n));else if("nodeGroupKey"===g){var h=b.object,p=a.Nh(h);if(null!==p){var q=b.newValue;if(void 0!==q){var r=a.Qe(q);p.Pa=r instanceof I?
r:null}else p.Pa=null}}else if("linkLabelKeys"===g){if(h=b.object,k=a.bg(h),null!==k){var s=b.oldValue,u=b.newValue;if(D.isArray(s))for(var t=D.cb(s),y=0;y<t;y++){var w=D.La(s,y),m=a.Qe(w);null!==m&&(m.zc=null)}if(D.isArray(u))for(t=D.cb(u),y=0;y<t;y++)w=D.La(u,y),m=a.Qe(w),null!==m&&(m.zc=k)}}else if("nodeParentKey"===g){var C=b.object,A=a.Qe(b.newValue),N=a.Ix(C);if(null!==N){var H=N.Pn();null!==H?null===A?a.remove(H):a.$d?H.aa=A:H.da=A:jn(a,A,N)}}else if("parentLinkCategory"===g){var C=b.object,
N=a.Ix(C),W=b.newValue;null!==N&&"string"===typeof W&&(H=N.Pn(),null!==H&&(H.Dd=W))}else if("nodeCategory"===g){var h=b.object,fa=a.Nh(h),W=b.newValue;null!==fa&&"string"===typeof W&&(fa.Dd=W)}else if("linkCategory"===g){var h=b.object,S=a.bg(h),W=b.newValue;null!==S&&"string"===typeof W&&(S.Dd=W)}else if("nodeDataArray"===g){var ba=b.oldValue;fn(a,ba);var ia=b.newValue;gn(a,ia)}else"linkDataArray"===g&&(ba=b.oldValue,fn(a,ba),ia=b.newValue,hn(a,ia));a.Fi=!0}else c===mg?(ia=b.newValue,"nodeDataArray"===
g&&D.Ta(ia)?kn(a,ia):"linkDataArray"===g&&D.Ta(ia)?ln(a,ia):"linkLabelKeys"===g&&Wg(ia)&&(k=a.bg(b.object),m=a.Qe(ia),null!==k&&null!==m&&(m.zc=k)),a.Fi=!0):c===ng?(ba=b.oldValue,"nodeDataArray"===g&&D.Ta(ba)?mn(a,ba):"linkDataArray"===g&&D.Ta(ba)?mn(a,ba):"linkLabelKeys"===g&&Wg(ba)&&(m=a.Qe(ba),null!==m&&(m.zc=null)),a.Fi=!0):c===dg&&("SourceChanged"===g?null!==b.object?Al(a,b.object,b.propertyName):(a.yK(),a.hH()):"ModelDisplaced"===g&&a.xm());else if(c===cg){var U=b.propertyName,h=b.object;if(h===
a.ga){if("nodeKeyProperty"===U||"nodeCategoryProperty"===U||"linkFromKeyProperty"===U||"linkToKeyProperty"===U||"linkFromPortIdProperty"===U||"linkToPortIdProperty"===U||"linkLabelKeysProperty"===U||"nodeIsGroupProperty"===U||"nodeGroupKeyProperty"===U||"nodeParentKeyProperty"===U||"linkCategoryProperty"===U)a.ra.nb||a.xm()}else Al(a,h,U);a.Fi=!0}else if(c===mg||c===ng)nn(a,b),a.Fi=!0;else if(c===dg){if("FinishedUndo"===d||"FinishedRedo"===d)a.ra.bj=!0,a.Ja("ChangedSelection"),Li(a),a.ra.bj=!1;e=
a.Xa;"RolledBackTransaction"===d&&e.Ii();a.Mv=!0;a.gg();0===a.ra.Vh&&$k(e);"CommittedTransaction"===d&&a.ra.Kz&&(a.sh=Math.min(a.sh,a.ra.Hj-1));var Ua=b.VF;Ua&&(en(a),a.hy.clear());!a.Qz&&Ua&&(a.Qz=!0,D.setTimeout(function(){a.gb.standardMouseOver();a.Qz=!1},10))}}finally{a.ab=!0}}}}
function Al(a,b,c){if("string"===typeof c){var d=a.Nh(b);if(null!==d)d.Nb(c),a.ga instanceof wg&&(d=a.bg(b),null!==d&&d.Nb(c));else{for(var d=null,e=a.Wm.j;e.next();){for(var g=e.value,h=0;h<g.length;h++){var k=g[h].DI(b);null!==k&&(null===d&&(d=D.tb()),d.push(k))}if(null!==d)break}if(null!==d){for(e=0;e<d.length;e++)d[e].Nb(c);D.Aa(d)}}b===a.ga.Yk&&a.hH(c)}}D.defineProperty(E,{Ue:"skipsModelSourceBindings"},function(){return this.WD},function(a){this.WD=a});
D.defineProperty(E,{cv:null},function(){return this.aA},function(a){this.aA=a});function nn(a,b){var c=b.Ic===mg,d=c?b.Qj:b.Sj,e=c?b.newValue:b.oldValue,g=a.Wm.oa(b.object);if(Array.isArray(g))for(var h=0;h<g.length;h++){var k=g[h];if(c)on(k,e,d);else{var l=d;if(!(0>l)){var m=l;pn(k)&&m++;k.rf(m);qn(k,m,l)}}}}function Tm(a,b){var c=b.cj;if(D.isArray(c)){var d=a.Wm.oa(c);if(null===d)d=[],d.push(b),a.Wm.add(c,d);else{for(c=0;c<d.length;c++)if(d[c]===b)return;d.push(b)}}}
function Xm(a,b){var c=b.cj;if(D.isArray(c)){var d=a.Wm.oa(c);if(null!==d)for(var e=0;e<d.length;e++)if(d[e]===b){d.splice(e,1);0===d.length&&a.Wm.remove(c);break}}}function Sm(a,b){for(var c=b.xa.o,d=c.length,e=0;e<d;e++){var g=c[e];g instanceof Cl&&rn(a,g)}}
function rn(a,b){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){var d=b.Ze;null!==d&&(d.fp instanceof Event&&null!==b.$e&&b.$e(b,d.fp),!0===d.ew&&(null!==b.wi&&b.wi(b,d.Wz),null!==b.g&&b.g.Tz.add(b)));c=c.src;d=a.Ep.oa(c);if(null===d)d=[],d.push(b),a.Ep.add(c,d);else{for(c=0;c<d.length;c++)if(d[c]===b)return;d.push(b)}}}function Wm(a,b){for(var c=b.xa.o,d=c.length,e=0;e<d;e++){var g=c[e];g instanceof Cl&&sn(a,g)}}
function sn(a,b){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){var c=c.src,d=a.Ep.oa(c);if(null!==d)for(var e=0;e<d.length;e++)if(d[e]===b){d.splice(e,1);0===d.length&&a.Ep.remove(c);break}}}
E.prototype.rebuildParts=E.prototype.xm=function(){for(var a=this.oB.j;a.next();){var b=a.value,c=a.key;(!b.oe()||b instanceof I)&&D.k('Invalid node template in Diagram.nodeTemplateMap: template for "'+c+'" must be a Node or a simple Part, not a Group or Link: '+b)}for(a=this.SA.j;a.next();)b=a.value,c=a.key,b instanceof I||D.k('Invalid group template in Diagram.groupTemplateMap: template for "'+c+'" must be a Group, not a normal Node or Link: '+b);for(a=this.bB.j;a.next();)b=a.value,c=a.key,b instanceof
J||D.k('Invalid link template in Diagram.linkTemplateMap: template for "'+c+'" must be a Link, not a normal Node or simple Part: '+b);a=D.tb();for(b=this.selection.j;b.next();)(c=b.value.data)&&a.push(c);for(var b=D.tb(),d=this.qm.j;d.next();)(c=d.value.data)&&b.push(c);c=D.tb();for(d=this.ng.j;d.next();){var e=d.value;null!==e.data&&(c.push(e.data),c.push(e.location))}for(d=this.links.j;d.next();)e=d.value,null!==e.data&&(c.push(e.data),c.push(e.location));for(d=this.Gi.j;d.next();)e=d.value,null!==
e.data&&(c.push(e.data),c.push(e.location));d=this.ga;d instanceof Y&&fn(this,d.Yg);fn(this,d.mg);gn(this,d.mg);d instanceof Y&&hn(this,d.Yg);for(d=0;d<a.length;d++)e=this.Nh(a[d]),null!==e&&(e.hb=!0);for(d=0;d<b.length;d++)e=this.Nh(b[d]),null!==e&&(e.Xg=!0);for(d=0;d<c.length;d+=2)e=this.Nh(c[d]),null!==e&&(e.location=c[d+1]);D.Aa(a);D.Aa(b);D.Aa(c)};
function gn(a,b){if(null!==b){for(var c=a.ga,d=c instanceof Y,e=D.cb(b),g=0;g<e;g++){var h=D.La(b,g);c.ie(h)?kn(a,h,!1):d&&ln(a,h)}if(d||c instanceof wg){for(g=0;g<e;g++)h=D.La(b,g),c.ie(h)&&tn(a,h);if(d)for(c=a.links;c.next();)un(c.value)}vn(a,!1)}}function kn(a,b,c){if(void 0!==b&&null!==b&&!a.ra.nb&&!a.Ti.contains(b)){void 0===c&&(c=!0);var d=a.OA(b),e=wn(a,b,d);if(null!==e&&(Kh(e),e=e.copy(),null!==e)){var g=a.Ue;a.Ue=!0;e.Ni=d;e.Nd=b;a.add(e);e.Nd=null;e.data=b;c&&tn(a,b);a.Ue=g}}}
E.prototype.OA=function(a){return this.ga.OA(a)};var xn=!1,yn=!1;function wn(a,b,c){var d=!1,e=a.ga;e instanceof Y&&(d=e.ZA(b));d?(b=a.SA.oa(c),null===b&&(b=a.SA.oa(""),null===b&&(yn||(yn=!0,D.trace('No Group template found for category "'+c+'"'),D.trace("  Using default group template")),b=a.IC))):(b=a.oB.oa(c),null===b&&(b=a.oB.oa(""),null===b&&(xn||(xn=!0,D.trace('No Node template found for category "'+c+'"'),D.trace("  Using default node template")),b=a.KC)));return b}
function tn(a,b){var c=a.ga;if(c instanceof Y||c instanceof wg){var d=c.Cb(b);if(void 0!==d){var e=Zg(c,d),g=a.Nh(b);if(null!==e&&null!==g){for(e=e.j;e.next();){var h=e.value;if(c instanceof Y){var k=c;if(k.ie(h)){if(g instanceof I&&k.Sn(h)===d){var l=g,h=a.Nh(h);null!==h&&(h.Pa=l)}}else{var m=a.bg(h);if(null!==m&&g instanceof G&&(l=g,k.om(h)===d&&(m.aa=l),k.pm(h)===d&&(m.da=l),h=k.Sk(h),D.isArray(h)))for(k=0;k<D.cb(h);k++)if(D.La(h,k)===d){l.zc=m;break}}}else c instanceof wg&&(m=c,m.ie(h)&&g instanceof
G&&(l=g,m.Un(h)===d&&(h=a.Ix(h),jn(a,l,h))))}ah(c,d)}c instanceof Y?(c=c.Sn(b),void 0!==c&&(c=a.Qe(c),c instanceof I&&(g.Pa=c))):c instanceof wg&&(c=c.Un(b),void 0!==c&&g instanceof G&&(l=g,g=a.Qe(c),jn(a,g,l)))}}}
function jn(a,b,c){if(null!==b&&null!==c){var d=a.kb.bG,e=b,g=c;if(a.$d)for(b=g.Gd;b.next();){if(b.value.da===g)return}else for(e=c,g=b,b=e.Gd;b.next();)if(b.value.aa===e)return;if(null===d||!aj(d,e,g,null,!0))if(d=a.Lx(c.data),b=zn(a,d),null!==b&&(Kh(b),b=b.copy(),null!==b)){var h=a.Ue;a.Ue=!0;b.Ni=d;b.Nd=c.data;b.aa=e;b.da=g;a.add(b);b.Nd=null;b.data=c.data;a.Ue=h}}}function hn(a,b){if(null!==b){for(var c=D.cb(b),d=0;d<c;d++){var e=D.La(b,d);ln(a,e)}vn(a,!1)}}
function ln(a,b){if(void 0!==b&&null!==b&&!a.ra.nb&&!a.ck.contains(b)){var c=a.Lx(b),d=zn(a,c);if(null!==d&&(Kh(d),d=d.copy(),null!==d)){var e=a.Ue;a.Ue=!0;d.Ni=c;d.Nd=b;var c=a.ga,g=c.KI(b);""!==g&&(d.cg=g);g=c.om(b);void 0!==g&&(g=a.Qe(g),g instanceof G&&(d.aa=g));g=c.OI(b);""!==g&&(d.jh=g);g=c.pm(b);void 0!==g&&(g=a.Qe(g),g instanceof G&&(d.da=g));c=c.Sk(b);if(D.isArray(c))for(var g=D.cb(c),h=0;h<g;h++){var k=D.La(c,h),k=a.Qe(k);null!==k&&(k.zc=d)}a.add(d);d.Nd=null;d.data=b;a.Ue=e}}}
E.prototype.Lx=function(a){var b=this.ga,c="";b instanceof Y?c=b.Lx(a):b instanceof wg&&(c=b.MI(a));return c};var An=!1;function zn(a,b){var c=a.bB.oa(b);null===c&&(c=a.bB.oa(""),null===c&&(An||(An=!0,D.trace('No Link template found for category "'+b+'"'),D.trace("  Using default link template")),c=a.JC));return c}function fn(a,b){for(var c=D.cb(b),d=0;d<c;d++){var e=D.La(b,d);mn(a,e)}}
function mn(a,b){if(void 0!==b&&null!==b){var c=a.Nh(b);if(null!==c){Ym(a,c,!1);var d=a.ga;if(d instanceof Y&&c instanceof G){var e=d.Cb(c.data);if(void 0!==e){for(var g=c.Gd;g.next();)$g(d,e,g.value.data);c.tf&&(g=c.zc,null!==g&&$g(d,e,g.data));if(c instanceof I)for(c=c.Mc;c.next();)g=c.value.data,d.ie(g)&&$g(d,e,g)}}else if(d instanceof wg&&c instanceof G){g=a.bg(c.data);if(null!==g){g.hb=!1;g.Xg=!1;var h=g.layer;if(null!==h){var k=h.rf(-1,g,!1);0<=k&&a.hd(ng,"parts",h,g,null,k,null);k=g.by;null!==
k&&k(g,h,null)}}g=a.$d;for(c=c.Gd;c.next();)h=c.value,h=(g?h.da:h.aa).data,d.ie(h)&&$g(d,e,h)}}}}E.prototype.findPartForKey=E.prototype.EI=function(a){if(null===a||void 0===a)return null;var b=this.ga.Fe(a);return null!==b?this.Ti.oa(b):this.ga instanceof Y&&(b=this.ga.oq(a),null!==b)?this.ck.oa(b):null};E.prototype.findNodeForKey=E.prototype.Qe=function(a){if(null===a||void 0===a)return null;a=this.ga.Fe(a);if(null===a)return null;a=this.Ti.oa(a);return a instanceof G?a:null};
E.prototype.findPartForData=E.prototype.Nh=function(a){if(null===a)return null;var b=this.Ti.oa(a);return null!==b?b:b=this.ck.oa(a)};E.prototype.findNodeForData=E.prototype.Ix=function(a){if(null===a)return null;a=this.Ti.oa(a);return a instanceof G?a:null};E.prototype.findLinkForData=E.prototype.bg=function(a){return null===a?null:this.ck.oa(a)};
E.prototype.findNodesByExample=function(a){for(var b=new L(G),c=this.Cp.j;c.next();){var d=c.value,e=d.data;if(null!==e)for(var g=0;g<arguments.length;g++){var h=arguments[g];if(D.Ta(h)&&Bn(this,e,h)){b.add(d);break}}}return b.j};E.prototype.findLinksByExample=function(a){for(var b=new L(J),c=this.wp.j;c.next();){var d=c.value,e=d.data;if(null!==e)for(var g=0;g<arguments.length;g++){var h=arguments[g];if(D.Ta(h)&&Bn(this,e,h)){b.add(d);break}}}return b.j};
function Bn(a,b,c){for(var d in c){var e=b[d],g=c[d];if(D.isArray(g)){if(!D.isArray(e)||e.length<g.length)return!1;for(var h=0;h<e.length;h++){var k=e[h],l=g[h];if(void 0!==l&&!Cn(a,k,l))return!1}}else if(!Cn(a,e,g))return!1}return!0}function Cn(a,b,c){if("function"===typeof c){if(!c(b))return!1}else if(c instanceof RegExp){if(!b||!c.test(b.toString()))return!1}else if(D.Ta(b)&&D.Ta(c)){if(!Bn(a,b,c))return!1}else if(b!==c)return!1;return!0}
D.defineProperty(E,{$L:"nodeTemplate"},function(){return this.mj.oa("")},function(a){var b=this.mj.oa("");b!==a&&(D.l(a,F,E,"nodeTemplate"),this.mj.add("",a),this.i("nodeTemplate",b,a),this.ra.nb||this.xm())});D.defineProperty(E,{oB:"nodeTemplateMap"},function(){return this.mj},function(a){var b=this.mj;b!==a&&(D.l(a,ma,E,"nodeTemplateMap"),this.mj=a,this.i("nodeTemplateMap",b,a),this.ra.nb||this.xm())});
D.defineProperty(E,{CL:"groupTemplate"},function(){return this.ul.oa("")},function(a){var b=this.ul.oa("");b!==a&&(D.l(a,I,E,"groupTemplate"),this.ul.add("",a),this.i("groupTemplate",b,a),this.ra.nb||this.xm())});D.defineProperty(E,{SA:"groupTemplateMap"},function(){return this.ul},function(a){var b=this.ul;b!==a&&(D.l(a,ma,E,"groupTemplateMap"),this.ul=a,this.i("groupTemplateMap",b,a),this.ra.nb||this.xm())});
D.defineProperty(E,{NL:"linkTemplate"},function(){return this.rk.oa("")},function(a){var b=this.rk.oa("");b!==a&&(D.l(a,J,E,"linkTemplate"),this.rk.add("",a),this.i("linkTemplate",b,a),this.ra.nb||this.xm())});D.defineProperty(E,{bB:"linkTemplateMap"},function(){return this.rk},function(a){var b=this.rk;b!==a&&(D.l(a,ma,E,"linkTemplateMap"),this.rk=a,this.i("linkTemplateMap",b,a),this.ra.nb||this.xm())});D.defineProperty(E,{iJ:null},function(){return this.Um},function(a){this.Um=a});
D.defineProperty(E,{jf:"isMouseCaptured"},function(){return this.oD},function(a){var b=this.Lb;null!==b&&(a?(this.U.bubbles=!1,b.removeEventListener("mousemove",this.jo,!1),b.removeEventListener("mousedown",this.io,!1),b.removeEventListener("mouseup",this.lo,!1),b.removeEventListener("mousewheel",this.Zg,!1),b.removeEventListener("DOMMouseScroll",this.Zg,!1),b.removeEventListener("mouseout",this.ko,!1),window.addEventListener("mousemove",this.jo,!0),window.addEventListener("mousedown",this.io,!0),
window.addEventListener("mouseup",this.lo,!0),window.addEventListener("mousewheel",this.Zg,!0),window.addEventListener("DOMMouseScroll",this.Zg,!0),window.addEventListener("mouseout",this.ko,!0),window.addEventListener("selectstart",this.preventDefault,!1)):(window.removeEventListener("mousemove",this.jo,!0),window.removeEventListener("mousedown",this.io,!0),window.removeEventListener("mouseup",this.lo,!0),window.removeEventListener("mousewheel",this.Zg,!0),window.removeEventListener("DOMMouseScroll",
this.Zg,!0),window.removeEventListener("mouseout",this.ko,!0),window.removeEventListener("selectstart",this.preventDefault,!1),b.addEventListener("mousemove",this.jo,!1),b.addEventListener("mousedown",this.io,!1),b.addEventListener("mouseup",this.lo,!1),b.addEventListener("mousewheel",this.Zg,!1),b.addEventListener("DOMMouseScroll",this.Zg,!1),b.addEventListener("mouseout",this.ko,!1)),this.oD=a)});
D.defineProperty(E,{position:"position"},function(){return this.qb},function(a){var b=this.qb;if(!b.O(a)){D.l(a,O,E,"position");var c=this.xb.copy();a=a.copy();if(!this.Zc&&null!==this.Lb){this.Zc=!0;var d=this.scale;Vl(this,a,this.cd,this.Ob/d,this.Rb/d,this.No,!1);this.Zc=!1}this.qb=a.V();a=this.Xa;a.vc&&ml(a,b,this.qb);this.Zc||this.Pu(c,this.xb,this.Bb,this.Bb,!1)}});
D.defineProperty(E,{$I:"initialPosition"},function(){return this.aw},function(a){this.aw.O(a)||(D.l(a,O,E,"initialPosition"),this.aw=a.V())});D.defineProperty(E,{aJ:"initialScale"},function(){return this.bw},function(a){this.bw!==a&&(D.h(a,"number",E,"initialScale"),this.bw=a)});
D.defineProperty(E,{Vn:"grid"},function(){null===this.zd&&Ml(this);return this.zd},function(a){var b=this.zd;if(b!==a){null===b&&(Ml(this),b=this.zd);D.l(a,x,E,"grid");a.type!==Nl&&D.k("Diagram.grid must be a Panel of type Panel.Grid");var c=b.Q;null!==c&&c.remove(b);this.zd=a;a.name="GRID";null!==c&&c.add(a);fm(this);this.qa();this.i("grid",b,a)}});
D.w(E,{xb:"viewportBounds"},function(){var a=this.tE;if(null===this.Lb)return a;var b=this.qb,c=this.Bb;a.m(b.x,b.y,Math.max(this.Ob,0)/c,Math.max(this.Rb,0)/c);return a});D.defineProperty(E,{rF:"fixedBounds"},function(){return this.Tv},function(a){var b=this.Tv;b.O(a)||(D.l(a,B,E,"fixedBounds"),(v&&Infinity===a.width||-Infinity===a.width||Infinity===a.height||-Infinity===a.height)&&D.k("fixedBounds width/height must not be Infinity"),this.Tv=a=a.V(),this.yc(),this.i("fixedBounds",b,a))});
D.defineProperty(E,{IG:"scrollMargin"},function(){return this.Mw},function(a){"number"===typeof a?a=new Hb(a):D.l(a,Hb,E,"scrollMargin");var b=this.Mw;b.O(a)||(this.Mw=a=a.V(),this.yc(),this.i("scrollMargin",b,a))});D.defineProperty(E,{yB:"scrollMode"},function(){return this.Nw},function(a){var b=this.Nw;b!==a&&(D.Ca(a,E,E,"scrollMode"),this.Nw=a,a===xl&&Tl(this,!1),this.i("scrollMode",b,a))});
D.defineProperty(E,{qG:"positionComputation"},function(){return this.Hw},function(a){var b=this.Hw;b!==a&&(null!==a&&D.h(a,"function",E,"positionComputation"),this.Hw=a,Tl(this,!1),this.i("positionComputation",b,a))});D.defineProperty(E,{HG:"scaleComputation"},function(){return this.Jw},function(a){var b=this.Jw;b!==a&&(null!==a&&D.h(a,"function",E,"scaleComputation"),this.Jw=a,an(this,this.scale,this.scale),this.i("scaleComputation",b,a))});D.w(E,{cd:"documentBounds"},function(){return this.Nv});
function Wl(a,b){a.mk=!1;var c=a.Nv;c.O(b)||(b=b.V(),a.Nv=b,Tl(a,!1),a.Ja("DocumentBoundsChanged",null,c.copy()),cm(a))}D.defineProperty(E,{scale:"scale"},function(){return this.Bb},function(a){var b=this.Bb;D.p(a,E,"scale");b!==a&&an(this,b,a)});D.defineProperty(E,{am:"autoScale"},function(){return this.Im},function(a){var b=this.Im;b!==a&&(D.Ca(a,E,E,"autoScale"),this.Im=a,this.i("autoScale",b,a),a!==Nh&&Tl(this,!1))});
D.defineProperty(E,{FL:"initialAutoScale"},function(){return this.yl},function(a){var b=this.yl;b!==a&&(D.Ca(a,E,E,"initialAutoScale"),this.yl=a,this.i("initialAutoScale",b,a))});D.defineProperty(E,{bJ:"initialViewportSpot"},function(){return this.cw},function(a){var b=this.cw;b!==a&&(D.l(a,R,E,"initialViewportSpot"),a.fd()||D.k("initialViewportSpot must be a specific Spot: "+a),this.cw=a,this.i("initialViewportSpot",b,a))});
D.defineProperty(E,{ZI:"initialDocumentSpot"},function(){return this.$v},function(a){var b=this.$v;b!==a&&(D.l(a,R,E,"initialDocumentSpot"),a.fd()||D.k("initialViewportSpot must be a specific Spot: "+a),this.$v=a,this.i("initialDocumentSpot",b,a))});D.defineProperty(E,{Qh:"minScale"},function(){return this.tw},function(a){D.p(a,E,"minScale");var b=this.tw;b!==a&&(0<a?(this.tw=a,this.i("minScale",b,a),a>this.scale&&(this.scale=a)):D.ua(a,"> 0",E,"minScale"))});
D.defineProperty(E,{Ph:"maxScale"},function(){return this.qw},function(a){D.p(a,E,"maxScale");var b=this.qw;b!==a&&(0<a?(this.qw=a,this.i("maxScale",b,a),a<this.scale&&(this.scale=a)):D.ua(a,"> 0",E,"maxScale"))});D.defineProperty(E,{Fm:"zoomPoint"},function(){return this.hx},function(a){this.hx.O(a)||(D.l(a,O,E,"zoomPoint"),this.hx=a=a.V())});
D.defineProperty(E,{RE:"contentAlignment"},function(){return this.No},function(a){var b=this.No;b.O(a)||(D.l(a,R,E,"contentAlignment"),this.No=a=a.V(),this.i("contentAlignment",b,a),Tl(this,!1))});D.defineProperty(E,{GL:"initialContentAlignment"},function(){return this.ip},function(a){var b=this.ip;b.O(a)||(D.l(a,R,E,"initialContentAlignment"),this.ip=a=a.V(),this.i("initialContentAlignment",b,a))});
D.defineProperty(E,{padding:"padding"},function(){return this.of},function(a){"number"===typeof a?a=new Hb(a):D.l(a,Hb,E,"padding");var b=this.of;b.O(a)||(this.of=a=a.V(),this.yc(),this.i("padding",b,a))});D.w(E,{ng:"nodes"},function(){return this.Cp.j});D.w(E,{links:"links"},function(){return this.wp.j});D.w(E,{Gi:"parts"},function(){return this.pb.j});
E.prototype.findTopLevelNodesAndLinks=function(){for(var a=new L(F),b=this.Cp.j;b.next();){var c=b.value;c.zq&&a.add(c)}for(b=this.wp.j;b.next();)c=b.value,c.zq&&a.add(c);return a.j};E.prototype.findTopLevelGroups=function(){return this.Rl.j};D.defineProperty(E,{Vb:"layout"},function(){return this.te},function(a){var b=this.te;b!==a&&(D.l(a,Tg,E,"layout"),null!==b&&(b.g=null,b.group=null),this.te=a,a.g=this,a.group=null,this.wv=!0,this.i("layout",b,a),this.Se())});
E.prototype.layoutDiagram=function(a){Li(this);a&&vn(this,!0);gm(this,!1)};function vn(a,b){for(var c=a.Rl.j;c.next();)Dn(a,c.value,b);null!==a.Vb&&(b?a.Vb.Hf=!1:a.Vb.N())}function Dn(a,b,c){if(null!==b){for(var d=b.en.j;d.next();)Dn(a,d.value,c);null!==b.Vb&&(c?b.Vb.Hf=!1:b.Vb.N())}}
function gm(a,b){if(!a.nz){var c=a.Vb,d=a.ab;a.ab=!0;try{var e=a.ra.Vh;0===e&&a.$b("Layout");var g=a.Xa;1!==a.ra.Vh||g.sf||g.vc||b||g.oo("Layout");for(var h=a.Rl.j;h.next();)En(a,h.value,b);c.Hf||b&&!c.UF&&0!==e||(c.doLayout(a),Li(a),c.Hf=!0)}finally{0===e&&a.Td("Layout"),a.wv=!c.Hf,a.ab=d}}}function En(a,b,c){if(null!==b){for(var d=b.en.j;d.next();)En(a,d.value,c);d=b.Vb;null===d||d.Hf||c&&!d.UF||(b.mo=!b.location.F(),d.doLayout(b),b.N(Fn),d.Hf=!0,Gm(a,b))}}
D.defineProperty(E,{$d:"isTreePathToChildren"},function(){return this.iw},function(a){var b=this.iw;if(b!==a&&(D.h(a,"boolean",E,"isTreePathToChildren"),this.iw=a,this.i("isTreePathToChildren",b,a),!this.ra.nb))for(a=this.ng;a.next();)Gn(a.value)});E.prototype.findTreeRoots=function(){for(var a=new K(G),b=this.ng;b.next();){var c=b.value;c.zq&&null===c.Pn()&&a.add(c)}return a.j};
D.defineProperty(E,{VB:"treeCollapsePolicy"},function(){return this.$w},function(a){var b=this.$w;b!==a&&(a!==zl&&a!==cn&&a!==dn&&D.k("Unknown Diagram.treeCollapsePolicy: "+a),this.$w=a,this.i("treeCollapsePolicy",b,a))});D.defineProperty(E,{Oh:null},function(){return this.gD},function(a){this.gD=a});
function yl(a){function b(a){var b=a.toLowerCase(),h=new K("function");c.add(a,h);c.add(b,h);d.add(a,a);d.add(b,a)}var c=new ma("string",K),d=new ma("string","string");b("AnimationStarting");b("AnimationFinished");b("BackgroundSingleClicked");b("BackgroundDoubleClicked");b("BackgroundContextClicked");b("ClipboardChanged");b("ClipboardPasted");b("DocumentBoundsChanged");b("ExternalObjectsDropped");b("InitialLayoutCompleted");b("LayoutCompleted");b("LinkDrawn");b("LinkRelinked");b("LinkReshaped");b("Modified");
b("ObjectSingleClicked");b("ObjectDoubleClicked");b("ObjectContextClicked");b("PartCreated");b("PartResized");b("PartRotated");b("SelectionMoved");b("SelectionCopied");b("SelectionDeleting");b("SelectionDeleted");b("SelectionGrouped");b("SelectionUngrouped");b("ChangingSelection");b("ChangedSelection");b("SubGraphCollapsed");b("SubGraphExpanded");b("TextEdited");b("TreeCollapsed");b("TreeExpanded");b("ViewportBoundsChanged");a.pz=c;a.oz=d}
function Ga(a,b){var c=a.oz.oa(b);return null!==c?c:a.oz.oa(b.toLowerCase())}function Hn(a,b){var c=a.pz.oa(b);if(null!==c)return c;c=a.pz.oa(b.toLowerCase());if(null!==c)return c;D.k("Unknown DiagramEvent name: "+b);return null}E.prototype.addDiagramListener=E.prototype.mA=function(a,b){D.h(a,"string",E,"addDiagramListener:name");D.h(b,"function",E,"addDiagramListener:listener");var c=Hn(this,a);null!==c&&c.add(b)};
E.prototype.removeDiagramListener=E.prototype.uG=function(a,b){D.h(a,"string",E,"removeDiagramListener:name");D.h(b,"function",E,"addDiagramListener:listener");var c=Hn(this,a);null!==c&&c.remove(b)};
E.prototype.raiseDiagramEvent=E.prototype.Ja=function(a,b,c){v&&D.h(a,"string",E,"raiseDiagramEvent:name");var d=Hn(this,a),e=new ag;e.g=this;a=Ga(this,a);null!==a&&(e.name=a);void 0!==b&&(e.LB=b);void 0!==c&&(e.qB=c);b=d.length;if(1===b)d=d.ea(0),d(e);else if(0!==b)for(c=d.lc(),a=0;a<b;a++)d=c[a],d(e);return e.cancel};
function Ui(a,b){var c=!1;a.xb.Nk(b)&&(c=!0);c=a.IA(b,function(a){return a.Y},function(a){return a instanceof J},!0,function(a){return a instanceof J},c);if(0!==c.count)for(c=c.j;c.next();){var d=c.value;d.Di&&d.fc()}}E.prototype.isUnoccupied=E.prototype.vm=function(a,b){void 0===b&&(b=null);return ha(this,!1,null,b).vm(a.x,a.y,a.width,a.height)};
function ha(a,b,c,d){null===a.Qd&&(a.Qd=new In);if(a.Qd.vq||a.Qd.group!==c||a.Qd.KB!==d){if(null===c){b=a.mk?Sl(a):a.cd.copy();b.eg(100,100);a.Qd.initialize(b);b=D.Nf();for(var e=a.ng;e.next();){var g=e.value,h=g.layer;null!==h&&h.visible&&!h.Tc&&Jn(a,g,d,b)}}else for(c.$.F()||c.hf(),b=c.$.copy(),b.eg(20,20),a.Qd.initialize(b),b=D.Nf(),e=c.Mc;e.next();)g=e.value,g instanceof G&&Jn(a,g,d,b);D.Mb(b);a.Qd.group=c;a.Qd.KB=d;a.Qd.vq=!1}else b&&Kn(a.Qd);return a.Qd}
function Jn(a,b,c,d){if(b!==c)if(b.isVisible()&&b.qA&&!b.tf){c=b.getAvoidableRect(d);d=a.Qd.cq;b=a.Qd.aq;for(var e=c.x+c.width,g=c.y+c.height,h=c.x;h<e;h+=d){for(var k=c.y;k<g;k+=b)Ln(a.Qd,h,k);Ln(a.Qd,h,g)}for(k=c.y;k<g;k+=b)Ln(a.Qd,e,k);Ln(a.Qd,e,g)}else if(b instanceof I)for(b=b.Mc;b.next();)e=b.value,e instanceof G&&Jn(a,e,c,d)}function Mn(a,b){null===a.Qd||a.Qd.vq||null!==b&&(!b.qA||b.tf)||(a.Qd.vq=!0)}
E.prototype.simulatedMouseMove=function(a,b,c){if(null!==Vh){var d=Vh.g;c instanceof E||(c=null);var e=Wh;c!==e&&(null!==e&&e!==d&&null!==e.kb.De&&(yi(e),Vh.Sx=!1,e.kb.De.doSimulatedDragLeave()),Wh=c,null!==c&&c!==d&&null!==c.kb.De&&(Ei(),e=c.kb.De,Ai.contains(e)||Ai.add(e),c.kb.De.doSimulatedDragEnter()));if(null===c||c===d||!c.EE||c.mb||!c.Zp)return!1;d=c.kb.De;null!==d&&(null!==a?b=c.ep(a):null===b&&(b=new O),c.Tb.ha=b,c.Tb.im=!1,c.Tb.up=!1,d.doSimulatedDragOver());return!0}return!1};
E.prototype.simulatedMouseUp=function(a,b,c,d){if(null!==Vh){null===d&&(d=b);b=Wh;var e=Vh.g;if(d!==b){if(null!==b&&b!==e&&null!==b.kb.De)return yi(b),Vh.Sx=!1,b.kb.De.doSimulatedDragLeave(),!1;Wh=d;null!==d&&null!==d.kb.De&&(Ei(),b=d.kb.De,Ai.contains(b)||Ai.add(b),d.kb.De.doSimulatedDragEnter())}if(null===d)return Vh.doCancel(),!0;if(d!==this)return null!==a&&(c=d.ep(a)),d.Tb.ha=c,d.Tb.im=!1,d.Tb.up=!0,a=d.kb.De,null!==a&&a.doSimulatedDrop(),a=Vh,null!==a&&(d=a.mayCopy(),a.Pf=d?"Copy":"Move",a.stopTool()),
!0}return!1};D.defineProperty(E,{bL:"autoScrollInterval"},function(){return this.jr},function(a){var b=this.jr;D.p(a,E,"scale");b!==a&&(this.jr=a,this.i("autoScrollInterval",b,a))});D.defineProperty(E,{KE:"autoScrollRegion"},function(){return this.yv},function(a){"number"===typeof a?a=new Hb(a):D.l(a,Hb,E,"autoScrollRegion");var b=this.yv;b.O(a)||(this.yv=a=a.V(),this.yc(),this.i("autoScrollRegion",b,a))});
E.prototype.doAutoScroll=E.prototype.CA=function(a){this.xv.assign(a);Nn(this,this.xv).Sc(this.position)?yi(this):On(this)};function On(a){-1===a.Io&&(a.Io=D.setTimeout(function(){if(-1!==a.Io){yi(a);var b=a.U.event;if(null!==b){var c=Nn(a,a.xv);c.Sc(a.position)||(a.position=c,a.U.ha=a.UB(a.xv),a.simulatedMouseMove(b,null,b.target.ba)||a.doMouseMove(),a.mk=!0,Wl(a,a.Kh()),a.Me=!0,a.gg(),On(a))}}},a.jr))}function yi(a){-1!==a.Io&&(D.clearTimeout(a.Io),a.Io=-1)}
function Nn(a,b){var c=a.position,d=a.KE;if(0>=d.top&&0>=d.left&&0>=d.right&&0>=d.bottom)return c;var e=a.xb,g=a.scale,e=D.gh(0,0,e.width*g,e.height*g),h=D.Fb(0,0);if(b.x>=e.x&&b.x<e.x+d.left){var k=Math.max(a.Xu,1),k=k|0;h.x-=k;b.x<e.x+d.left/2&&(h.x-=k);b.x<e.x+d.left/4&&(h.x-=4*k)}else b.x<=e.x+e.width&&b.x>e.x+e.width-d.right&&(k=Math.max(a.Xu,1),k|=0,h.x+=k,b.x>e.x+e.width-d.right/2&&(h.x+=k),b.x>e.x+e.width-d.right/4&&(h.x+=4*k));b.y>=e.y&&b.y<e.y+d.top?(k=Math.max(a.Yu,1),k|=0,h.y-=k,b.y<e.y+
d.top/2&&(h.y-=k),b.y<e.y+d.top/4&&(h.y-=4*k)):b.y<=e.y+e.height&&b.y>e.y+e.height-d.bottom&&(k=Math.max(a.Yu,1),k|=0,h.y+=k,b.y>e.y+e.height-d.bottom/2&&(h.y+=k),b.y>e.y+e.height-d.bottom/4&&(h.y+=4*k));h.Sc(Gd)||(c=new O(c.x+h.x/g,c.y+h.y/g));D.Mb(e);D.A(h);return c}E.prototype.makeSvg=E.prototype.makeSVG=function(a){void 0===a&&(a=new la);a.context="svg";a=Pn(this,a);return null!==a?a.Am:null};
E.prototype.makeImage=function(a){void 0===a&&(a=new la);var b=(a.document||document).createElement("img");b.src=this.wJ(a);return b};
E.prototype.makeImageData=E.prototype.wJ=function(a){void 0===a&&(a=new la);var b=Pn(this,a);if(null!==b){var c=a.returnType,c=void 0===c?"string":c.toLowerCase();switch(c){case "imagedata":return b.Ok.getImageData(0,0,b.width,b.height);case "blob":b=b.Ud;c=a.callback;if("function"!==typeof c){D.k('Error: Diagram.makeImageData called with "returnType: toBlob", but no "callback" function property defined.');break}if("function"===typeof b.toBlob)return b.toBlob(c,a.type,a.details),"toBlob";if("function"===
typeof b.msToBlob)return c(b.msToBlob()),"msToBlob";c(null);break;default:return b.toDataURL(a.type,a.details)}}return""};var Qn=!1;
function Pn(a,b){a.Xa.Ii();a.gg();if(null===a.Lb)return null;"object"!==typeof b&&D.k("properties argument must be an Object.");var c=!1,d=b.size||null,e=b.scale||null;void 0!==b.scale&&isNaN(b.scale)&&(e="NaN");var g=b.maxSize;void 0===b.maxSize&&(c=!0,g="svg"===b.context?new Ca(Infinity,Infinity):new Ca(2E3,2E3));var h=b.position||null,k=b.parts||null,l=void 0===b.padding?1:b.padding,m=b.background||null,n=b.omitTemporary;void 0===n&&(n=!0);var p=b.document||document,q=b.elementFinished||null,r=
b.showTemporary;void 0===r&&(r=!n);n=b.showGrid;void 0===n&&(n=r);null!==d&&isNaN(d.width)&&isNaN(d.height)&&(d=null);"number"===typeof l?l=new Hb(l):l instanceof Hb||(l=new Hb(0));l.left=Math.max(l.left,0);l.right=Math.max(l.right,0);l.top=Math.max(l.top,0);l.bottom=Math.max(l.bottom,0);a.Yo=!1;a.md.Be(!0);var s=new ka(null,p),u=s.Ok;if(!(d||e||k||h)){s.width=a.Ob+Math.ceil(l.left+l.right);s.height=a.Rb+Math.ceil(l.top+l.bottom);if("svg"===b.context)return u=new nd(s.Ud,p,q),Nm(a,u,l,new Ca(s.width,
s.height),a.Bb,a.qb,k,m,r,n),a.Yo=!0,u;Nm(a,u,l,new Ca(s.width,s.height),a.Bb,a.qb,k,m,r,n);a.Yo=!0;return s}var t=a.wb.zx,y=new O(0,0),w=a.cd.copy();w.oK(a.padding);if(r)for(var C=!0,C=a.bc.o,A=C.length,N=0;N<A;N++){var H=C[N];if(H.visible&&H.Tc)for(var H=H.pb.o,W=H.length,fa=0;fa<W;fa++){var S=H[fa];S.Ux&&S.isVisible()&&(S=S.$,S.F()&&w.Wh(S))}}y.x=w.x;y.y=w.y;if(null!==k){var ba,C=!0,A=k.j;for(A.reset();A.next();)S=A.value,S instanceof F&&(H=S.layer,null!==H&&!H.visible||null!==H&&!r&&H.Tc||!S.isVisible()||
(S=S.$,S.F()&&(C?(C=!1,ba=S.copy()):ba.Wh(S))));C&&(ba=new B(0,0,0,0));w.width=ba.width;w.height=ba.height;y.x=ba.x;y.y=ba.y}null!==h&&h.F()&&(y=h,e||(e=t));C=S=0;null!==l&&(S=l.left+l.right,C=l.top+l.bottom);N=A=0;null!==d&&(A=d.width,N=d.height,isFinite(A)&&(A=Math.max(0,A-S)),isFinite(N)&&(N=Math.max(0,N-C)));ba=h=0;null!==d&&null!==e?("NaN"===e&&(e=t),d.F()?(h=A,ba=N):isNaN(N)?(h=A,ba=w.height*e):(h=w.width*e,ba=N)):null!==d?d.F()?(e=Math.min(A/w.width,N/w.height),h=A,ba=N):isNaN(N)?(e=A/w.width,
h=A,ba=w.height*e):(e=N/w.height,h=w.width*e,ba=N):null!==e?"NaN"===e&&g.F()?(e=Math.min((g.width-S)/w.width,(g.height-C)/w.height),e>t?(e=t,h=w.width,ba=w.height):(h=g.width,ba=g.height)):(h=w.width*e,ba=w.height*e):(e=t,h=w.width,ba=w.height);null!==l?(h+=S,ba+=C):l=new Hb(0);null!==g&&(d=g.width,g=g.height,"svg"!==b.context&&c&&!Qn&&(h>d||ba>g)&&(D.trace("Diagram.makeImage(data): Diagram width or height is larger than the default max size. ("+Math.ceil(h)+"x"+Math.ceil(ba)+" vs 2000x2000) Consider increasing the max size."),
Qn=!0),isNaN(d)&&(d=2E3),isNaN(g)&&(g=2E3),isFinite(d)&&(h=Math.min(h,d)),isFinite(g)&&(ba=Math.min(ba,g)));s.width=Math.ceil(h);s.height=Math.ceil(ba);if("svg"===b.context)return u=new nd(s.Ud,p,q),Nm(a,u,l,new Ca(Math.ceil(h),Math.ceil(ba)),e,y,k,m,r,n),a.Yo=!0,u;Nm(a,u,l,new Ca(Math.ceil(h),Math.ceil(ba)),e,y,k,m,r,n);a.Yo=!0;return s}E.inherit=function(a,b){D.h(a,"function",E,"inherit");D.h(b,"function",E,"inherit");b.BH&&D.k("Cannot inherit from "+D.qf(b));D.Sa(a,b)};
function Hl(){this.cE=null;this.DH="63ad05bbe23a1786468a4c741b6d2";this.Xi=this.DH===this._tk?!0:null}
function Rn(a){var b="f",c=window[D.Tg("76a715b2f73f148a")][D.Tg("72ba13b5")],d=D.Tg;if(window[d("7da7")]&&window[d("7da7")][d("76a115b6ed251eaf4692")]){a.Xi=!0;var e=window[d("7da7")][d("76a115b6ed251eaf4692")],e=d(e).split(d("39e9"));if(6>e.length)return;var g=d(e[1]).split(".");if("7da71ca0"!==e[4])return;var h=d(D[d("6cae19")]).split(".");if(g[0]>h[0]||g[0]===h[0]&&g[1]>=h[1]){g=c[d("76ad18b4f73e")];for(h=c[d("73a612b6fb191d")](d("35e7"))+2;h<g;h++)b+=c[h];g=b[d("73a612b6fb191d")](d(e[2]));0>
g&&d(e[2])!==d("7da71ca0ad381e90")&&(g=b[d("73a612b6fb191d")](d("76a715b2ef3e149757")));0>g&&(g=b[d("73a612b6fb191d")](d("76a715b2ef3e149757")));a.Xi=!(0<=g&&g<b[d("73a612b6fb191d")](d("35")));if(!a.Xi)return}else return}g=c[d("76ad18b4f73e")];for(h=c[d("73a612b6fb191d")](d("35e7"))+2;h<g;h++)b+=c[h];g=b[d("73a612b6fb191d")](d(D.adym));0>g&&d(D.adym)!==d("7da71ca0ad381e90")&&(g=b[d("73a612b6fb191d")](d("76a715b2ef3e149757")));a.Xi=!(0<=g&&g<b[d("73a612b6fb191d")](d("35")));a.Xi&&(b=window.document[d("79ba13b2f7333e8846865a7d00")]("div"),
c=d("02cncncn"),"."===c[0]&&(c=c[d("69bd14a0f724128a44")](1)),b[d("79a417a0f0181a8946")]=c,window.document[d("78a712aa")]?(window.document[d("78a712aa")][d("7bb806b6ed32388c4a875b")](b),c=window[d("7dad0290ec3b0b91578e5b40007031bf")](b)[d("7dad0283f1390b81519f4645156528bf")](d("78a704b7e62456904c9b12701b6532a8")),window.document[d("78a712aa")][d("68ad1bbcf533388c4a875b")](b),c&&-1!==c.indexOf(d(D.$H))&&-1!==c.indexOf(d(D.aI))&&(a.Xi=!1)):(a.Xi=null,a.Xi=!1))}
Hl.prototype.Em=function(a){a.md.setTransform(a.od,0,0,a.od,0,0);null===this.Xi&&Rn(this);return 0<this.Xi&&this!==this.cE?!0:!1};Hl.prototype.t=function(){this.cE=null};
function Il(a,b){void 0!==b&&null!==b||D.k("Diagram setup requires an argument DIV.");null!==a.Sb&&D.k("Diagram has already completed setup.");"string"===typeof b?a.Sb=window.document.getElementById(b):b instanceof HTMLDivElement?a.Sb=b:D.k("No DIV or DIV id supplied: "+b);null===a.Sb&&D.k("Invalid DIV id; could not get element with id: "+b);void 0!==a.Sb.ba&&D.k("Invalid div id; div already has a Diagram associated with it.");"static"===window.getComputedStyle(a.Sb,null).position&&(a.Sb.style.position=
"relative");a.Sb.style["-webkit-tap-highlight-color"]="rgba(255, 255, 255, 0)";a.Sb.style["-ms-touch-action"]="none";a.Sb.innerHTML="";a.Sb.ba=a;var c=new ka(a);c.Ud.innerHTML="This text is displayed if your browser does not support the Canvas HTML element.";void 0!==c.style&&(c.style.position="absolute",c.style.top="0px",c.style.left="0px","rtl"===window.getComputedStyle(a.Sb,null).getPropertyValue("direction")&&(a.hs=!0),c.style.zIndex="2",c.style.DM="none",c.style.webkitUserSelect="none",c.style.MozUserSelect=
"none");a.Ob=a.Sb.clientWidth||1;a.Rb=a.Sb.clientHeight||1;a.Lb=c;a.md=c.Ok;var d=a.md;a.DD=(window.devicePixelRatio||1)/(d.webkitBackingStorePixelRatio||d.mozBackingStorePixelRatio||d.msBackingStorePixelRatio||d.oBackingStorePixelRatio||d.backingStorePixelRatio||1);a.od=a.computePixelRatio();Pm(a,a.Ob,a.Rb);a.Pv=d[D.Tg("7eba17a4ca3b1a8346")][D.Tg("78a118b7")](d,D.Em,4,4);a.Sb.insertBefore(c.Ud,a.Sb.firstChild);c=new ka(null);c.width=1;c.height=1;a.rz=c;a.WC=c.Ok;var c=D.createElement("div"),e=D.createElement("div");
c.style.position="absolute";c.style.overflow="auto";c.style.width=a.Ob+"px";c.style.height=a.Rb+"px";c.style.zIndex="1";e.style.position="absolute";e.style.width="1px";e.style.height="1px";a.Sb.appendChild(c);c.appendChild(e);c.onscroll=Ol;c.onmousedown=Ql;c.ontouchstart=Ql;c.ba=a;c.zH=!0;c.AH=!0;a.Ow=c;a.lt=e;a.uy=D.VE(function(){a.Bk=null;a.qa()},300,!1);a.$B=D.VE(function(){al(a)},250,!1);a.preventDefault=function(a){a.preventDefault();return!1};a.jo=function(b){if(a.isEnabled){a.Um=!0;var c=a.bd;
D.Xn&&c.Lj?(b.preventDefault(),b.simulated=!0,a.ut=b):(a.bd=a.Tb,a.Tb=c,Zl(a,a,b,c,!0),a.simulatedMouseMove(b,null,b.target.ba)||(a.doMouseMove(),a.gb.isBeyondDragSize()&&(a.Dl=0),ga(a,c,b)))}};a.io=function(b){if(a.isEnabled){a.Um=!0;var c=a.bd;if(D.Xn&&null!==a.ut)a.ut=b,b.preventDefault();else if(D.Xn&&400>b.timeStamp-a.Ym)b.preventDefault();else if(a.Al)b.preventDefault();else{a.bd=a.Tb;a.Tb=c;Zl(a,a,b,c,!0);c.im=!0;c.Oe=b.detail;if(D.OF||D.PF)b.timeStamp-a.Ym<a.pE&&!a.gb.isBeyondDragSize()?a.Dl++:
a.Dl=1,a.Ym=b.timeStamp,c.Oe=a.Dl;a.Zi=c;!0===c.Sr.simulated?(b.preventDefault(),b.simulated=!0):(Vh=null,a.doMouseDown(),a.Zi=a.Zi.copy(),1===b.button?b.preventDefault():ga(a,c,b))}}};a.lo=function(b){if(a.isEnabled)if(a.Al&&2===b.button)b.preventDefault();else if(a.Al&&0===b.button&&(a.Al=!1),a.Dt)b.preventDefault();else{a.Um=!0;var c=a.bd;if(D.Xn){if(400>b.timeStamp-a.Ym){b.preventDefault();return}a.Ym=b.timeStamp}if(D.Xn&&null!==a.ut)a.ut=null,b.preventDefault();else{a.bd=a.Tb;a.Tb=c;Zl(a,a,b,
c,!0);c.up=!0;c.Oe=b.detail;if(D.OF||D.PF)c.Oe=a.Dl;c.bubbles=b.bubbles;b.target.ba&&(c.fh=b.target.ba);a.simulatedMouseUp(b,null,new O,c.fh)||(a.doMouseUp(),yi(a),ga(a,c,b))}}};a.Zg=function(b){if(a.isEnabled){var c=a.bd;a.bd=a.Tb;a.Tb=c;Zl(a,a,b,c,!0);c.bubbles=!0;c.hm=void 0!==b.wheelDelta?b.wheelDelta:-40*b.detail;a.doMouseWheel();ga(a,c,b)}};a.ko=function(){if(a.isEnabled){a.Um=!1;var b=a.gb;b.cancelWaitAfter();b instanceof Hh&&b.hideToolTip()}};a.SB=function(b){if(a.isEnabled){a.Dt=!1;a.Al=
!0;var c=a.bd;a.bd=a.Tb;a.Tb=c;am(a,b,b.targetTouches[0],c,1<b.touches.length);a.doMouseDown();ga(a,c,b)}};a.RB=function(b){if(a.isEnabled){var c=a.bd;a.bd=a.Tb;a.Tb=c;var d=null;0<b.changedTouches.length?d=b.changedTouches[0]:0<b.targetTouches.length&&(d=b.targetTouches[0]);bm(a,b,d,c,1<b.touches.length);a.simulatedMouseMove(d?d:b,null,c.fh)||a.doMouseMove();ga(a,c,b)}};a.QB=function(b){if(a.isEnabled)if(a.Dt)b.preventDefault();else{var c=a.bd;a.bd=a.Tb;a.Tb=c;if(!(1<b.touches.length)){var d=null,
e=null;0<b.changedTouches.length?e=b.changedTouches[0]:0<b.targetTouches.length&&(e=b.targetTouches[0]);c.g=a;c.Oe=1;if(null!==e){d=window.document.elementFromPoint(e.clientX,e.clientY);null!==d&&d.ba instanceof E&&d.ba!==a&&$l(d.ba,e,c);$l(a,b.changedTouches[0],c);var m=e.screenX,n=e.screenY,p=a.tD;b.timeStamp-a.Ym<a.pE&&!(25<Math.abs(p.x-m)||25<Math.abs(p.y-n))?a.Dl++:a.Dl=1;c.Oe=a.Dl;a.Ym=b.timeStamp;a.tD.m(m,n)}c.Jd=0;c.button=0;c.buttons=1;c.im=!1;c.up=!0;c.hm=0;c.Lc=!1;c.bubbles=!1;c.event=
b;c.timestamp=Date.now();c.fh=null===d?b.target.ba:d.ba?d.ba:null;c.We=null;a.simulatedMouseUp(e?e:b,null,new O,c.fh)||a.doMouseUp();ga(a,c,b);a.Al=!1}}};a.mG=function(b){if("touch"===b.pointerType){var c=a.QD;void 0===c[b.pointerId]&&(a.Gw++,c[b.pointerId]=b);a.pj[0]=null;a.pj[1]=null;for(var d in c)if(null===a.pj[0])a.pj[0]=c[d];else if(null===a.pj[1]){a.pj[1]=c[d];break}a.isEnabled&&(a.Dt=!1,a.Al=!0,c=a.bd,a.bd=a.Tb,a.Tb=c,am(a,b,b,c,1<a.Gw),a.doMouseDown(),ga(a,c,b))}};a.oG=function(b){if("touch"===
b.pointerType&&!(2>a.Gw)){var c=a.pj;c[0].pointerId===b.pointerId&&(c[0]=b);c[1].pointerId===b.pointerId&&(c[1]=b);a.isEnabled&&(c=a.bd,a.bd=a.Tb,a.Tb=c,bm(a,b,b,c,!0),a.simulatedMouseMove(b,null,c.fh)||(a.doMouseMove(),ga(a,c,b)))}};a.nG=function(b){if("touch"===b.pointerType){var c=a.QD;void 0!==c[b.pointerId]&&(a.Gw--,delete c[b.pointerId],c=a.pj,null!==c[0]&&c[0].pointerId===b.pointerId&&(c[0]=null),null!==c[1]&&c[1].pointerId===b.pointerId&&(c[1]=null))}};d.Be(!0);Ll(a)}
function Sn(a){1<arguments.length&&D.k("Palette constructor can only take one optional argument, the DIV HTML element or its id.");E.call(this,a);this.Ut=!0;this.Yl=!1;this.mb=!0;this.RE=dc;this.Vb=new Tn}D.Sa(Sn,E);D.ja("Palette",Sn);
function El(a){1<arguments.length&&D.k("Overview constructor can only take one optional argument, the DIV HTML element or its id.");E.call(this,a);this.Xa.isEnabled=!1;this.Zc=!0;this.xk=null;this.Qv=!0;this.hK("drawShadows",!1);var b=new F,c=new z;c.stroke="magenta";c.jb=2;c.fill="transparent";c.name="BOXSHAPE";b.$k=!0;b.Cy="BOXSHAPE";b.iy="BOXSHAPE";b.DG="BOXSHAPE";b.cursor="move";b.add(c);this.Jm=b;c=new da;c.type=Qj;c.Kf=gc;var d=new Rj;d.Gf=!0;c.add(d);d=new z;d.Gh=gc;d.Jb="Rectangle";d.Ea=new Ca(64,
64);d.cursor="se-resize";d.alignment=rc;c.add(d);b.BG=c;this.Bn=this.Kk=!1;this.Bf=this.Wt=!0;this.KE=new Hb(0,0,0,0);this.cA=new ka(null);this.CH=this.cA.Ok;this.kb.De=new Un;this.kb.EG=new Vn;var e=this;this.click=function(){var a=e.xk;if(null!==a){var b=a.xb,c=e.U.ha;a.position=new O(c.x-b.width/2,c.y-b.height/2)}};this.jG=function(){Wn(e)};this.iG=function(){null!==e.xk&&(e.yc(),e.qa())};this.am=Xl;this.Zc=!1}D.Sa(El,E);D.ja("Overview",El);
function Xn(a){a.Zc||a.ge||!1!==a.Yf||(a.Yf=!0,requestAnimationFrame(function(){if(a.Yf&&!a.ge&&(a.Yf=!1,null!==a.Sb)){a.ge=!0;Li(a);a.cd.F()||Wl(a,a.Kh());null===a.Sb&&D.k("No div specified");null===a.Lb&&D.k("No canvas specified");if(a.Me){var b=a.xk;if(null!==b&&!b.Xa.sf&&!b.Xa.vc){var b=a.md,c=a.cA;b.setTransform(1,0,0,1,0,0);b.clearRect(0,0,a.Lb.width,a.Lb.height);b.drawImage(c.Ud,0,0);c=a.Hc;c.reset();1!==a.scale&&c.scale(a.scale);0===a.position.x&&0===a.position.y||c.translate(-a.position.x,
-a.position.y);b.scale(a.od,a.od);b.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy);for(var c=a.bc.o,d=c.length,e=0;e<d;e++)c[e].Ee(b,a);a.zl=!1;a.Me=!1}}a.ge=!1}}))}El.prototype.computePixelRatio=function(){return 1};
El.prototype.Ee=function(){null===this.Sb&&D.k("No div specified");null===this.Lb&&D.k("No canvas specified");if(this.Me){var a=this.xk;if(null!==a&&!a.Xa.sf){Km(this);var b=a.Vn;(null!==b&&b.visible&&isNaN(b.width)||isNaN(b.height))&&fm(a);var c=this.Lb,b=this.md,d=this.cA,e=this.CH;d.width=c.width;d.height=c.height;b.Be(!0);b.setTransform(1,0,0,1,0,0);b.clearRect(0,0,c.width,c.height);var g=this.Hc;g.reset();1!==this.scale&&g.scale(this.scale);0===this.position.x&&0===this.position.y||g.translate(-this.position.x,
-this.position.y);b.scale(this.od,this.od);b.transform(g.m11,g.m12,g.m21,g.m22,g.dx,g.dy);for(var h=this.Qv,k=this.xb,l=a.bc.o,m=l.length,a=0;a<m;a++){var n=l[a],p=b,q=k,r=h;if(n.visible&&0!==n.Fc&&(void 0===r&&(r=!0),r||!n.Tc)){1!==n.Fc&&(p.globalAlpha=n.Fc);for(var r=this.scale,n=n.pb.o,s=n.length,u=0;u<s;u++){var t=n[u],y=t.$;y.Wg(q)&&(1<y.width*r||1<y.height*r?t.Ee(p,this):ql(t,p))}p.globalAlpha=1}}e.drawImage(c.Ud,0,0);v&&v.zj&&(e.fillStyle="red",e.fillRect(0,d.height/2,d.width,4));c=this.bc.o;
d=c.length;for(a=0;a<d;a++)c[a].Ee(b,this);v&&(v.EA||v.zj)&&v.DA(b,this,g);this.Me=this.zl=!1}}};
D.defineProperty(El,{pB:"observed"},function(){return this.xk},function(a){var b=this.xk;null!==a&&D.l(a,E,El,"observed");a instanceof El&&D.k("Overview.observed Diagram may not be an Overview itself: "+a);b!==a&&(null!==b&&(this.remove(this.Jh),b.uG("ViewportBoundsChanged",this.jG),b.uG("DocumentBoundsChanged",this.iG),b.Cw.remove(this)),this.xk=a,null!==a&&(a.mA("ViewportBoundsChanged",this.jG),a.mA("DocumentBoundsChanged",this.iG),a.Cw.add(this),this.add(this.Jh),Wn(this)),this.yc(),this.i("observed",
b,a))});D.defineProperty(El,{Jh:"box"},function(){return this.Jm},function(a){var b=this.Jm;b!==a&&(this.Jm=a,this.remove(b),this.add(this.Jm),Wn(this),this.i("box",b,a))});D.defineProperty(El,{zL:"drawsTemporaryLayers"},function(){return this.Qv},function(a){this.Qv!==a&&(this.Qv=a,this.Hq())});
function Wn(a){var b=a.Jh;if(null!==b){var c=a.xk;if(null!==c){a.Me=!0;var c=c.xb,d=b.ro,e=D.Cm();e.m(c.width,c.height);d.Ea=e;D.Rk(e);a=2/a.scale;d instanceof z&&(d.jb=a);b.location=new O(c.x-a/2,c.y-a/2)}}}El.prototype.Kh=function(){var a=this.xk;return null===a?Hd:a.cd};El.prototype.JF=function(){!0!==this.Me&&(this.Me=!0,Xn(this))};
El.prototype.Pu=function(a,b,c,d,e){this.Zc||(Rl(this),this.qa(),cm(this),this.yc(),Wn(this),this.Fh.scale=c,this.Fh.position.x=a.x,this.Fh.position.y=a.y,this.Fh.bounds.set(a),this.Fh.isScroll=e,this.Ja("ViewportBoundsChanged",this.Fh,a))};function Un(){Mh.call(this);this.Kl=null}D.Sa(Un,Mh);
Un.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;if(null===a||!a.Yl||!a.Bf)return!1;var b=a.pB;if(null===b)return!1;if(null===this.findDraggablePart()){var c=b.xb;this.Kl=new O(c.width/2,c.height/2);a=a.Kc.ha;b.position=new O(a.x-this.Kl.x,a.y-this.Kl.y)}return!0};Un.prototype.doActivate=function(){this.Kl=null;Mh.prototype.doActivate.call(this)};
Un.prototype.moveParts=function(){var a=this.g,b=a.pB;if(null!==b){var c=a.Jh;if(null!==c){if(null===this.Kl){var d=a.Kc.ha,c=c.location;this.Kl=new O(d.x-c.x,d.y-c.y)}a=a.U.ha;b.position=new O(a.x-this.Kl.x,a.y-this.Kl.y)}}};function Vn(){Pj.call(this)}D.Sa(Vn,Pj);Vn.prototype.resize=function(a){var b=this.g.pB;if(null!==b){var c=b.xb.copy();b.position=a.position;(c.width!==a.width||c.height!==a.height)&&0<a.width&&0<a.height&&(b.scale=Math.min(c.width/a.width,c.height/a.height))}};
function Yn(){this.lg=this.gd=this.Kd=this.Nc=0}
function Ba(a){1<arguments.length&&D.k("Brush constructor can take at most one optional argument, the Brush type.");D.tc(this);this.J=!1;void 0===a?(this.ca=Ag,this.Lo="black"):"string"===typeof a?(this.ca=Ag,v&&!Aa(a)&&D.k('Color "'+a+'" is not a valid color string for Brush constructor'),this.Lo=a):(v&&D.Ca(a,Ba,Ba,"constructor:type"),this.ca=a,this.Lo="black");var b=this.ca;b===Qg?(this.Op=dc,this.$o=qc):this.$o=b===Ed?this.Op=gc:this.Op=bc;this.Vw=0;this.Rv=NaN;this.rh=this.Fw=this.qh=null;this.hz=
this.Mo=0}D.ja("Brush",Ba);var Ag;Ba.Solid=Ag=D.s(Ba,"Solid",0);var Qg;Ba.Linear=Qg=D.s(Ba,"Linear",1);var Ed;Ba.Radial=Ed=D.s(Ba,"Radial",2);var Zn;Ba.Pattern=Zn=D.s(Ba,"Pattern",4);var $n;Ba.Lab=$n=D.s(Ba,"Lab",5);var ao;Ba.HSL=ao=D.s(Ba,"HSL",6);Ba.prototype.copy=function(){var a=new Ba;a.ca=this.ca;a.Lo=this.Lo;a.Op=this.Op.V();a.$o=this.$o.V();a.Vw=this.Vw;a.Rv=this.Rv;null!==this.qh&&(a.qh=this.qh.copy());a.Fw=this.Fw;return a};f=Ba.prototype;
f.Na=function(){this.freeze();Object.freeze(this);return this};f.freeze=function(){this.J=!0;null!==this.qh&&this.qh.freeze();return this};f.Ya=function(){Object.isFrozen(this)&&D.k("cannot thaw constant: "+this);this.J=!1;null!==this.qh&&this.qh.Ya();return this};f.nc=function(a){a.Ne===Ba?this.type=a:D.Xj(this,a)};
f.toString=function(){var a="Brush(";if(this.type===Ag)a+=this.color;else if(a=this.type===Qg?a+"Linear ":this.type===Ed?a+"Radial ":this.type===Zn?a+"Pattern ":a+"(unknown) ",a+=this.start+" "+this.end,null!==this.Lk)for(var b=this.Lk.j;b.next();)a+=" "+b.key+":"+b.value;return a+")"};
Ba.prototype.addColorStop=Ba.prototype.addColorStop=function(a,b){this.J&&D.pa(this);("number"!==typeof a||!isFinite(a)||1<a||0>a)&&D.ua(a,"0 <= loc <= 1",Ba,"addColorStop:loc");D.h(b,"string",Ba,"addColorStop:color");v&&!Aa(b)&&D.k('Color "'+b+'" is not a valid color string for Brush.addColorStop');null===this.qh&&(this.qh=new ma("number","string"));this.qh.add(a,b);this.ca===Ag&&(this.type=Qg);this.rh=null};
D.defineProperty(Ba,{type:"type"},function(){return this.ca},function(a){this.J&&D.pa(this,a);D.Ca(a,Ba,Ba,"type");this.ca=a;this.start.Zd()&&(a===Qg?this.start=dc:a===Ed&&(this.start=gc));this.end.Zd()&&(a===Qg?this.end=qc:a===Ed&&(this.end=gc));this.rh=null});D.defineProperty(Ba,{color:"color"},function(){return this.Lo},function(a){this.J&&D.pa(this,a);v&&!Aa(a)&&D.k('Color "'+a+'" is not a valid color string for Brush.color');this.Lo=a;this.rh=null});
D.defineProperty(Ba,{start:"start"},function(){return this.Op},function(a){this.J&&D.pa(this,a);D.l(a,R,Ba,"start");this.Op=a.V();this.rh=null});D.defineProperty(Ba,{end:"end"},function(){return this.$o},function(a){this.J&&D.pa(this,a);D.l(a,R,Ba,"end");this.$o=a.V();this.rh=null});D.defineProperty(Ba,{dv:"startRadius"},function(){return this.Vw},function(a){this.J&&D.pa(this,a);D.p(a,Ba,"startRadius");0>a&&D.ua(a,">= zero",Ba,"startRadius");this.Vw=a;this.rh=null});
D.defineProperty(Ba,{eu:"endRadius"},function(){return this.Rv},function(a){this.J&&D.pa(this,a);D.p(a,Ba,"endRadius");0>a&&D.ua(a,">= zero",Ba,"endRadius");this.Rv=a;this.rh=null});D.defineProperty(Ba,{Lk:"colorStops"},function(){return this.qh},function(a){this.J&&D.pa(this,a);v&&D.l(a,ma,Ba,"colorStops");this.qh=a;this.rh=null});D.defineProperty(Ba,{pattern:"pattern"},function(){return this.Fw},function(a){this.J&&D.pa(this,a);this.Fw=a;this.rh=null});
Ba.randomColor=function(a,b){void 0===a&&(a=128);v&&(D.p(a,Ba,"randomColor:min"),(0>a||255<a)&&D.ua(a,"0 <= min <= 255",Ba,"randomColor:min"));void 0===b&&(b=Math.max(a,255));v&&(D.p(b,Ba,"randomColor:max"),(b<a||255<b)&&D.ua(b,"min <= max <= 255",Ba,"randomColor:max"));var c=Math.abs(b-a),d=Math.floor(a+Math.random()*c).toString(16),e=Math.floor(a+Math.random()*c).toString(16),c=Math.floor(a+Math.random()*c).toString(16);2>d.length&&(d="0"+d);2>e.length&&(e="0"+e);2>c.length&&(c="0"+c);return"#"+
d+e+c};var bo=(new ka(null)).Ok,Aa;Ba.isValidColor=Aa=function(a){if("black"===a)return!0;if(""===a)return!1;v&&D.h(a,"string",Ba,"isValidColor");bo.fillStyle="#000000";var b=bo.fillStyle;bo.fillStyle=a;if(bo.fillStyle!==b)return!0;bo.fillStyle="#FFFFFF";b=bo.fillStyle;bo.fillStyle=a;return bo.fillStyle!==b};var co=new Yn,eo=new Yn,fo=new Yn,ho=new Yn;Ba.lighten=function(a){return io(a)};
Ba.prototype.lightenBy=function(a,b){this.J&&D.pa(this);var c=void 0===a||"number"!==typeof a?.2:a,d=void 0===b?$n:b;if(this.type===Ag)jo(this.color),this.color=ko(c,d);else if((this.type===Qg||this.type===Ed)&&null!==this.Lk)for(var e=this.Lk.j;e.next();)jo(e.value),this.addColorStop(e.key,ko(c,d));return this};var io;Ba.lightenBy=io=function(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?$n:c;jo(a);return ko(b,c)};Ba.darken=function(a){return lo(a)};
Ba.prototype.darkenBy=function(a,b){this.J&&D.pa(this);var c=void 0===a||"number"!==typeof a?.2:a,d=void 0===b?$n:b;if(this.type===Ag)jo(this.color),this.color=ko(-c,d);else if((this.type===Qg||this.type===Ed)&&null!==this.Lk)for(var e=this.Lk.j;e.next();)jo(e.value),this.addColorStop(e.key,ko(-c,d));return this};var lo;Ba.darkenBy=lo=function(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?$n:c;jo(a);return ko(-b,c)};
function ko(a,b){switch(b){case $n:var c=100*mo(co.Nc),d=100*mo(co.Kd),e=100*mo(co.gd);fo.Nc=.4124564*c+.3575761*d+.1804375*e;fo.Kd=.2126729*c+.7151522*d+.072175*e;fo.gd=.0193339*c+.119192*d+.9503041*e;fo.lg=co.lg;c=no(fo.Nc/oo[0]);d=no(fo.Kd/oo[1]);e=no(fo.gd/oo[2]);ho.Nc=116*d-16;ho.Kd=500*(c-d);ho.gd=200*(d-e);ho.lg=fo.lg;ho.Nc=Math.min(100,Math.max(0,ho.Nc+100*a));c=(ho.Nc+16)/116;d=c-ho.gd/200;fo.Nc=oo[0]*po(ho.Kd/500+c);fo.Kd=oo[1]*(ho.Nc>qo*ro?Math.pow(c,3):ho.Nc/qo);fo.gd=oo[2]*po(d);fo.lg=
ho.lg;c=-.969266*fo.Nc+1.8760108*fo.Kd+.041556*fo.gd;d=.0556434*fo.Nc+-.2040259*fo.Kd+1.0572252*fo.gd;co.Nc=255*so((3.2404542*fo.Nc+-1.5371385*fo.Kd+-.4985314*fo.gd)/100);co.Kd=255*so(c/100);co.gd=255*so(d/100);co.lg=fo.lg;co.Nc=Math.round(co.Nc);255<co.Nc?co.Nc=255:0>co.Nc&&(co.Nc=0);co.Kd=Math.round(co.Kd);255<co.Kd?co.Kd=255:0>co.Kd&&(co.Kd=0);co.gd=Math.round(co.gd);255<co.gd?co.gd=255:0>co.gd&&(co.gd=0);return"rgba("+co.Nc+", "+co.Kd+", "+co.gd+", "+co.lg+")";case ao:var e=co.Nc/255,g=co.Kd/
255,h=co.gd/255,k=Math.max(e,g,h),d=Math.min(e,g,h),l=k-d,d=(k+d)/2;if(0===l)c=e=0;else{switch(k){case e:c=(g-h)/l%6;break;case g:c=(h-e)/l+2;break;case h:c=(e-g)/l+4}c*=60;0>c&&(c+=360);e=l/(1-Math.abs(2*d-1))}eo.Nc=Math.round(c);eo.Kd=Math.round(100*e);eo.gd=Math.round(100*d);eo.lg=co.lg;eo.gd=Math.min(100,Math.max(0,eo.gd+100*a));return"hsla("+eo.Nc+", "+eo.Kd+"%, "+eo.gd+"%, "+eo.lg+")";default:return D.k("Unknown color space: "+b),"rgba(0, 0, 0, 1)"}}
function jo(a){bo.clearRect(0,0,1,1);bo.fillStyle="#000000";var b=bo.fillStyle;bo.fillStyle=a;bo.fillStyle!==b?(bo.fillRect(0,0,1,1),a=bo.getImageData(0,0,1,1).data,co.Nc=a[0],co.Kd=a[1],co.gd=a[2],co.lg=a[3]/255):(bo.fillStyle="#FFFFFF",b=bo.fillStyle,bo.fillStyle=a,bo.fillStyle===b&&v&&D.k('Color "'+a+'" is not a valid color string for RGBA color conversion'),co.Nc=0,co.Kd=0,co.gd=0,co.lg=1)}function mo(a){a/=255;return.04045>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}
function so(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055}var ro=216/24389,qo=24389/27,oo=[95.047,100,108.883];function no(a){return a>ro?Math.pow(a,1/3):(qo*a+16)/116}function po(a){var b=a*a*a;return b>ro?b:(116*a-16)/qo}
function P(){D.tc(this);this.T=4225027;this.Fc=1;this.Bh=null;this.Xb="";this.hc=this.Kb=null;this.qb=(new O(NaN,NaN)).freeze();this.Ye=me;this.li=Zd;this.ki=ke;this.Hc=new Da;this.Li=new Da;this.gj=new Da;this.Bb=this.Xo=1;this.rg=0;this.Mg=to;this.cn=Ud;this.Ad=(new B(NaN,NaN,NaN,NaN)).freeze();this.ac=(new B(NaN,NaN,NaN,NaN)).freeze();this.$c=(new B(0,0,NaN,NaN)).freeze();this.Z=this.Ws=this.Xs=null;this.Hm=this.re=Tc;this.it=0;this.rj=1;this.qr=0;this.Qi=1;this.yt=null;this.mt=-Infinity;this.on=
0;this.pn=Gd;this.qn=nj;this.zr="";this.Bc=this.la=null;this.Jo=-1;this.un=this.ug=this.rl=this.Np=null;this.Uz=yj;this.kn=null}D.Ai(P);D.ja("GraphObject",P);
P.prototype.cloneProtected=function(a){a.T=this.T|6144;a.Fc=this.Fc;a.Xb=this.Xb;a.Kb=this.Kb;a.hc=this.hc;a.qb.assign(this.qb);a.Ye=this.Ye.V();a.li=this.li.V();a.ki=this.ki.V();a.gj=this.gj.copy();a.Bb=this.Bb;a.rg=this.rg;a.Mg=this.Mg;a.cn=this.cn.V();a.Ad.assign(this.Ad);a.ac.assign(this.ac);a.$c.assign(this.$c);a.Ws=this.Ws;null!==this.Z&&(a.Z=this.Z.copy());a.re=this.re.V();a.Hm=this.Hm.V();a.it=this.it;a.rj=this.rj;a.qr=this.qr;a.Qi=this.Qi;a.yt=this.yt;a.mt=this.mt;a.on=this.on;a.pn=this.pn.V();
a.qn=this.qn;a.zr=this.zr;null!==this.la&&(a.la=this.la.copy());a.Bc=this.Bc;a.Jo=this.Jo;null!==this.rl&&(a.rl=D.cm(this.rl));null!==this.ug&&(a.ug=this.ug.copy());a.un=this.un};P.prototype.addCopyProperty=P.prototype.KH=function(a){var b=this.rl;if(D.isArray(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.rl=b=[];b.push(a)};P.prototype.Bi=function(a){a.Xs=null;a.kn=null;a.K()};
P.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.rl)for(var b=0;b<this.rl.length;b++){var c=this.rl[b];a[c]=this[c]}return a};P.prototype.copy=function(){return this.clone()};P.prototype.nc=function(a){a.Ne===J?0===a.name.indexOf("Orient")?this.Oq=a:D.k("Unknown Link enum value for GraphObject.segmentOrientation property: "+a):a.Ne===P?this.stretch=a:D.Xj(this,a)};P.prototype.toString=function(){return D.qf(Object.getPrototypeOf(this))+"#"+D.Fd(this)};
var Sj;P.None=Sj=D.s(P,"None",0);var to;P.Default=to=D.s(P,"Default",0);var uo;P.Vertical=uo=D.s(P,"Vertical",4);var vo;P.Horizontal=vo=D.s(P,"Horizontal",5);var rf;P.Fill=rf=D.s(P,"Fill",3);var Uj;P.Uniform=Uj=D.s(P,"Uniform",1);var Vj;P.UniformToFill=Vj=D.s(P,"UniformToFill",2);var wo;P.FlipVertical=wo=D.s(P,"FlipVertical",1);var xo;P.FlipHorizontal=xo=D.s(P,"FlipHorizontal",2);var yo;P.FlipBoth=yo=D.s(P,"FlipBoth",3);function zo(a){null===a.la&&(a.la=new Ao)}
P.prototype.Wd=function(){if(null===this.Z){var a=new Bo;a.jk=bc;a.Gk=bc;a.hk=10;a.Ek=10;a.gk=Co;a.Dk=Co;a.ik=0;a.Fk=0;this.Z=a}};function Do(a,b,c,d,e,g,h){var k=.001,l=g.length;a.moveTo(b,c);d-=b;k=e-c;0===d&&(d=.001);e=k/d;for(var m=Math.sqrt(d*d+k*k),n=0,p=!0,q=0===h?!1:!0;.1<=m;){if(q){k=g[n++%l];for(k-=h;0>k;)k+=g[n++%l],p=!p;q=!1}else k=g[n++%l];k>m&&(k=m);var r=Math.sqrt(k*k/(1+e*e));0>d&&(r=-r);b+=r;c+=e*r;p?a.lineTo(b,c):a.moveTo(b,c);m-=k;p=!p}}
P.prototype.raiseChangedEvent=P.prototype.hd=function(a,b,c,d,e,g,h){var k=this.Y;if(null!==k&&(k.po(a,b,c,d,e,g,h),Eo(this)&&c===this&&a===cg&&Fo(this,k,b),c===k&&0!==(k.T&16777216)&&null!==k.data))for(a=this.xa.o,c=a.length,d=0;d<c;d++)e=a[d],e instanceof x&&Rm(e,function(a){null!==a.data&&0!==(a.T&16777216)&&a.Nb(b)})};
function Fo(a,b,c){var d=a.lm();if(null!==d)for(var e=a.Bc.j;e.next();){var g=e.value,h=null;if(null!==g.Vq){h=lh(g,d,a);if(null===h)continue;g.Jy(a,h,c,null)}else if(g.Yx){var k=b.g;null===k||k.Ue||g.Jy(a,k.ga.Yk,c,d)}else{var l=d.data;if(null===l)continue;k=b.g;null===k||k.Ue||g.Jy(a,l,c,d)}h===a&&(k=d.Gx(g.Bm),null!==k&&g.iH(k,h,c))}}P.prototype.Gx=function(a){return this.Jo===a?this:null};P.prototype.raiseChanged=P.prototype.i=function(a,b,c){this.hd(cg,a,this,b,c)};
function Go(a,b,c,d,e){var g=a.Ad,h=a.gj;h.reset();Ho(a,h,b,c,d,e);a.gj=h;g.x=b;g.y=c;g.width=d;g.height=e;h.xu()||h.fH(g)}function Io(a,b,c,d){if(!1===a.pg)return!1;d.multiply(a.transform);return c?a.Wg(b,d):a.Hn(b,d)}
P.prototype.pF=function(a,b,c){if(!1===this.pg)return!1;var d=this.Ga;b=a.Cf(b);var e=!1;c&&(e=jb(a.x,a.y,0,0,0,d.height)<b||jb(a.x,a.y,0,d.height,d.width,d.height)<b||jb(a.x,a.y,d.width,d.height,d.width,0)<b||jb(a.x,a.y,d.width,0,0,0)<b);c||(e=jb(a.x,a.y,0,0,0,d.height)<b&&jb(a.x,a.y,0,d.height,d.width,d.height)<b&&jb(a.x,a.y,d.width,d.height,d.width,0)<b&&jb(a.x,a.y,d.width,0,0,0)<b);return e};P.prototype.kh=function(){return!0};
P.prototype.containsPoint=P.prototype.Oa=function(a){v&&D.l(a,O,P,"containsPoint:p");var b=D.P();b.assign(a);this.transform.vb(b);var c=this.$;if(!c.F())return D.A(b),!1;var d=this.g;if(null!==d&&d.Al){var e=d.pu("extraTouchThreshold"),g=d.pu("extraTouchArea"),h=g/2,k=this.Ga,d=this.Fj()*d.scale,l=1/d;if(k.width*d<e&&k.height*d<e)return a=Pb(c.x-h*l,c.y-h*l,c.width+g*l,c.height+g*l,b.x,b.y),D.A(b),a}if(this instanceof da||this instanceof z?Pb(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y):c.Oa(b))return e=
!1,e=this.ug&&!this.ug.Oa(b)?!1:null!==this.hc&&c.Oa(b)?!0:null!==this.Kb&&this.$c.Oa(a)?!0:this.Mk(a),D.A(b),e;D.A(b);return!1};P.prototype.Mk=function(a){var b=this.Ga;return Pb(0,0,b.width,b.height,a.x,a.y)};
P.prototype.containsRect=P.prototype.Nk=function(a){v&&D.l(a,B,P,"containsRect:r");if(0===this.angle)return this.$.Nk(a);var b=this.Ga,b=D.gh(0,0,b.width,b.height),c=this.transform,d=!1,e=D.Fb(a.x,a.y);b.Oa(c.Ci(e))&&(e.m(a.x,a.bottom),b.Oa(c.Ci(e))&&(e.m(a.right,a.bottom),b.Oa(c.Ci(e))&&(e.m(a.right,a.y),b.Oa(c.Ci(e))&&(d=!0))));D.A(e);D.Mb(b);return d};
P.prototype.containedInRect=P.prototype.Hn=function(a,b){v&&D.l(a,B,P,"containedInRect:r");if(void 0===b)return a.Nk(this.$);var c=this.Ga,d=!1,e=D.Fb(0,0);a.Oa(b.vb(e))&&(e.m(0,c.height),a.Oa(b.vb(e))&&(e.m(c.width,c.height),a.Oa(b.vb(e))&&(e.m(c.width,0),a.Oa(b.vb(e))&&(d=!0))));D.A(e);return d};
P.prototype.intersectsRect=P.prototype.Wg=function(a,b){v&&D.l(a,B,P,"intersectsRect:r");if(void 0===b&&(b=this.transform,0===this.angle))return a.Wg(this.$);var c=this.Ga,d=b,e=D.Fb(0,0),g=D.Fb(0,c.height),h=D.Fb(c.width,c.height),k=D.Fb(c.width,0),l=!1;if(a.Oa(d.vb(e))||a.Oa(d.vb(g))||a.Oa(d.vb(h))||a.Oa(d.vb(k)))l=!0;else{var c=D.gh(0,0,c.width,c.height),m=D.Fb(a.x,a.y);c.Oa(d.Ci(m))?l=!0:(m.m(a.x,a.bottom),c.Oa(d.Ci(m))?l=!0:(m.m(a.right,a.bottom),c.Oa(d.Ci(m))?l=!0:(m.m(a.right,a.y),c.Oa(d.Ci(m))&&
(l=!0))));D.A(m);D.Mb(c);!l&&(Ve(a,e,g)||Ve(a,g,h)||Ve(a,h,k)||Ve(a,k,e))&&(l=!0)}D.A(e);D.A(g);D.A(h);D.A(k);return l};P.prototype.getDocumentPoint=P.prototype.eb=function(a,b){void 0===b&&(b=new O);if(a instanceof R){a.Zd()&&D.k("getDocumentPoint:s Spot must be specific: "+a.toString());var c=this.Ga;b.m(a.x*c.width+a.offsetX,a.y*c.height+a.offsetY)}else b.set(a);this.Hh.vb(b);return b};
P.prototype.getDocumentAngle=P.prototype.Rn=function(){var a;a=this.Hh;1===a.m11&&0===a.m12?a=0:(a=180*Math.atan2(a.m12,a.m11)/Math.PI,0>a&&(a+=360));return a};P.prototype.getDocumentScale=P.prototype.Fj=function(){if(0!==(this.T&4096)===!1)return this.Xo;var a=this.Bb;return null!==this.Q?a*this.Q.Fj():a};P.prototype.getLocalPoint=P.prototype.uF=function(a,b){void 0===b&&(b=new O);b.assign(a);this.Hh.Ci(b);return b};
P.prototype.getNearestIntersectionPoint=P.prototype.vF=function(a,b,c){return this.Tn(a.x,a.y,b.x,b.y,c)};f=P.prototype;f.Tn=function(a,b,c,d,e){var g=this.transform,h=1/(g.m11*g.m22-g.m12*g.m21),k=g.m22*h,l=-g.m12*h,m=-g.m21*h,n=g.m11*h,p=h*(g.m21*g.dy-g.m22*g.dx),q=h*(g.m12*g.dx-g.m11*g.dy);if(null!==this.Zl)return g=this.$,Ne(g.left,g.top,g.right,g.bottom,a,b,c,d,e);h=a*k+b*m+p;a=a*l+b*n+q;b=c*k+d*m+p;c=c*l+d*n+q;e.m(0,0);d=this.Ga;c=Ne(0,0,d.width,d.height,h,a,b,c,e);e.transform(g);return c};
function Ak(a,b,c,d,e){if(!1!==Hm(a)){var g=a.margin,h=g.right+g.left,g=g.top+g.bottom;b=Math.max(b-h,0);c=Math.max(c-g,0);e=e||0;d=Math.max((d||0)-h,0);e=Math.max(e-g,0);var h=a.angle,g=0,g=a.Ea,k=0;a instanceof z&&(k=a.jb);90===h||270===h?(b=isFinite(g.height)?g.height+k:b,c=isFinite(g.width)?g.width+k:c):(b=isFinite(g.width)?g.width+k:b,c=isFinite(g.height)?g.height+k:c);var g=d||0,k=e||0,l=a instanceof x;switch(Jo(a,!0)){case Sj:k=g=0;l&&(c=b=Infinity);break;case rf:isFinite(b)&&b>d&&(g=b);isFinite(c)&&
c>e&&(k=c);break;case vo:isFinite(b)&&b>d&&(g=b);k=0;l&&(c=Infinity);break;case uo:isFinite(c)&&c>e&&(k=c),g=0,l&&(b=Infinity)}var l=a.kf,m=a.hg;g>l.width&&m.width<l.width&&(g=l.width);k>l.height&&m.height<l.height&&(k=l.height);d=Math.max(g/a.scale,m.width);e=Math.max(k/a.scale,m.height);l.width<d&&(d=Math.min(m.width,d));l.height<e&&(e=Math.min(m.height,e));b=Math.min(l.width,b);c=Math.min(l.height,c);b=Math.max(d,b);c=Math.max(e,c);if(90===h||270===h)g=b,b=c,c=g,g=d,d=e,e=g;a.Ad.Ya();a.ho(b,c,
d,e);a.Ad.freeze();a.Ad.F()||D.k("Non-real measuredBounds has been set. Object "+a+", measuredBounds: "+a.Ad.toString());em(a,!1)}}f.ho=function(){};f.Jj=function(){return!1};
f.oc=function(a,b,c,d,e){this.$i();var g=D.Nf();g.assign(this.ac);this.ac.Ya();if(!1===Im(this)){var h=this.ac;h.x=a;h.y=b;h.width=c;h.height=d}else this.yj(a,b,c,d);this.ac.freeze();this.ug=void 0===e?null:e;c=!1;void 0!==e?c=!0:null!==this.Q&&(e=this.Q.$c,d=this.Fa,null!==this.Zl&&(d=this.ac),c=b+d.height,d=a+d.width,c=!(0<=a+.05&&d<=e.width+.05&&0<=b+.05&&c<=e.height+.05),this instanceof na&&(a=this.$c,this.pw>a.height||this.gi.nf>a.width))&&(c=!0);this.T=c?this.T|256:this.T&-257;this.ac.F()||
D.k("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.ac.toString());this.my(g,this.ac);Ko(this,!1);D.Mb(g)};f.yj=function(){};
function Lo(a,b,c,d,e){var g=a.$;g.x=b;g.y=c;g.width=d;g.height=e;if(!a.Ea.F()){g=a.Ad;c=a.margin;b=c.right+c.left;var h=c.top+c.bottom;c=g.width+b;g=g.height+h;d+=b;e+=h;b=Jo(a,!0);c===d&&g===e&&(b=Sj);switch(b){case Sj:if(c>d||g>e)em(a,!0),Ak(a,c>d?d:c,g>e?e:g);break;case rf:em(a,!0);Ak(a,d,e,0,0);break;case vo:em(a,!0);Ak(a,d,g,0,0);break;case uo:em(a,!0),Ak(a,c,e,0,0)}}}
f.my=function(a,b){var c=this.Y;null!==c&&null!==c.g&&(c.ro!==this&&c.CG!==this&&c.GG!==this||Mo(c,!0),this.qa(),xb(a,b)||(c.rm(),this.yw(c)))};f.yw=function(a){null!==this.sd&&(Mo(a,!0),a instanceof G&&No(a,this))};D.defineProperty(P,{Sq:"shadowVisible"},function(){return this.un},function(a){var b=this.un;b!==a&&(v&&null!==a&&D.h(a,"boolean",P,"shadowVisible"),this.un=a,this.qa(),this.i("shadowVisible",b,a))});
P.prototype.Ee=function(a,b){if(this.visible){var c=this.ac;if(0!==c.width&&0!==c.height&&!isNaN(c.x)&&!isNaN(c.y)){var d=this.opacity,e=1;if(1!==d){if(0===d)return;e=a.globalAlpha;a.globalAlpha=e*d}if(a instanceof nd)a:{if(this.visible){var g=null,h=a.$x;if(this instanceof x&&(this.type===Oo||this.type===Po))Qo(this,a,b);else{var k=this.ac;if(0!==k.width&&0!==k.height&&!isNaN(k.x)&&!isNaN(k.y)){var l=this.transform,m=this.Q;0!==(this.T&4096)===!0&&Ro(this);var c=0!==(this.T&256),n=!1;this instanceof
na&&(a.font=this.font);if(c){n=m.kh()?m.Ga:m.$;if(null!==this.ug)var p=this.ug,q=p.x,r=p.y,s=p.width,p=p.height;else q=Math.max(k.x,n.x),r=Math.max(k.y,n.y),s=Math.min(k.right,n.right)-q,p=Math.min(k.bottom,n.bottom)-r;if(q>k.width+k.x||k.x>n.width+n.x||r>k.height+k.y||k.y>n.height+n.y)break a;n=!0;pd(a,1,0,0,1,0,0);a.save();a.beginPath();a.rect(q,r,s,p);a.clip()}if(this.Jj()){var u=this;if(!u.isVisible())break a}a.Mh.Yb=[1,0,0,1,0,0];q=!1;this.Jj()&&this.Wk&&b.Gj("drawShadows")&&(r=this.tn,a.JB(r.x*
b.scale*b.od,r.y*b.scale*b.od,u.Lg),a.uo(),a.shadowColor=u.sn);u=!1;this.Y&&b.Gj("drawShadows")&&(u=this.Y.Wk);!0===this.Sq?(a.uo(),!1===q&&u&&(pd(a,1,0,0,1,0,0),a.ib(),q=!0)):!1===this.Sq&&a.to();null!==this.hc&&(So(this,a,this.hc,!0,!0),!1===q&&u&&(pd(a,1,0,0,1,0,0),a.ib(),q=!0),this.hc instanceof Ba&&this.hc.type===Ed?(a.beginPath(),a.rect(k.x,k.y,k.width,k.height),a.Ug(this.hc)):a.fillRect(k.x,k.y,k.width,k.height));this instanceof x?pd(a,l.m11,l.m12,l.m21,l.m22,l.dx,l.dy):a.Mh.Yb=[l.m11,l.m12,
l.m21,l.m22,l.dx,l.dy];null!==this.Kb&&(!1===q&&u&&(pd(a,1,0,0,1,0,0),a.ib(),q=!0),s=this.Ga,l=k=0,r=s.width,s=s.height,p=0,this instanceof z&&(s=this.ob.sb,k=s.x,l=s.y,r=s.width,s=s.height,p=this.Ng),So(this,a,this.Kb,!0,!1),this.Kb instanceof Ba&&this.Kb.type===Ed?(a.beginPath(),a.rect(k-p/2,l-p/2,r+p,s+p),a.Ug(this.Kb)):a.fillRect(k-p/2,l-p/2,r+p,s+p));u&&(null!==this.Kb||null!==this.hc||null!==m&&0!==(m.T&512)||null!==m&&(m.type===Kl||m.type===Qj)&&m.Vd()!==this)?(To(this,!0),null===this.Sq&&
a.to()):To(this,!1);this.Pk(a,b);u&&0!==(this.T&512)===!0&&a.uo();this.Jj()&&u&&a.to();c&&(a.restore(),n&&a.Ef.pop());this instanceof x&&(g=a.Ef.pop());!0===q&&a.Ef.pop();null!==a.hF&&(null===g&&(h===a.$x?(pd(a,1,0,0,1,0,0),g=a.Ef.pop()):g=a.$x),a.hF(this,g))}}}}else{if(this instanceof x&&(this.type===Oo||this.type===Po)){Qo(this,a,b);1!==d&&(a.globalAlpha=e);return}this instanceof J&&this.Gu(!1);v&&v.zj&&v.wI(a,this);g=this.transform;h=this.Q;0!==(this.T&4096)===!0&&Ro(this);m=0!==(this.T&256);a.eq&&
(m=!1);this instanceof na&&(a.font=this.font);if(m){v&&v.gF&&D.trace("clip"+this.toString());n=h.kh()?h.Ga:h.$;null!==this.ug?(q=this.ug,k=q.x,l=q.y,u=q.width,q=q.height):(k=Math.max(c.x,n.x),l=Math.max(c.y,n.y),u=Math.min(c.right,n.right)-k,q=Math.min(c.bottom,n.bottom)-l);if(k>c.width+c.x||c.x>n.width+n.x||l>c.height+c.y||c.y>n.height+n.y){1!==d&&(a.globalAlpha=e);return}v&&v.gF&&v.yI(a,k,l,u,q);a.save();a.beginPath();a.rect(k,l,u,q);a.clip()}if(this.Jj()){if(!this.isVisible()){1!==d&&(a.globalAlpha=
e);return}this.Wk&&b.Gj("drawShadows")&&(n=this.tn,a.JB(n.x*b.scale*b.od,n.y*b.scale*b.od,this.Lg),a.uo(),a.shadowColor=this.sn)}n=!1;this.Y&&b.Gj("drawShadows")&&(n=this.Y.Wk);!0===this.Sq?a.uo():!1===this.Sq&&a.to();null!==this.hc&&(So(this,a,this.hc,!0,!0),this.hc instanceof Ba&&this.hc.type===Ed?(a.beginPath(),a.rect(c.x,c.y,c.width,c.height),a.Ug(this.hc)):a.fillRect(c.x,c.y,c.width,c.height));g.xu()||a.transform(g.m11,g.m12,g.m21,g.m22,g.dx,g.dy);null!==this.Kb&&(u=this.Ga,k=c=0,l=u.width,u=
u.height,q=0,this instanceof z&&(u=this.ob.sb,c=u.x,k=u.y,l=u.width,u=u.height,q=this.Ng),So(this,a,this.Kb,!0,!1),this.Kb instanceof Ba&&this.Kb.type===Ed?(a.beginPath(),a.rect(c-q/2,k-q/2,l+q,u+q),a.Ug(this.Kb)):a.fillRect(c-q/2,k-q/2,l+q,u+q));v&&v.zj&&v.xI(a,this);n&&(null!==this.Kb||null!==this.hc||null!==h&&0!==(h.T&512)||null!==h&&(h.type===Kl||h.type===Qj)&&h.Vd()!==this)?(To(this,!0),null===this.Sq&&a.to()):To(this,!1);this.Pk(a,b);n&&0!==(this.T&512)===!0&&a.uo();this.Jj()&&n&&a.to();m?
(a.restore(),this instanceof x?a.Be(!0):a.Be(!1)):g.xu()||(h=1/(g.m11*g.m22-g.m12*g.m21),a.transform(g.m22*h,-g.m12*h,-g.m21*h,g.m11*h,h*(g.m21*g.dy-g.m22*g.dx),h*(g.m12*g.dx-g.m11*g.dy)))}1!==d&&(a.globalAlpha=e)}}};
function Qo(a,b,c){var d=a.ac;0===d.width||0===d.height||isNaN(d.x)||isNaN(d.y)||(null!==a.hc&&(So(a,b,a.hc,!0,!0),a.hc instanceof Ba&&a.hc.type===Ed?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Ug(a.hc)):b.fillRect(d.x,d.y,d.width,d.height)),null!==a.Kb&&(So(a,b,a.Kb,!0,!1),a.Kb instanceof Ba&&a.Kb.type===Ed?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Ug(a.Kb)):b.fillRect(d.x,d.y,d.width,d.height)),a.Pk(b,c))}P.prototype.Pk=function(){};
function So(a,b,c,d,e){if(null!==c){var g=1,h=1;if("string"===typeof c)d?b.fillStyle=c:b.strokeStyle=c;else if(c.type===Ag)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{var k,h=a.Ga,g=h.width,h=h.height;if(e)var l=a.$,g=l.width,h=l.height;var m=b instanceof Dd;if(m&&c.rh&&(c.type===Zn||c.Mo===g&&c.hz===h))k=c.rh;else{var n=l=0,p=0,q=0,r=0,s=0,s=r=0;e&&(l=a.$,g=l.width,h=l.height,r=l.x,s=l.y);l=c.start.x*g+c.start.offsetX;n=c.start.y*h+c.start.offsetY;p=c.end.x*g+c.end.offsetX;q=c.end.y*h+c.end.offsetY;
l+=r;p+=r;n+=s;q+=s;if(c.type===Qg)k=b.createLinearGradient(l,n,p,q);else if(c.type===Ed)s=isNaN(c.eu)?Math.max(g,h)/2:c.eu,isNaN(c.dv)?(r=0,s=Math.max(g,h)/2):r=c.dv,k=b.createRadialGradient(l,n,r,p,q,s);else if(c.type===Zn)try{k=b.createPattern(c.pattern,"repeat")}catch(u){k=null}else D.gc(c.type,"Brush type");if(c.type!==Zn&&(e=c.Lk,null!==e))for(e=e.j;e.next();)k.addColorStop(e.key,e.value);if(m&&(c.rh=k,null!==k&&(c.Mo=g,c.hz=h),null===k&&c.type===Zn&&-1!==c.Mo)){c.Mo=-1;var t=a.g;null!==t&&
-1===c.Mo&&D.setTimeout(function(){t.Hq()},600)}}d?b.fillStyle=k:b.strokeStyle=k}}}P.prototype.isContainedBy=P.prototype.tm=function(a){if(a instanceof x)a:{if(this!==a&&null!==a)for(var b=this.Q;null!==b;){if(b===a){a=!0;break a}b=b.Q}a=!1}else a=!1;return a};P.prototype.isVisibleObject=P.prototype.Nj=function(){if(!this.visible)return!1;var a=this.Q;return null!==a?a.Nj():!0};
P.prototype.isEnabledObject=P.prototype.vu=function(){for(var a=this instanceof x?this:this.Q;null!==a&&a.isEnabled;)a=a.Q;return null===a};D.defineProperty(P,{iF:"enabledChanged"},function(){return null!==this.la?this.la.Qr:null},function(a){zo(this);var b=this.la.Qr;b!==a&&(null!==a&&D.h(a,"function",P,"enabledChanged"),this.la.Qr=a,this.i("enabledChanged",b,a))});
function Ro(a){if(0!==(a.T&2048)===!0){var b=a.Hc;b.reset();if(!a.ac.F()||!a.Ad.F()){Uo(a,!1);return}b.translate(a.ac.x,a.ac.y);b.translate(-a.Fa.x,-a.Fa.y);var c=a.Ga;Ho(a,b,c.x,c.y,c.width,c.height);Uo(a,!1);Vo(a,!0)}0!==(a.T&4096)===!0&&(b=a.Q,null===b?(a.Li.set(a.Hc),a.Xo=a.scale,Vo(a,!1)):null!==b.Hh&&(c=a.Li,c.reset(),b.kh()?c.multiply(b.Li):null!==b.Q&&c.multiply(b.Q.Li),c.multiply(a.Hc),a.Xo=a.scale*b.Xo,Vo(a,!1)))}
function Ho(a,b,c,d,e,g){1!==a.scale&&b.scale(a.scale);if(0!==a.angle){var h=gc;a.Jj()&&a.Kf.fd()&&(h=a.Kf);var k=D.P();if(a instanceof F&&a.uf!==a)for(c=a.uf,d=c.Ga,k.av(d.x,d.y,d.width,d.height,h),c.gj.vb(k),k.offset(-c.Fa.x,-c.Fa.y),h=c.Q;null!==h&&h!==a;)h.gj.vb(k),k.offset(-h.Fa.x,-h.Fa.y),h=h.Q;else k.av(c,d,e,g,h);b.rotate(a.angle,k.x,k.y);D.A(k)}}f=P.prototype;f.K=function(a){void 0===a&&(a=!1);if(!0!==Hm(this)){em(this,!0);Ko(this,!0);var b=this.Q;null===b||a||b.K()}};
f.xq=function(){!0!==Hm(this)&&(em(this,!0),Ko(this,!0))};function Wo(a){if(!1===Im(a)){var b=a.Q;null!==b?b.K():a.Jj()&&(b=a.g,null!==b&&(b.Cg.add(a),a instanceof G&&a.fg(),b.Se()));Ko(a,!0)}}f.$i=function(){0!==(this.T&2048)===!1&&(Uo(this,!0),Vo(this,!0))};f.XA=function(){Vo(this,!0)};f.qa=function(){var a=this.Y;null!==a&&a.qa()};
function Jo(a,b){var c=a.stretch,d=a.Q;if(null!==d&&d.ca===ea)return Xo(a,d.me(a.Zb),d.le(a.column),b);if(null!==d&&d.ca===Kl&&d.Vd()===a)return Yo(a,rf,b);if(c===to){if(null!==d){if(d.ca===Qj&&d.Vd()===a)return Yo(a,rf,b);c=d.je;return c===to?Yo(a,Sj,b):Yo(a,c,b)}return Yo(a,Sj,b)}return Yo(a,c,b)}
function Xo(a,b,c,d){var e=a.stretch;if(e!==to)return Yo(a,e,d);var g=e=null;switch(b.stretch){case uo:g=!0;break;case rf:g=!0}switch(c.stretch){case vo:e=!0;break;case rf:e=!0}b=a.Q.je;null===e&&(e=b===vo||b===rf);null===g&&(g=b===uo||b===rf);return!0===e&&!0===g?Yo(a,rf,d):!0===e?Yo(a,vo,d):!0===g?Yo(a,uo,d):Yo(a,Sj,d)}
function Yo(a,b,c){if(c)return b;if(b===Sj)return Sj;c=a.Ea;if(c.F())return Sj;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===vo)return Sj;if(b===rf)return uo}else{if(b===uo)return Sj;if(b===rf)return vo}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===uo)return Sj;if(b===rf)return vo}else{if(b===vo)return Sj;if(b===rf)return uo}return b}
D.defineProperty(P,{Oq:"segmentOrientation"},function(){return this.qn},function(a){var b=this.qn;b!==a&&(v&&D.Ca(a,J,P,"segmentOrientation"),this.qn=a,this.K(),this.i("segmentOrientation",b,a),a===nj&&(this.angle=0))});D.defineProperty(P,{Te:"segmentIndex"},function(){return this.mt},function(a){v&&D.h(a,"number",P,"segmentIndex");a=Math.round(a);var b=this.mt;b!==a&&(this.mt=a,this.K(),this.i("segmentIndex",b,a))});
D.defineProperty(P,{zB:"segmentFraction"},function(){return this.on},function(a){v&&D.h(a,"number",P,"segmentFraction");isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.on;b!==a&&(this.on=a,this.K(),this.i("segmentFraction",b,a))});D.defineProperty(P,{AB:"segmentOffset"},function(){return this.pn},function(a){var b=this.pn;b.O(a)||(v&&D.l(a,O,P,"segmentOffset"),this.pn=a=a.V(),this.K(),this.i("segmentOffset",b,a))});
D.defineProperty(P,{stretch:"stretch"},function(){return this.Mg},function(a){var b=this.Mg;b!==a&&(v&&D.Ca(a,P,P,"stretch"),this.Mg=a,this.K(),this.i("stretch",b,a))});D.defineProperty(P,{name:"name"},function(){return this.Xb},function(a){var b=this.Xb;b!==a&&(v&&D.h(a,"string",P,"name"),this.Xb=a,null!==this.Y&&(this.Y.Jl=null),this.i("name",b,a))});
D.defineProperty(P,{opacity:"opacity"},function(){return this.Fc},function(a){var b=this.Fc;b!==a&&(D.h(a,"number",P,"opacity"),(0>a||1<a)&&D.ua(a,"0 <= value <= 1",P,"opacity"),this.Fc=a,this.i("opacity",b,a),a=this.g,b=this.Y,null!==a&&null!==b&&a.qa(sl(b,b.$)))});
D.defineProperty(P,{visible:"visible"},function(){return 0!==(this.T&1)},function(a){var b=0!==(this.T&1);b!==a&&(v&&D.h(a,"boolean",P,"visible"),this.T^=1,this.i("visible",b,a),b=this.Q,null!==b?b.K():this.Jj()&&this.Hd(a),this.qa(),Zo(this))});D.defineProperty(P,{pg:"pickable"},function(){return 0!==(this.T&2)},function(a){var b=0!==(this.T&2);b!==a&&(v&&D.h(a,"boolean",P,"pickable"),this.T^=2,this.i("pickable",b,a))});
D.defineProperty(P,{GI:"fromLinkableDuplicates"},function(){return 0!==(this.T&4)},function(a){var b=0!==(this.T&4);b!==a&&(v&&D.h(a,"boolean",P,"fromLinkableDuplicates"),this.T^=4,this.i("fromLinkableDuplicates",b,a))});D.defineProperty(P,{HI:"fromLinkableSelfNode"},function(){return 0!==(this.T&8)},function(a){var b=0!==(this.T&8);b!==a&&(v&&D.h(a,"boolean",P,"fromLinkableSelfNode"),this.T^=8,this.i("fromLinkableSelfNode",b,a))});
D.defineProperty(P,{rK:"toLinkableDuplicates"},function(){return 0!==(this.T&16)},function(a){var b=0!==(this.T&16);b!==a&&(v&&D.h(a,"boolean",P,"toLinkableDuplicates"),this.T^=16,this.i("toLinkableDuplicates",b,a))});D.defineProperty(P,{sK:"toLinkableSelfNode"},function(){return 0!==(this.T&32)},function(a){var b=0!==(this.T&32);b!==a&&(v&&D.h(a,"boolean",P,"toLinkableSelfNode"),this.T^=32,this.i("toLinkableSelfNode",b,a))});
D.defineProperty(P,{Gf:"isPanelMain"},function(){return 0!==(this.T&64)},function(a){var b=0!==(this.T&64);b!==a&&(v&&D.h(a,"boolean",P,"isPanelMain"),this.T^=64,this.K(),this.i("isPanelMain",b,a))});D.defineProperty(P,{tu:"isActionable"},function(){return 0!==(this.T&128)},function(a){var b=0!==(this.T&128);b!==a&&(v&&D.h(a,"boolean",P,"isActionable"),this.T^=128,this.i("isActionable",b,a))});
D.defineProperty(P,{Zl:"areaBackground"},function(){return this.hc},function(a){var b=this.hc;b!==a&&(v&&null!==a&&D.Yt(a,"GraphObject.areaBackground"),a instanceof Ba&&a.freeze(),this.hc=a,this.qa(),this.i("areaBackground",b,a))});D.defineProperty(P,{background:"background"},function(){return this.Kb},function(a){var b=this.Kb;b!==a&&(v&&null!==a&&D.Yt(a,"GraphObject.background"),a instanceof Ba&&a.freeze(),this.Kb=a,this.qa(),this.i("background",b,a))});function To(a,b){a.T=b?a.T|512:a.T&-513}
function Eo(a){return 0!==(a.T&1024)}function $o(a,b){a.T=b?a.T|1024:a.T&-1025}function Uo(a,b){a.T=b?a.T|2048:a.T&-2049}function Vo(a,b){a.T=b?a.T|4096:a.T&-4097}function Hm(a){return 0!==(a.T&8192)}function em(a,b){a.T=b?a.T|8192:a.T&-8193}function Im(a){return 0!==(a.T&16384)}function Ko(a,b){a.T=b?a.T|16384:a.T&-16385}D.w(P,{Y:"part"},function(){if(this.Jj())return this;if(null!==this.kn)return this.kn;var a;for(a=this.Q;a;){if(a instanceof F)return this.kn=a;a=a.Q}return null});
D.w(P,{Q:"panel"},function(){return this.Bh});P.prototype.ym=function(a){this.Bh=a};D.w(P,{layer:"layer"},function(){var a=this.Y;return null!==a?a.layer:null},{configurable:!0});D.w(P,{g:"diagram"},function(){var a=this.Y;return null!==a?a.g:null},{configurable:!0});
D.defineProperty(P,{position:"position"},function(){return this.qb},function(a){v&&D.l(a,O,P,"position");var b=a.x,c=a.y,d=this.qb,e=d.x,g=d.y;(e===b||isNaN(e)&&isNaN(b))&&(g===c||isNaN(g)&&isNaN(c))?this.GB():(a=a.V(),this.FB(a,d)&&this.i("position",d,a))});P.prototype.GB=function(){};P.prototype.FB=function(a){this.qb=a;Wo(this);this.$i();return!0};P.prototype.Hy=function(a,b){this.qb.m(a,b);this.$i()};D.w(P,{$:"actualBounds"},function(){return this.ac});
D.defineProperty(P,{scale:"scale"},function(){return this.Bb},function(a){var b=this.Bb;b!==a&&(v&&D.p(a,P,"scale"),0>=a&&D.k("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.Bb=a,this.$i(),this.K(),this.i("scale",b,a))});D.defineProperty(P,{angle:"angle"},function(){return this.rg},function(a){var b=this.rg;b!==a&&(v&&D.p(a,P,"angle"),a%=360,0>a&&(a+=360),b!==a&&(this.rg=a,this.K(),this.$i(),this.i("angle",b,a)))});
D.defineProperty(P,{Ea:"desiredSize"},function(){return this.Ye},function(a){v&&D.l(a,Ca,P,"desiredSize");var b=a.width,c=a.height,d=this.Ye,e=d.width,g=d.height;(e===b||isNaN(e)&&isNaN(b))&&(g===c||isNaN(g)&&isNaN(c))||(this.Ye=a=a.V(),this.K(),this instanceof z&&this.Re(),this.i("desiredSize",d,a),Eo(this)&&(a=this.Y,null!==a&&(Fo(this,a,"width"),Fo(this,a,"height"))))});
D.defineProperty(P,{width:"width"},function(){return this.Ye.width},function(a){var b=this.Ye.width;b===a||isNaN(b)&&isNaN(a)||(v&&D.h(a,"number",P,"width"),b=this.Ye,this.Ye=a=(new Ca(a,this.Ye.height)).freeze(),this.K(),this instanceof z&&this.Re(),this.i("desiredSize",b,a),Eo(this)&&(a=this.Y,null!==a&&Fo(this,a,"width")))});
D.defineProperty(P,{height:"height"},function(){return this.Ye.height},function(a){var b=this.Ye.height;b===a||isNaN(b)&&isNaN(a)||(v&&D.h(a,"number",P,"height"),b=this.Ye,this.Ye=a=(new Ca(this.Ye.width,a)).freeze(),this.K(),this instanceof z&&this.Re(),this.i("desiredSize",b,a),Eo(this)&&(a=this.Y,null!==a&&Fo(this,a,"height")))});
D.defineProperty(P,{hg:"minSize"},function(){return this.li},function(a){var b=this.li;b.O(a)||(v&&D.l(a,Ca,P,"minSize"),a=a.copy(),isNaN(a.width)&&(a.width=0),isNaN(a.height)&&(a.height=0),a.freeze(),this.li=a,this.K(),this.i("minSize",b,a))});D.defineProperty(P,{kf:"maxSize"},function(){return this.ki},function(a){var b=this.ki;b.O(a)||(v&&D.l(a,Ca,P,"maxSize"),a=a.copy(),isNaN(a.width)&&(a.width=Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.ki=a,this.K(),this.i("maxSize",b,a))});
D.w(P,{Fa:"measuredBounds"},function(){return this.Ad});D.w(P,{Ga:"naturalBounds"},function(){return this.$c},{configurable:!0});D.defineProperty(P,{margin:"margin"},function(){return this.cn},function(a){"number"===typeof a?a=new Hb(a):v&&D.l(a,Hb,P,"margin");var b=this.cn;b.O(a)||(this.cn=a=a.V(),this.K(),this.i("margin",b,a))});D.w(P,{transform:null},function(){0!==(this.T&2048)===!0&&Ro(this);return this.Hc});D.w(P,{Hh:null},function(){0!==(this.T&4096)===!0&&Ro(this);return this.Li});
D.defineProperty(P,{alignment:"alignment"},function(){return this.re},function(a){var b=this.re;b.O(a)||(v&&D.l(a,R,P,"alignment"),a.Zd()&&!a.ed()&&D.k("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+a),this.re=a=a.V(),Wo(this),this.i("alignment",b,a))});D.defineProperty(P,{column:"column"},function(){return this.qr},function(a){v&&D.p(a,P,"column");a=Math.round(a);var b=this.qr;b!==a&&(0>a&&D.ua(a,">= 0",P,"column"),this.qr=a,this.K(),this.i("column",b,a))});
D.defineProperty(P,{cI:"columnSpan"},function(){return this.Qi},function(a){v&&D.h(a,"number",P,"columnSpan");a=Math.round(a);var b=this.Qi;b!==a&&(1>a&&D.ua(a,">= 1",P,"columnSpan"),this.Qi=a,this.K(),this.i("columnSpan",b,a))});D.defineProperty(P,{Zb:"row"},function(){return this.it},function(a){v&&D.p(a,P,"row");a=Math.round(a);var b=this.it;b!==a&&(0>a&&D.ua(a,">= 0",P,"row"),this.it=a,this.K(),this.i("row",b,a))});
D.defineProperty(P,{rowSpan:"rowSpan"},function(){return this.rj},function(a){v&&D.h(a,"number",P,"rowSpan");a=Math.round(a);var b=this.rj;b!==a&&(1>a&&D.ua(a,">= 1",P,"rowSpan"),this.rj=a,this.K(),this.i("rowSpan",b,a))});D.defineProperty(P,{Iy:"spanAllocation"},function(){return this.yt},function(a){var b=this.yt;b!==a&&(null!==a&&D.h(a,"function",P,"spanAllocation"),this.yt=a,this.K(),this.i("spanAllocation",b,a))});
D.defineProperty(P,{Gh:"alignmentFocus"},function(){return this.Hm},function(a){var b=this.Hm;b.O(a)||(v&&D.l(a,R,P,"alignmentFocus"),!a.Zd()||a.ed()||a.O(bc)&&this instanceof G||D.k("GraphObject.alignmentFocus must be a real Spot or Spot.Default, not: "+a),this.Hm=a=a.V(),this.K(),this.i("alignmentFocus",b,a))});
D.defineProperty(P,{sd:"portId"},function(){return this.Ws},function(a){var b=this.Ws;if(b!==a){v&&null!==a&&D.h(a,"string",P,"portId");var c=this.Y;null===c||c instanceof G||(D.k("Cannot set portID on a Link: "+a),c=null);null!==b&&null!==c&&ap(c,this);this.Ws=a;if(null!==a&&c){c.Uk=!0;null===c.xe&&bp(c);var d=this.sd;null!==d&&c.xe.add(d,this)}this.i("portId",b,a)}});function cp(a){var b=a.Y;if(b instanceof G&&(null!==a.sd||a===b.port)){var c=b.g;null===c||c.ra.nb||No(b,a)}}
function Zo(a){var b=a.g;null===b||b.ra.nb||(a instanceof x?a instanceof G?a.fg():dp(a,a,function(a){cp(a)}):cp(a))}D.defineProperty(P,{Hb:"toSpot"},function(){return null!==this.Z?this.Z.Gk:bc},function(a){this.Wd();var b=this.Z.Gk;b.O(a)||(v&&D.l(a,R,P,"toSpot"),a=a.V(),this.Z.Gk=a,this.i("toSpot",b,a),cp(this))});
D.defineProperty(P,{Dm:"toEndSegmentLength"},function(){return null!==this.Z?this.Z.Ek:10},function(a){this.Wd();var b=this.Z.Ek;b!==a&&(v&&D.h(a,"number",P,"toEndSegmentLength"),0>a&&D.ua(a,">= 0",P,"toEndSegmentLength"),this.Z.Ek=a,this.i("toEndSegmentLength",b,a),cp(this))});
D.defineProperty(P,{fv:"toEndSegmentDirection"},function(){return null!==this.Z?this.Z.Dk:Co},function(a){this.Wd();var b=this.Z.Dk;b!==a&&(D.Nn("GraphObject.toEndSegmentDirection","2.0"),v&&D.Ca(a,G,P,"toEndSegmentDirection"),this.Z.Dk=a,this.i("toEndSegmentDirection",b,a),cp(this))});D.defineProperty(P,{gv:"toShortLength"},function(){return null!==this.Z?this.Z.Fk:0},function(a){this.Wd();var b=this.Z.Fk;b!==a&&(v&&D.h(a,"number",P,"toShortLength"),this.Z.Fk=a,this.i("toShortLength",b,a),cp(this))});
D.defineProperty(P,{$G:"toLinkable"},function(){return null!==this.Z?this.Z.Ht:null},function(a){this.Wd();var b=this.Z.Ht;b!==a&&(v&&null!==a&&D.h(a,"boolean",P,"toLinkable"),this.Z.Ht=a,this.i("toLinkable",b,a))});D.defineProperty(P,{tK:"toMaxLinks"},function(){return null!==this.Z?this.Z.It:Infinity},function(a){this.Wd();var b=this.Z.It;b!==a&&(v&&D.h(a,"number",P,"toMaxLinks"),0>a&&D.ua(a,">= 0",P,"toMaxLinks"),this.Z.It=a,this.i("toMaxLinks",b,a))});
D.defineProperty(P,{Gb:"fromSpot"},function(){return null!==this.Z?this.Z.jk:bc},function(a){this.Wd();var b=this.Z.jk;b.O(a)||(v&&D.l(a,R,P,"fromSpot"),a=a.V(),this.Z.jk=a,this.i("fromSpot",b,a),cp(this))});D.defineProperty(P,{nm:"fromEndSegmentLength"},function(){return null!==this.Z?this.Z.hk:10},function(a){this.Wd();var b=this.Z.hk;b!==a&&(v&&D.h(a,"number",P,"fromEndSegmentLength"),0>a&&D.ua(a,">= 0",P,"fromEndSegmentLength"),this.Z.hk=a,this.i("fromEndSegmentLength",b,a),cp(this))});
D.defineProperty(P,{nu:"fromEndSegmentDirection"},function(){return null!==this.Z?this.Z.gk:Co},function(a){this.Wd();var b=this.Z.gk;b!==a&&(D.Nn("GraphObject.fromEndSegmentDirection","2.0"),v&&D.Ca(a,G,P,"fromEndSegmentDirection"),this.Z.gk=a,this.i("fromEndSegmentDirection",b,a),cp(this))});
D.defineProperty(P,{ou:"fromShortLength"},function(){return null!==this.Z?this.Z.ik:0},function(a){this.Wd();var b=this.Z.ik;b!==a&&(v&&D.h(a,"number",P,"fromShortLength"),this.Z.ik=a,this.i("fromShortLength",b,a),cp(this))});D.defineProperty(P,{sF:"fromLinkable"},function(){return null!==this.Z?this.Z.Tr:null},function(a){this.Wd();var b=this.Z.Tr;b!==a&&(v&&null!==a&&D.h(a,"boolean",P,"fromLinkable"),this.Z.Tr=a,this.i("fromLinkable",b,a))});
D.defineProperty(P,{MA:"fromMaxLinks"},function(){return null!==this.Z?this.Z.Ur:Infinity},function(a){this.Wd();var b=this.Z.Ur;b!==a&&(v&&D.h(a,"number",P,"fromMaxLinks"),0>a&&D.ua(a,">= 0",P,"fromMaxLinks"),this.Z.Ur=a,this.i("fromMaxLinks",b,a))});D.defineProperty(P,{cursor:"cursor"},function(){return this.zr},function(a){var b=this.zr;b!==a&&(D.h(a,"string",P,"cursor"),this.zr=a,this.i("cursor",b,a))});
D.defineProperty(P,{click:"click"},function(){return null!==this.la?this.la.Pi:null},function(a){zo(this);var b=this.la.Pi;b!==a&&(null!==a&&D.h(a,"function",P,"click"),this.la.Pi=a,this.i("click",b,a))});D.defineProperty(P,{du:"doubleClick"},function(){return null!==this.la?this.la.Wi:null},function(a){zo(this);var b=this.la.Wi;b!==a&&(null!==a&&D.h(a,"function",P,"doubleClick"),this.la.Wi=a,this.i("doubleClick",b,a))});
D.defineProperty(P,{uA:"contextClick"},function(){return null!==this.la?this.la.Ri:null},function(a){zo(this);var b=this.la.Ri;b!==a&&(null!==a&&D.h(a,"function",P,"contextClick"),this.la.Ri=a,this.i("contextClick",b,a))});D.defineProperty(P,{Iu:"mouseEnter"},function(){return null!==this.la?this.la.Hs:null},function(a){zo(this);var b=this.la.Hs;b!==a&&(null!==a&&D.h(a,"function",P,"mouseEnter"),this.la.Hs=a,this.i("mouseEnter",b,a))});
D.defineProperty(P,{Ju:"mouseLeave"},function(){return null!==this.la?this.la.Is:null},function(a){zo(this);var b=this.la.Is;b!==a&&(null!==a&&D.h(a,"function",P,"mouseLeave"),this.la.Is=a,this.i("mouseLeave",b,a))});D.defineProperty(P,{kB:"mouseOver"},function(){return null!==this.la?this.la.lj:null},function(a){zo(this);var b=this.la.lj;b!==a&&(null!==a&&D.h(a,"function",P,"mouseOver"),this.la.lj=a,this.i("mouseOver",b,a))});
D.defineProperty(P,{jB:"mouseHover"},function(){return null!==this.la?this.la.kj:null},function(a){zo(this);var b=this.la.kj;b!==a&&(null!==a&&D.h(a,"function",P,"mouseHover"),this.la.kj=a,this.i("mouseHover",b,a))});D.defineProperty(P,{iB:"mouseHold"},function(){return null!==this.la?this.la.jj:null},function(a){zo(this);var b=this.la.jj;b!==a&&(null!==a&&D.h(a,"function",P,"mouseHold"),this.la.jj=a,this.i("mouseHold",b,a))});
D.defineProperty(P,{IJ:"mouseDragEnter"},function(){return null!==this.la?this.la.Fs:null},function(a){zo(this);var b=this.la.Fs;b!==a&&(null!==a&&D.h(a,"function",P,"mouseDragEnter"),this.la.Fs=a,this.i("mouseDragEnter",b,a))});D.defineProperty(P,{JJ:"mouseDragLeave"},function(){return null!==this.la?this.la.Gs:null},function(a){zo(this);var b=this.la.Gs;b!==a&&(null!==a&&D.h(a,"function",P,"mouseDragLeave"),this.la.Gs=a,this.i("mouseDragLeave",b,a))});
D.defineProperty(P,{hB:"mouseDrop"},function(){return null!==this.la?this.la.ij:null},function(a){zo(this);var b=this.la.ij;b!==a&&(null!==a&&D.h(a,"function",P,"mouseDrop"),this.la.ij=a,this.i("mouseDrop",b,a))});D.defineProperty(P,{yE:"actionDown"},function(){return null!==this.la?this.la.Zq:null},function(a){zo(this);var b=this.la.Zq;b!==a&&(null!==a&&D.h(a,"function",P,"actionDown"),this.la.Zq=a,this.i("actionDown",b,a))});
D.defineProperty(P,{zE:"actionMove"},function(){return null!==this.la?this.la.$q:null},function(a){zo(this);var b=this.la.$q;b!==a&&(null!==a&&D.h(a,"function",P,"actionMove"),this.la.$q=a,this.i("actionMove",b,a))});D.defineProperty(P,{AE:"actionUp"},function(){return null!==this.la?this.la.ar:null},function(a){zo(this);var b=this.la.ar;b!==a&&(null!==a&&D.h(a,"function",P,"actionUp"),this.la.ar=a,this.i("actionUp",b,a))});
D.defineProperty(P,{xE:"actionCancel"},function(){return null!==this.la?this.la.Yq:null},function(a){zo(this);var b=this.la.Yq;b!==a&&(null!==a&&D.h(a,"function",P,"actionCancel"),this.la.Yq=a,this.i("actionCancel",b,a))});D.defineProperty(P,{PB:"toolTip"},function(){return null!==this.la?this.la.uj:null},function(a){zo(this);var b=this.la.uj;b!==a&&(!v||null===a||a instanceof da||a instanceof ak||D.k("GraphObject.toolTip must be an Adornment or HTMLInfo."),this.la.uj=a,this.i("toolTip",b,a))});
D.defineProperty(P,{contextMenu:"contextMenu"},function(){return null!==this.la?this.la.Si:null},function(a){zo(this);var b=this.la.Si;b!==a&&(!v||a instanceof da||a instanceof ak||D.k("GraphObject.contextMenu must be an Adornment or HTMLInfo."),this.la.Si=a,this.i("contextMenu",b,a))});P.prototype.bind=P.prototype.bind=function(a){a.Og=this;var b=this.lm();null!==b&&ep(b)&&D.k("Cannot add a Binding to a template that has already been copied: "+a);null===this.Bc&&(this.Bc=new K(ih));this.Bc.add(a)};
P.prototype.findTemplateBinder=P.prototype.lm=function(){for(var a=this instanceof x?this:this.Q;null!==a;){if(null!==a.pl)return a;a=a.Q}return null};P.prototype.setProperties=function(a){D.Zu(this,a)};var fp;
P.make=fp=function(a,b){var c=arguments,d=null,e=null;if("function"===typeof a)e=a;else if("string"===typeof a){var g=gp.oa(a);"function"===typeof g?(c=D.cm(arguments),d=g(c),D.Ta(d)||D.k('GraphObject.make invoked object builder "'+a+'", but it did not return an Object')):e=aa[a]}null===d&&(void 0!==e&&null!==e&&e.constructor||D.k("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: "+a),d=new e);g=1;if(d instanceof E&&1<c.length){var h=d,e=c[1];if("string"===
typeof e||e instanceof HTMLDivElement)Il(h,e),g++}for(;g<c.length;g++)e=c[g],void 0===e?D.k("Undefined value at argument "+g+" for object being constructed by GraphObject.make: "+d):hp(d,e);return d};
function hp(a,b){if("string"===typeof b)if(a instanceof na)a.text=b;else if(a instanceof z)a.Jb=b;else if(a instanceof Cl)a.source=b;else if(a instanceof x){var c=Ha(x,b);null!==c?a.type=c:D.k("Unknown Panel type as an argument to GraphObject.make: "+b)}else a instanceof Ba?(c=Ha(Ba,b),null!==c?a.type=c:D.k("Unknown Brush type as an argument to GraphObject.make: "+b)):a instanceof bf?(c=Ha(bf,b),null!==c?a.type=c:D.k("Unknown Geometry type as an argument to GraphObject.make: "+b)):a instanceof Xf?
(c=Ha(Xf,b),null!==c?a.type=c:D.k("Unknown PathSegment type as an argument to GraphObject.make: "+b)):D.k("Unable to use a string as an argument to GraphObject.make: "+b);else if(b instanceof P)c=b,a instanceof x||D.k("A GraphObject can only be added to a Panel, not to: "+a),a.add(c);else if(b instanceof ch){var d=b,c=a,e;d.Ie&&c.getRowDefinition?e=c.getRowDefinition(d.index):!d.Ie&&c.getColumnDefinition?e=c.getColumnDefinition(d.index):D.k("A RowColumnDefinition can only be added to a Panel, not to: "+
a);e.gq(d)}else if(b instanceof za)"function"===typeof a.nc?a.nc(b):D.Xj(a,b);else if(b instanceof ih)a instanceof P?a.bind(b):a instanceof ch?a.bind(b):D.k("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+a);else if(b instanceof df)a instanceof bf?a.kc.add(b):D.k("A PathFigure can only be added to a Geometry, not to: "+a);else if(b instanceof Xf)a instanceof df?a.Db.add(b):D.k("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof Tg)a instanceof
E?a.Vb=b:a instanceof I?a.Vb=b:D.k("A Layout can only be assigned to a Diagram or a Group, not to: "+a);else if(Array.isArray(b))for(c=0;c<b.length;c++)hp(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof Ba){e=new la;for(c in b)d=parseFloat(c),isNaN(d)?e[c]=b[c]:a.addColorStop(d,b[c]);D.Zu(a,e)}else if(a instanceof ch){void 0!==b.row?(e=b.row,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&D.k("Must specify non-negative integer row for RowColumnDefinition "+b+", not: "+e),a.Ie=!0,
a.index=e):void 0!==b.column&&(e=b.column,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&D.k("Must specify non-negative integer column for RowColumnDefinition "+b+", not: "+e),a.Ie=!1,a.index=e);e=new la;for(c in b)"row"!==c&&"column"!==c&&(e[c]=b[c]);D.Zu(a,e)}else D.Zu(a,b);else D.k('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+a)}var gp=new ma("string","function");
P.getBuilders=function(){var a=new ma("string","function"),b;for(b in gp)if(b!==b.toLowerCase()){var c=gp[b];"function"===typeof c&&a.add(b,c)}a.freeze();return a};var ip;P.defineBuilder=ip=function(a,b){D.h(a,"string",P,"defineBuilder:name");D.h(b,"function",P,"defineBuilder:func");var c=a.toLowerCase();""!==a&&"none"!==c&&a!==c||D.k("Shape.defineFigureGenerator name must not be empty or None or all-lower-case: "+a);gp.add(a,b)};var jp;
P.takeBuilderArgument=jp=function(a,b,c){void 0===c&&(c=null);var d=a[1];if("function"===typeof c?c(d):"string"===typeof d)return a.splice(1,1),d;if(void 0===b)throw Error("no "+("function"===typeof c?"satisfactory":"string")+" argument for GraphObject builder "+a[0]);return b};
ip("Button",function(){var a=new Ba(Qg);a.addColorStop(0,"white");a.addColorStop(1,"lightgray");var b=new Ba(Qg);b.addColorStop(0,"white");b.addColorStop(1,"dodgerblue");a=fp(x,Kl,{tu:!0,iF:function(a,b){var e=a.Ed("ButtonBorder");null!==e&&(e.fill=b?a._buttonFillNormal:a._buttonFillDisabled)},_buttonFillNormal:a,_buttonStrokeNormal:"gray",_buttonFillOver:b,_buttonStrokeOver:"blue",_buttonFillDisabled:"darkgray"},fp(z,{name:"ButtonBorder",Jb:"Rectangle",C:new R(0,0,2.761423749153968,2.761423749153968),
D:new R(1,1,-2.761423749153968,-2.761423749153968),fill:a,stroke:"gray"}));a.Iu=function(a,b){if(b.vu()){var e=b.Ed("ButtonBorder");if(e instanceof z){var g=b._buttonFillOver;b._buttonFillNormal=e.fill;e.fill=g;g=b._buttonStrokeOver;b._buttonStrokeNormal=e.stroke;e.stroke=g}}};a.Ju=function(a,b){if(b.vu()){var e=b.Ed("ButtonBorder");e instanceof z&&(e.fill=b._buttonFillNormal,e.stroke=b._buttonStrokeNormal)}};return a});
ip("TreeExpanderButton",function(){var a=fp("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},fp(z,{name:"ButtonIcon",Jb:"MinusLine",Ea:ae},(new ih("figure","isTreeExpanded",function(a,c){var d=c.Q;return a?d._treeExpandedFigure:d._treeCollapsedFigure})).ly()),{visible:!1},(new ih("visible","isTreeLeaf",function(a){return!a})).ly());a.click=function(a,c){var d=c.Y;d instanceof da&&(d=d.Zf);if(d instanceof G){var e=d.g;if(null!==e){e=e.wb;if(d.rd){if(!e.canCollapseTree(d))return}else if(!e.canExpandTree(d))return;
a.Lc=!0;d.rd?e.collapseTree(d):e.expandTree(d)}}};return a});
ip("SubGraphExpanderButton",function(){var a=fp("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},fp(z,{name:"ButtonIcon",Jb:"MinusLine",Ea:ae},(new ih("figure","isSubGraphExpanded",function(a,c){var d=c.Q;return a?d._subGraphExpandedFigure:d._subGraphCollapsedFigure})).ly()));a.click=function(a,c){var d=c.Y;d instanceof da&&(d=d.Zf);if(d instanceof I){var e=d.g;if(null!==e){e=e.wb;if(d.Je){if(!e.canCollapseSubGraph(d))return}else if(!e.canExpandSubGraph(d))return;a.Lc=
!0;d.Je?e.collapseSubGraph(d):e.expandSubGraph(d)}}};return a});ip("ContextMenuButton",function(){var a=fp("Button");a.stretch=vo;var b=a.Ed("ButtonBorder");b instanceof z&&(b.Jb="Rectangle",b.C=new R(0,0,2,3),b.D=new R(1,1,-2,-2));return a});
ip("PanelExpanderButton",function(a){var b=jp(a,"COLLAPSIBLE"),c=fp("Button",{_buttonExpandedFigure:"TriangleUp",_buttonCollapsedFigure:"TriangleDown"},fp(z,"TriangleUp",{name:"ButtonIcon",Ea:new Ca(6,4)},(new ih("figure","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).ly(b)));a=c.Ed("ButtonBorder");a instanceof z&&(a.stroke=null,a.fill="transparent");c.click=function(a,c){var g=c.g;if(null!==g&&!g.mb){var h=c.lm();null===h&&(h=c.Y);null!==h&&(h=h.Ed(b),null!==h&&
(g.$b("Collapse/Expand Panel"),h.visible=!h.visible,g.Td("Collapse/Expand Panel")))}};return c});
ip("CheckBoxButton",function(a){var b=jp(a);a=fp("Button",{"ButtonBorder.fill":"white","ButtonBorder.stroke":"gray",width:14,height:14},fp(z,{name:"ButtonIcon",II:"M0 4 L3 9 9 0",jb:2,stretch:rf,NA:Uj,visible:!1},""!==b?(new ih("visible",b)).xJ():[]));a.click=function(a,d){var e=a.g;if(!(null===e||e.mb||""!==b&&e.ga.mb)){a.Lc=!0;var g=d.Ed("ButtonIcon");e.$b("checkbox");g.visible=!g.visible;"function"===typeof d._doClick&&d._doClick(a,d);e.Td("checkbox")}};return a});
ip("CheckBox",function(a){a=jp(a);a=fp("CheckBoxButton",a,{name:"Button",margin:new Hb(0,1,0,0)});var b=fp(x,"Horizontal",a,{tu:!0,margin:1,_buttonFillNormal:a._buttonFillNormal,_buttonStrokeNormal:a._buttonStrokeNormal,_buttonFillOver:a._buttonFillOver,_buttonStrokeOver:a._buttonStrokeOver,_buttonFillDisabled:a._buttonFillDisabled,Iu:a.Iu,Ju:a.Ju,click:a.click,_buttonClick:a.click});a.Iu=null;a.Ju=null;a.click=null;return b});
function Ao(){this.Qr=this.Si=this.uj=this.Yq=this.ar=this.$q=this.Zq=this.ij=this.Gs=this.Fs=this.jj=this.kj=this.lj=this.Is=this.Hs=this.Ri=this.Wi=this.Pi=null}Ao.prototype.copy=function(){var a=new Ao;a.Pi=this.Pi;a.Wi=this.Wi;a.Ri=this.Ri;a.Hs=this.Hs;a.Is=this.Is;a.lj=this.lj;a.kj=this.kj;a.jj=this.jj;a.Fs=this.Fs;a.Gs=this.Gs;a.ij=this.ij;a.Zq=this.Zq;a.$q=this.$q;a.ar=this.ar;a.Yq=this.Yq;a.uj=this.uj;a.Si=this.Si;a.Qr=this.Qr;return a};
function x(a){P.call(this);void 0===a?this.ca=Xj:(D.Ca(a,x,x,"type"),this.ca=a);this.xa=new K(P);this.of=Ud;this.ca===Nl&&(this.Yn=!0);this.Dr=Tc;this.Vi=to;this.ca===ea&&kp(this);this.Xp=Uj;this.as=ce;this.bs=Gd;this.Yr=0;this.Xr=100;this.$r=10;this.Zr=0;this.pl=this.Nd=this.kk=this.Pm=this.Rm=null;this.ns=NaN;this.Eg=this.cj=null;this.qp="category";this.Dg=null;this.wj=new B(NaN,NaN,NaN,NaN);this.Ck=this.jt=this.wn=null;this.$j=""}D.Sa(x,P);D.Ai(x);D.ja("Panel",x);
function kp(a){a.dk=Ud;a.bi=1;a.Ui=null;a.Mm=null;a.ai=1;a.$h=null;a.Lm=null;a.he=[];a.de=[];a.nn=lp;a.Km=lp;a.vj=0;a.fj=0}
x.prototype.cloneProtected=function(a){P.prototype.cloneProtected.call(this,a);a.ca=this.ca;a.of=this.of.V();a.Dr=this.Dr.V();a.Vi=this.Vi;if(a.ca===ea){a.dk=this.dk.V();a.bi=this.bi;a.Ui=this.Ui;a.Mm=this.Mm;a.ai=this.ai;a.$h=this.$h;a.Lm=this.Lm;var b=[];if(0<this.he.length)for(var c=this.he,d=c.length,e=0;e<d;e++)if(void 0!==c[e]){var g=c[e].copy();g.ym(a);b[e]=g}a.he=b;b=[];if(0<this.de.length)for(c=this.de,d=c.length,e=0;e<d;e++)void 0!==c[e]&&(g=c[e].copy(),g.ym(a),b[e]=g);a.de=b;a.nn=this.nn;
a.Km=this.Km;a.vj=this.vj;a.fj=this.fj}a.Xp=this.Xp;a.as=this.as.V();a.bs=this.bs.V();a.Yr=this.Yr;a.Xr=this.Xr;a.$r=this.$r;a.Zr=this.Zr;a.Rm=this.Rm;a.kk=this.kk;a.Nd=this.Nd;a.pl=this.pl;a.ns=this.ns;a.cj=this.cj;a.Eg=this.Eg;a.qp=this.qp;a.wj.assign(this.wj);a.$j=this.$j;null!==this.jt&&(a.jt=this.jt)};x.prototype.Bi=function(a){P.prototype.Bi.call(this,a);a.xa=this.xa;for(var b=a.xa.o,c=b.length,d=0;d<c;d++)b[d].Bh=a;a.wn=null};
x.prototype.copy=function(){var a=P.prototype.copy.call(this);if(null!==a){for(var b=this.xa.o,c=b.length,d=0;d<c;d++){var e=b[d].copy(),g=a;e.ym(g);e.kn=null;var h=g.xa,k=h.count;h.Xd(k,e);h=g.Y;if(null!==h){h.Jl=null;null!==e.sd&&h instanceof G&&(h.Uk=!0);var l=g.g;null!==l&&l.ra.nb||h.hd(mg,"elements",g,null,e,null,k)}}return a}return null};x.prototype.nc=function(a){a.Ne===x?this.type=a:P.prototype.nc.call(this,a)};x.prototype.toString=function(){return"Panel("+this.type+")#"+D.Fd(this)};var Xj;
x.Position=Xj=D.s(x,"Position",0);x.Horizontal=D.s(x,"Horizontal",1);var Jl;x.Vertical=Jl=D.s(x,"Vertical",2);var Qj;x.Spot=Qj=D.s(x,"Spot",3);var Kl;x.Auto=Kl=D.s(x,"Auto",4);var ea;x.Table=ea=D.s(x,"Table",5);x.Viewbox=D.s(x,"Viewbox",6);var Oo;x.TableRow=Oo=D.s(x,"TableRow",7);var Po;x.TableColumn=Po=D.s(x,"TableColumn",8);var kj;x.Link=kj=D.s(x,"Link",9);var Nl;x.Grid=Nl=D.s(x,"Grid",10);var mp;x.Graduated=mp=D.s(x,"Graduated",11);
D.defineProperty(x,{type:"type"},function(){return this.ca},function(a){var b=this.ca;b!==a&&(v&&D.Ca(a,x,x,"type"),b!==Oo&&b!==Po||D.k("Cannot change Panel.type when it is already a TableRow or a TableColumn: "+a),this.ca=a,this.ca===Nl?this.Yn=!0:this.ca===ea&&kp(this),this.K(),this.i("type",b,a))});D.w(x,{elements:"elements"},function(){return this.xa.j});D.w(x,{Ga:"naturalBounds"},function(){return this.$c});
D.defineProperty(x,{padding:"padding"},function(){return this.of},function(a){"number"===typeof a?(0>a&&D.ua(a,">= 0",x,"padding"),a=new Hb(a)):(D.l(a,Hb,x,"padding"),0>a.left&&D.ua(a.left,">= 0",x,"padding:value.left"),0>a.right&&D.ua(a.right,">= 0",x,"padding:value.right"),0>a.top&&D.ua(a.top,">= 0",x,"padding:value.top"),0>a.bottom&&D.ua(a.bottom,">= 0",x,"padding:value.bottom"));var b=this.of;b.O(a)||(this.of=a=a.V(),this.K(),this.i("padding",b,a))});
D.defineProperty(x,{gm:"defaultAlignment"},function(){return this.Dr},function(a){var b=this.Dr;b.O(a)||(v&&D.l(a,R,x,"defaultAlignment"),this.Dr=a=a.V(),this.K(),this.i("defaultAlignment",b,a))});D.defineProperty(x,{je:"defaultStretch"},function(){return this.Vi},function(a){var b=this.Vi;b!==a&&(D.Ca(a,P,x,"defaultStretch"),this.Vi=a,this.K(),this.i("defaultStretch",b,a))});
D.defineProperty(x,{qL:"defaultSeparatorPadding"},function(){return void 0===this.dk?Ud:this.dk},function(a){if(void 0!==this.dk){"number"===typeof a?a=new Hb(a):v&&D.l(a,Hb,x,"defaultSeparatorPadding");var b=this.dk;b.O(a)||(this.dk=a=a.V(),this.K(),this.i("defaultSeparatorPadding",b,a))}});
D.defineProperty(x,{oL:"defaultRowSeparatorStroke"},function(){return void 0===this.Ui?null:this.Ui},function(a){var b=this.Ui;b!==a&&(null===a||"string"===typeof a||a instanceof Ba)&&(a instanceof Ba&&a.freeze(),this.Ui=a,this.qa(),this.i("defaultRowSeparatorStroke",b,a))});
D.defineProperty(x,{pL:"defaultRowSeparatorStrokeWidth"},function(){return void 0===this.bi?1:this.bi},function(a){if(void 0!==this.bi){var b=this.bi;b!==a&&isFinite(a)&&0<=a&&(this.bi=a,this.K(),this.i("defaultRowSeparatorStrokeWidth",b,a))}});
D.defineProperty(x,{nL:"defaultRowSeparatorDashArray"},function(){return void 0===this.Mm?null:this.Mm},function(a){if(void 0!==this.Mm){var b=this.Mm;if(b!==a){null===a||Array.isArray(a)||D.gc(a,"Array",x,"defaultRowSeparatorDashArray:value");if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var g=a[e];"number"===typeof g&&0<=g&&isFinite(g)||D.k("defaultRowSeparatorDashArray value "+g+" at index "+e+" must be a positive number or zero.");d+=g}if(0===d){if(null===b)return;a=null}}this.Mm=a;this.qa();
this.i("defaultRowSeparatorDashArray",b,a)}}});D.defineProperty(x,{iL:"defaultColumnSeparatorStroke"},function(){return void 0===this.$h?null:this.$h},function(a){if(void 0!==this.$h){var b=this.$h;b!==a&&(null===a||"string"===typeof a||a instanceof Ba)&&(a instanceof Ba&&a.freeze(),this.$h=a,this.qa(),this.i("defaultColumnSeparatorStroke",b,a))}});
D.defineProperty(x,{jL:"defaultColumnSeparatorStrokeWidth"},function(){return void 0===this.ai?1:this.ai},function(a){if(void 0!==this.ai){var b=this.ai;b!==a&&isFinite(a)&&0<=a&&(this.ai=a,this.K(),this.i("defaultColumnSeparatorStrokeWidth",b,a))}});
D.defineProperty(x,{hL:"defaultColumnSeparatorDashArray"},function(){return void 0===this.Lm?null:this.Lm},function(a){if(void 0!==this.Lm){var b=this.Lm;if(b!==a){null===a||Array.isArray(a)||D.gc(a,"Array",x,"defaultColumnSeparatorDashArray:value");if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var g=a[e];"number"===typeof g&&0<=g&&isFinite(g)||D.k("defaultColumnSeparatorDashArray value "+g+" at index "+e+" must be a positive number or zero.");d+=g}if(0===d){if(null===b)return;a=null}}this.Lm=
a;this.qa();this.i("defaultColumnSeparatorDashArray",b,a)}}});D.defineProperty(x,{GM:"viewboxStretch"},function(){return this.Xp},function(a){var b=this.Xp;b!==a&&(D.Ca(a,P,x,"viewboxStretch"),this.Xp=a,this.K(),this.i("viewboxStretch",b,a))});
D.defineProperty(x,{Ox:"gridCellSize"},function(){return this.as},function(a){var b=this.as;if(!b.O(a)){D.l(a,Ca,x,"gridCellSize");a.F()&&0!==a.width&&0!==a.height||D.k("Invalid Panel.gridCellSize: "+a);this.as=a.V();var c=this.g;null!==c&&this===c.Vn&&fm(c);this.qa();this.i("gridCellSize",b,a)}});
D.defineProperty(x,{BF:"gridOrigin"},function(){return this.bs},function(a){var b=this.bs;if(!b.O(a)){D.l(a,O,x,"gridOrigin");a.F()||D.k("Invalid Panel.gridOrigin: "+a);this.bs=a.V();var c=this.g;null!==c&&this===c.Vn&&fm(c);this.qa();this.i("gridOrigin",b,a)}});D.defineProperty(x,{Tk:"graduatedMin"},function(){return this.Yr},function(a){D.p(a,x,"graduatedMin");var b=this.Yr;b!==a&&(this.Yr=a,this.K(),this.i("graduatedMin",b,a),Eo(this)&&(a=this.Y,null!==a&&Fo(this,a,"graduatedRange")))});
D.defineProperty(x,{QA:"graduatedMax"},function(){return this.Xr},function(a){D.p(a,x,"graduatedMax");var b=this.Xr;b!==a&&(this.Xr=a,this.K(),this.i("graduatedMax",b,a),Eo(this)&&(a=this.Y,null!==a&&Fo(this,a,"graduatedRange")))});D.w(x,{Nx:"graduatedRange"},function(){return this.QA-this.Tk});D.defineProperty(x,{RA:"graduatedTickUnit"},function(){return this.$r},function(a){D.p(a,x,"graduatedTickUnit");var b=this.$r;b!==a&&0<a&&(this.$r=a,this.K(),this.i("graduatedTickUnit",b,a))});
D.defineProperty(x,{AF:"graduatedTickBase"},function(){return this.Zr},function(a){D.p(a,x,"graduatedTickBase");var b=this.Zr;b!==a&&(this.Zr=a,this.K(),this.i("graduatedTickBase",b,a))});f=x.prototype;f.yw=function(a){P.prototype.yw.call(this,a);for(var b=this.xa.o,c=b.length,d=0;d<c;d++)b[d].yw(a)};
f.Pk=function(a,b){if(this.ca===Nl){var c=this.Fj()*b.scale;0>=c&&(c=1);var d=this.Ox,e=d.width,d=d.height,g=this.Ga,h=g.width,g=g.height,k=Math.ceil(h/e),l=Math.ceil(g/d),m=this.BF;a.save();a.beginPath();a.rect(0,0,h,g);a.clip();for(var n=[],p=this.xa.o,q=p.length,r=0;r<q;r++){var s=p[r],u=[];n.push(u);if(s.visible)for(var s=bn(s.Jb),t=r+1;t<q;t++){var y=p[t];y.visible&&bn(y.Jb)===s&&(y=y.interval,2<=y&&u.push(y))}}p=this.xa.o;q=p.length;for(r=0;r<q;r++){var w=p[r];if(w.visible&&(u=w.interval,!(2>
e*u*c))){var s=n[r],t=!1,C=!0,A=w.WG;null!==A&&(t=!0,C=a.GA(A,w.Af));if("LineV"===w.Jb){a.lineWidth=w.jb;So(this,a,w.stroke,!1,!1);a.beginPath();for(var N=y=Math.floor(-m.x/e);N<=y+k;N++){var H=N*e+m.x;0<=H&&H<h&&Jp(N,u,s)&&(t&&!C?Do(a,H,0,H,g,A,w.Af):(a.moveTo(H,0),a.lineTo(H,g)))}a.stroke()}else if("LineH"===w.Jb){a.lineWidth=w.jb;So(this,a,w.stroke,!1,!1);a.beginPath();for(N=y=Math.floor(-m.y/d);N<=y+l;N++)H=N*d+m.y,0<=H&&H<=g&&Jp(N,u,s)&&(t&&!C?Do(a,0,H,h,H,A,w.Af):(a.moveTo(0,H),a.lineTo(h,H)));
a.stroke()}else if("BarV"===w.Jb)for(So(this,a,w.fill,!0,!1),w=w.width,isNaN(w)&&(w=e),N=y=Math.floor(-m.x/e);N<=y+k;N++)H=N*e+m.x,0<=H&&H<h&&Jp(N,u,s)&&a.fillRect(H,0,w,g);else if("BarH"===w.Jb)for(So(this,a,w.fill,!0,!1),w=w.height,isNaN(w)&&(w=d),N=y=Math.floor(-m.y/d);N<=y+l;N++)H=N*d+m.y,0<=H&&H<=g&&Jp(N,u,s)&&a.fillRect(0,H,h,w);t&&a.BA()}}a.restore();a.Be(!1)}else if(this.ca===mp){e=this.Ga;c=e.width;e=e.height;a.save();a.beginPath();a.rect(-1,-1,c+1,e+1);a.clip();c=this.Vd();c.Ee(a,b);e=this.Fj()*
b.scale;0>=e&&(e=1);d=c.$;h=this.xa.o;g=this.Rm;k=h.length;for(l=0;l<k;l++)if(q=h[l],m=g[l],n=m.length,q.visible&&q!==c&&0!==m.length)if(q instanceof z){if(!(2>this.RA*q.interval*e))for(r=q.Fa,u=q.jb*q.scale,s=q.Gh,s.Zd()&&(s=dc),p=0;p<n;p++){var t=q,y=m[p][0],N=d,w=m[p][1],C=r,A=u,H=s,W=t.Hc;W.reset();W.translate(y.x+N.x,y.y+N.y);W.rotate(w+t.angle,0,0);W.translate(-C.width*H.x+H.offsetX+A/2,-C.height*H.y+H.offsetY+A/2);W.scale(t.scale,t.scale);Uo(t,!1);t.Li.set(t.Hc);t.Xo=t.scale;Vo(t,!1);q.Ee(a,
b);q.Hc.reset()}}else if(q instanceof na)for(null===this.Ck&&(this.Ck=new na),r=this.Ck,Kp(q,r),p=0;p<n;p++)y=m[p],3<y.length&&(s=y[6],r.Sd=y[2],r.rg=y[3],r.ue=y[4],r.gi=y[5],r.$c=y[8],r.oc(s.x,s.y,s.width,s.height),q=r,u=d,t=y[7],y=y[8],N=q.Hc,N.reset(),N.translate(s.x+u.x,s.y+u.y),N.translate(-t.x,-t.y),Ho(q,N,y.x,y.y,y.width,y.height),Uo(q,!1),q.Li.set(q.Hc),q.Xo=q.scale,Vo(q,!1),r.Ee(a,b));a.restore();a.Be(!0)}else{this.ca===ea&&(a.lineCap="butt",Lp(this,a,!0,this.he,!0),Lp(this,a,!1,this.de,
!0),Mp(this,a,!0,this.he),Mp(this,a,!1,this.de),Lp(this,a,!0,this.he,!1),Lp(this,a,!1,this.de,!1));if(c=this.yq)a.save(),v&&this.type!==Qj&&D.trace("Warning: Panel.isClipping set on non-Spot Panel: "+this.toString());e=this.Vd();d=this.xa.o;h=d.length;for(g=0;g<h;g++)k=d[g],c&&k===e&&(a.eq=!0),k.Ee(a,b),c&&k===e&&(a.eq=!1);c&&(a.restore(),a.Be(!0));v&&v.AI&&this instanceof J&&v.zI(a,b,this)}};
function Kp(a,b){b.T=a.T|6144;b.Fc=a.Fc;b.Kb=a.Kb;b.hc=a.hc;b.Ye=a.Ye.V();b.li=a.li.V();b.ki=a.ki.V();b.gj=a.gj.copy();b.Bb=a.Bb;b.rg=a.rg;b.Mg=a.Mg;b.cn=a.cn.V();b.re=a.re.V();b.Hm=a.Hm.V();b.on=a.on;b.pn=a.pn.V();b.qn=a.qn;null!==a.ug&&(b.ug=a.ug.copy());b.un=a.un;a instanceof na&&(b.Sd=a.Sd,b.xc=a.xc,b.xg=a.xg,b.Pl=a.Pl,b.wg=a.wg,b.Tl=a.Tl,b.Vm=a.Vm,b.qk=a.qk,b.pk=a.pk,b.nj=a.nj,b.Ik=a.Ik,b.Om=null,b.si=a.si,b.ti=a.ti,b.vh=a.vh,b.tp=a.tp,b.Bg=a.Bg,b.Ag=a.Ag,b.zg=a.zg,b.Qm=a.Qm)}
function Mp(a,b,c,d){for(var e=d.length,g=a.$,h=c?a.me(0):a.le(0),k=0;k<e;k++){var l=d[k];if(void 0!==l&&l!==h&&0!==l.Qa){if(c){if(l.position>g.height)continue}else if(l.position>g.width)continue;var m=l.Qq;isNaN(m)&&(m=c?a.bi:a.ai);var n=l.Pq;null===n&&(n=c?a.Ui:a.$h);0!==m&&null!==n&&(So(a,b,n,!1,!1),b.beginPath(),n=l.position+m,c?n>g.height&&(m-=n-g.height):n>g.width&&(m-=n-g.width),l=l.position+m/2,b.lineWidth=m,n=a.padding,c?(l+=n.top,m=n.left,n=g.width-n.right,b.moveTo(m,l),b.lineTo(n,l)):(l+=
n.left,m=n.top,n=g.height-n.bottom,b.moveTo(l,m),b.lineTo(l,n)),b.stroke())}}}
function Lp(a,b,c,d,e){for(var g=d.length,h=a.$,k=0;k<g;k++){var l=d[k];if(void 0!==l&&null!==l.background&&l.zA!==e&&0!==l.Qa){var m=c?h.height:h.width;if(!(l.position>m)){var n=l.ff(),p=l.Qq;isNaN(p)&&(p=c?a.bi:a.ai);var q=l.Pq;null===q&&(q=c?a.Ui:a.$h);null===q&&(p=0);n-=p;p=l.position+p;n+=l.Qa;p+n>m&&(n=m-p);0>=n||(m=a.padding,So(a,b,l.background,!0,!1),c?b.fillRect(m.left,p+m.top,h.width-(m.left+m.right),n):b.fillRect(p+m.left,m.top,n,h.height-(m.top+m.bottom)))}}}}
function Jp(a,b,c){if(0!==a%b)return!1;b=c.length;for(var d=0;d<b;d++)if(0===a%c[d])return!1;return!0}function bn(a){return"LineV"===a||"BarV"===a}
f.Tn=function(a,b,c,d,e){var g=this.kh(),h=this.transform,k=1/(h.m11*h.m22-h.m12*h.m21),l=h.m22*k,m=-h.m12*k,n=-h.m21*k,p=h.m11*k,q=k*(h.m21*h.dy-h.m22*h.dx),r=k*(h.m12*h.dx-h.m11*h.dy);if(null!==this.Zl)return h=this.$,Ne(h.left,h.top,h.right,h.bottom,a,b,c,d,e);if(null!==this.background)g=a*l+b*n+q,k=a*m+b*p+r,a=c*l+d*n+q,l=c*m+d*p+r,e.m(0,0),c=this.Ga,c=Ne(0,0,c.width,c.height,g,k,a,l,e),e.transform(h);else{g||(l=1,n=m=0,p=1,r=q=0);k=a*l+b*n+q;a=a*m+b*p+r;l=c*l+d*n+q;d=c*m+d*p+r;e.m(l,d);m=(l-
k)*(l-k)+(d-a)*(d-a);c=!1;p=this.xa.o;r=p.length;n=D.P();q=null;b=Infinity;var s=null;this.yq&&(s=D.P(),q=this.Vd(),(c=q.Tn(k,a,l,d,s))&&(b=(k-s.x)*(k-s.x)+(a-s.y)*(a-s.y)));for(var u=0;u<r;u++){var t=p[u];t.visible&&t!==q&&t.Tn(k,a,l,d,n)&&(c=!0,t=(k-n.x)*(k-n.x)+(a-n.y)*(a-n.y),t<m&&(m=t,e.set(n)))}this.yq&&(b>m&&e.set(s),D.A(s));D.A(n);g&&e.transform(h)}return c};
f.K=function(a){P.prototype.K.call(this,a);if(this.ca===Kl||this.ca===kj)a=this.Vd(),null!==a&&a.K(!0);a=this.xa.o;for(var b=a.length,c=0;c<b;c++){var d=a[c];if(!d.Ea.F()){var e=Jo(d,!1);(d instanceof Rj||d instanceof x||d instanceof na||e!==Sj)&&d.K(!0)}}};f.xq=function(){if(!1===Hm(this)){em(this,!0);Ko(this,!0);for(var a=this.xa.o,b=a.length,c=0;c<b;c++)a[c].xq()}};f.$i=function(){if(0!==(this.T&2048)===!1){Uo(this,!0);Vo(this,!0);for(var a=this.xa.o,b=a.length,c=0;c<b;c++)a[c].XA()}};
f.XA=function(){Vo(this,!0);for(var a=this.xa.o,b=a.length,c=0;c<b;c++)a[c].XA()};
f.ho=function(a,b,c,d){var e=this.wj;e.width=0;e.height=0;var g=this.Ea,h=this.hg;void 0===c&&(c=h.width,d=h.height);c=Math.max(c,h.width);d=Math.max(d,h.height);var k=this.kf;isNaN(g.width)||(a=Math.min(g.width,k.width));isNaN(g.height)||(b=Math.min(g.height,k.height));a=Math.max(c,a);b=Math.max(d,b);var l=this.padding;a=Math.max(a-l.left-l.right,0);b=Math.max(b-l.top-l.bottom,0);var m=this.xa.o;if(0!==m.length){var n=this.ca.Xb;switch(n){case "Position":var p=a,q=b,r=c,s=d,u=m.length;e.x=0;e.y=
0;e.width=0;e.height=0;for(var t=Np(this),y=0;y<u;y++){var w=m[y];if(w.visible||w===t){var C=w.margin,A=C.right+C.left,N=C.top+C.bottom;Ak(w,p,q,r,s);var H=w.Fa,W=Math.max(H.width+A,0),fa=Math.max(H.height+N,0),S=w.position.x,ba=w.position.y;isFinite(S)||(S=0);isFinite(ba)||(ba=0);if(w instanceof z){var ia=w;if(ia.NF)var U=ia.jb/2,S=S-U,ba=ba-U}Ob(e,S,ba,W,fa)}}break;case "Vertical":for(var Ua=a,lb=c,ua=m.length,Oa=D.tb(),Fa=Np(this),Vb=0;Vb<ua;Vb++){var Rb=m[Vb];if(Rb.visible||Rb===Fa){var de=Jo(Rb,
!1);if(de!==Sj&&de!==uo)Oa.push(Rb);else{var sd=Rb.margin,vc=sd.right+sd.left,Bg=sd.top+sd.bottom;Ak(Rb,Ua,Infinity,lb,0);var Ff=Rb.Fa,Za=Math.max(Ff.width+vc,0),pb=Math.max(Ff.height+Bg,0);e.width=Math.max(e.width,Za);e.height+=pb}}}var sa=Oa.length;if(0!==sa){this.Ea.width?Ua=Math.min(this.Ea.width,this.kf.width):0!==e.width&&(Ua=Math.min(e.width,this.kf.width));for(Vb=0;Vb<sa;Vb++)if(Rb=Oa[Vb],Rb.visible||Rb===Fa)sd=Rb.margin,vc=sd.right+sd.left,Bg=sd.top+sd.bottom,Ak(Rb,Ua,Infinity,lb,0),Ff=Rb.Fa,
Za=Math.max(Ff.width+vc,0),pb=Math.max(Ff.height+Bg,0),e.width=Math.max(e.width,Za),e.height+=pb;D.Aa(Oa)}break;case "Horizontal":for(var pa=b,mb=d,nb=m.length,ib=D.tb(),ve=Np(this),Id=0;Id<nb;Id++){var zb=m[Id];if(zb.visible||zb===ve){var Oe=Jo(zb,!1);if(Oe!==Sj&&Oe!==vo)ib.push(zb);else{var jd=zb.margin,eg=jd.right+jd.left,Gf=jd.top+jd.bottom;Ak(zb,Infinity,pa,0,mb);var Cg=zb.Fa,ob=Math.max(Cg.width+eg,0),hc=Math.max(Cg.height+Gf,0);e.width+=ob;e.height=Math.max(e.height,hc)}}}var Zc=ib.length;
if(0!==Zc){this.Ea.height?pa=Math.min(this.Ea.height,this.kf.height):0!==e.height&&(pa=Math.min(e.height,this.kf.height));for(Id=0;Id<Zc;Id++)if(zb=ib[Id],zb.visible||zb===ve)jd=zb.margin,eg=jd.right+jd.left,Gf=jd.top+jd.bottom,Ak(zb,Infinity,pa,0,mb),Cg=zb.Fa,ob=Math.max(Cg.width+eg,0),hc=Math.max(Cg.height+Gf,0),e.width+=ob,e.height=Math.max(e.height,hc);D.Aa(ib)}break;case "Spot":a:{var fg=a,Cb=b,Sb=c,we=d,Dg=m.length,Jd=this.Vd(),qb=Jd.margin,Nc=0,Hf=0,Pe=qb.right+qb.left,Zh=qb.top+qb.bottom;
Ak(Jd,fg,Cb,Sb,we);for(var Va=Jd.Fa,eb=Va.width,Ac=Va.height,wc=Math.max(eb+Pe,0),$c=Math.max(Ac+Zh,0),oh=this.yq,ab=D.gh(-qb.left,-qb.top,wc,$c),Db=!0,Ab=Np(this),Bc=0;Bc<Dg;Bc++){var Eb=m[Bc];if(Eb!==Jd&&(Eb.visible||Eb===Ab)){qb=Eb.margin;Nc=qb.right+qb.left;Hf=qb.top+qb.bottom;Ak(Eb,fg,Cb,0,0);var Va=Eb.Fa,wc=Math.max(Va.width+Nc,0),$c=Math.max(Va.height+Hf,0),tb=Eb.alignment;tb.ed()&&(tb=this.gm);tb.fd()||(tb=gc);var Fb=Eb.Gh;Fb.ed()&&(Fb=gc);var ee=null;Eb instanceof x&&""!==Eb.$j&&(Eb.oc(0,
0,Va.width,Va.height),ee=Eb.Ed(Eb.$j),ee===Eb&&(ee=null));var Ib,Mb;if(null!==ee){for(var Oc=ee.Ga,$h=ee.margin,Nb=D.Fb(Fb.x*Oc.width+Fb.offsetX-$h.left,Fb.y*Oc.height+Fb.offsetY-$h.top);ee!==Eb;)ee.transform.vb(Nb),ee=ee.Q;Ib=tb.x*eb+tb.offsetX-Nb.x;Mb=tb.y*Ac+tb.offsetY-Nb.y;D.A(Nb)}else Ib=tb.x*eb+tb.offsetX-(Fb.x*Va.width-Fb.offsetX)-qb.left,Mb=tb.y*Ac+tb.offsetY-(Fb.y*Va.height-Fb.offsetY)-qb.top;Db?(Db=!1,e.x=Ib,e.y=Mb,e.width=wc,e.height=$c):Ob(e,Ib,Mb,wc,$c)}}Db?e.assign(ab):oh?e.HF(ab.x,
ab.y,ab.width,ab.height):Ob(e,ab.x,ab.y,ab.width,ab.height);D.Mb(ab);var Tb=Jd.stretch;Tb===to&&(Tb=Jo(Jd,!1));switch(Tb){case Sj:break a;case rf:if(!isFinite(fg)&&!isFinite(Cb))break a;break;case vo:if(!isFinite(fg))break a;break;case uo:if(!isFinite(Cb))break a}Va=Jd.Fa;eb=Va.width;Ac=Va.height;wc=Math.max(eb+Pe,0);$c=Math.max(Ac+Zh,0);qb=Jd.margin;ab=D.gh(-qb.left,-qb.top,wc,$c);for(Bc=0;Bc<Dg;Bc++)Eb=m[Bc],Eb===Jd||!Eb.visible&&Eb!==Ab||(qb=Eb.margin,Nc=qb.right+qb.left,Hf=qb.top+qb.bottom,Va=
Eb.Fa,wc=Math.max(Va.width+Nc,0),$c=Math.max(Va.height+Hf,0),tb=Eb.alignment,tb.ed()&&(tb=this.gm),tb.fd()||(tb=gc),Fb=Eb.Gh,Fb.ed()&&(Fb=gc),Db?(Db=!1,e.x=tb.x*eb+tb.offsetX-(Fb.x*Va.width-Fb.offsetX)-qb.left,e.y=tb.y*Ac+tb.offsetY-(Fb.y*Va.height-Fb.offsetY)-qb.top,e.width=wc,e.height=$c):Ob(e,tb.x*eb+tb.offsetX-(Fb.x*Va.width-Fb.offsetX)-qb.left,tb.y*Ac+tb.offsetY-(Fb.y*Va.height-Fb.offsetY)-qb.top,wc,$c));Db?e.assign(ab):oh?e.HF(ab.x,ab.y,ab.width,ab.height):Ob(e,ab.x,ab.y,ab.width,ab.height);
D.Mb(ab)}break;case "Auto":var Cc=a,ad=b,td=c,Eg=d,ai=m.length,ub=this.Vd(),bd=ub.margin,bi=Cc,Qe=ad,ic=bd.right+bd.left,xe=bd.top+bd.bottom;Ak(ub,Cc,ad,td,Eg);var Zb=ub.Fa,Dc=0,ud=null;ub instanceof z&&(ud=ub,Dc=ud.jb*ud.scale);var jc=Math.max(Zb.width+ic,0),Wa=Math.max(Zb.height+xe,0),kc=Op(ub),ci=kc.x*jc+kc.offsetX,ef=kc.y*Wa+kc.offsetY,Kd=Pp(ub),fe=Kd.x*jc+Kd.offsetX,ph=Kd.y*Wa+Kd.offsetY;isFinite(Cc)&&(bi=Math.max(Math.abs(ci-fe)-Dc,0));isFinite(ad)&&(Qe=Math.max(Math.abs(ef-ph)-Dc,0));var Ld=
D.Cm();Ld.m(0,0);for(var qh=Np(this),pj=0;pj<ai;pj++){var rh=m[pj];if(rh!==ub&&(rh.visible||rh===qh)){var bd=rh.margin,Gk=bd.right+bd.left,Gb=bd.top+bd.bottom;Ak(rh,bi,Qe,0,0);Zb=rh.Fa;jc=Math.max(Zb.width+Gk,0);Wa=Math.max(Zb.height+Gb,0);Ld.m(Math.max(jc,Ld.width),Math.max(Wa,Ld.height))}}if(1===ai)e.width=jc,e.height=Wa,D.Rk(Ld);else{var kc=Op(ub),Kd=Pp(ub),ge=0,kd=0;Kd.x!==kc.x&&Kd.y!==kc.y&&(ge=Ld.width/Math.abs(Kd.x-kc.x),kd=Ld.height/Math.abs(Kd.y-kc.y));D.Rk(Ld);Dc=0;null!==ud&&(Dc=ud.jb*
ud.scale,Tj(ud)===Uj&&(ge=kd=Math.max(ge,kd)));var ge=ge+(Math.abs(kc.offsetX)+Math.abs(Kd.offsetX)+Dc),kd=kd+(Math.abs(kc.offsetY)+Math.abs(Kd.offsetY)+Dc),Re=ub.stretch;Re===to&&(Re=Jo(ub,!1));switch(Re){case Sj:Eg=td=0;break;case rf:isFinite(Cc)&&(ge=Cc);isFinite(ad)&&(kd=ad);break;case vo:isFinite(Cc)&&(ge=Cc);Eg=0;break;case uo:td=0,isFinite(ad)&&(kd=ad)}ub.xq();Ak(ub,ge,kd,td,Eg);e.width=ub.Fa.width+ic;e.height=ub.Fa.height+xe}break;case "Table":for(var di=a,ei=b,qj=c,rj=d,Jb=m.length,sh=D.tb(),
th=D.tb(),qa=0;qa<Jb;qa++){var ca=m[qa],$b=ca instanceof x?ca:null;if(null===$b||$b.type!==Oo&&$b.type!==Po||!ca.visible)sh.push(ca);else{v&&($b.Ea.F()&&D.k($b.toString()+" TableRow/TableColumn Panels cannot set a desiredSize: "+$b.Ea.toString()),$b.hg.O(Zd)||D.k($b.toString()+" TableRow/TableColumn Panels cannot set a minSize: "+$b.hg.toString()),$b.kf.O(ke)||D.k($b.toString()+" TableRow/TableColumn Panels cannot set a maxSize: "+$b.kf.toString()));th.push($b);for(var gg=$b.xa.o,fi=gg.length,lc=
0;lc<fi;lc++){var gi=gg[lc];$b.type===Oo?gi.Zb=ca.Zb:$b.type===Po&&(gi.column=ca.column);sh.push(gi)}}}Jb=sh.length;0===Jb&&(this.me(0),this.le(0));for(var mc=[],qa=0;qa<Jb;qa++)ca=sh[qa],em(ca,!0),Ko(ca,!0),mc[ca.Zb]||(mc[ca.Zb]=[]),mc[ca.Zb][ca.column]||(mc[ca.Zb][ca.column]=[]),mc[ca.Zb][ca.column].push(ca);D.Aa(sh);for(var ff=D.tb(),Se=D.tb(),gf=D.tb(),ye={count:0},ze={count:0},cd=di,Md=ei,uh=this.he,Jb=uh.length,qa=0;qa<Jb;qa++){var $=uh[qa];void 0!==$&&($.Qa=0)}uh=this.de;Jb=uh.length;for(qa=
0;qa<Jb;qa++)$=uh[qa],void 0!==$&&($.Qa=0);for(var hf=mc.length,hg=0,qa=0;qa<hf;qa++)mc[qa]&&(hg=Math.max(hg,mc[qa].length));for(var vh=Math.min(this.vj,hf-1),wh=Math.min(this.fj,hg-1),Nd=0,hf=mc.length,Hk=Np(this),qa=0;qa<hf;qa++)if(mc[qa])for(var hg=mc[qa].length,vb=this.me(qa),lc=vb.Qa=0;lc<hg;lc++)if(mc[qa][lc]){var Xa=this.le(lc);void 0===ff[lc]&&(Xa.Qa=0,ff[lc]=!0);for(var hm=mc[qa][lc],Ik=hm.length,sj=0;sj<Ik;sj++)if(ca=hm[sj],ca.visible||ca===Hk){var hi=1<ca.rj||1<ca.Qi;hi&&(qa<vh||lc<wh||
Se.push(ca));var xc=ca.margin,Ae=xc.right+xc.left,vd=xc.top+xc.bottom,Pc=Xo(ca,vb,Xa,!1),Jk=ca.Ea,im=!isNaN(Jk.height),jm=!isNaN(Jk.width)&&im;hi||Pc===Sj||jm||qa<vh||lc<wh||(void 0!==ye[lc]||Pc!==rf&&Pc!==vo||(ye[lc]=-1,ye.count++),void 0!==ze[qa]||Pc!==rf&&Pc!==uo||(ze[qa]=-1,ze.count++),gf.push(ca));Ak(ca,Infinity,Infinity,0,0);if(!(qa<vh||lc<wh)){var If=ca.Fa,Wb=Math.max(If.width+Ae,0),Od=Math.max(If.height+vd,0);if(1===ca.rj&&(Pc===Sj||Pc===vo)){var $=this.me(qa),Pd=$.ff(),Nd=Math.max(Od-$.Qa,
0);Nd+Pd>Md&&(Nd=Math.max(Md-Pd,0));var Ec=0===$.Qa;$.Qa+=Nd;Md=Math.max(Md-(Nd+(Ec?Pd:0)),0)}1!==ca.Qi||Pc!==Sj&&Pc!==uo||($=this.le(lc),Pd=$.ff(),Nd=Math.max(Wb-$.Qa,0),Nd+Pd>cd&&(Nd=Math.max(cd-Pd,0)),Ec=0===$.Qa,$.Qa+=Nd,cd=Math.max(cd-(Nd+(Ec?Pd:0)),0));hi&&ca.xq()}}}D.Aa(ff);for(var he=0,wd=0,Jb=this.fq,qa=0;qa<Jb;qa++){var Fg=this.de[qa];void 0!==Fg&&(he+=Fg.Za,0!==Fg.Za&&(he+=Fg.ff()))}Jb=this.Nq;for(qa=0;qa<Jb;qa++){var tj=this.he[qa];void 0!==tj&&(wd+=tj.Za,0!==tj.Za&&(wd+=tj.ff()))}for(var cd=
Math.max(di-he,0),xh=Md=Math.max(ei-wd,0),yh=cd,Jb=gf.length,qa=0;qa<Jb;qa++){var ca=gf[qa],vb=this.me(ca.Zb),Xa=this.le(ca.column),ii=ca.Fa,xc=ca.margin,Ae=xc.right+xc.left,vd=xc.top+xc.bottom;ye[ca.column]=0===Xa.Qa&&void 0!==ye[ca.column]?Math.max(ii.width+Ae,ye[ca.column]):null;ze[ca.Zb]=0===vb.Qa&&void 0!==ze[ca.Zb]?Math.max(ii.height+vd,ze[ca.Zb]):null}var ji=0,ig=0,nc;for(nc in ze)"count"!==nc&&(ji+=ze[nc]);for(nc in ye)"count"!==nc&&(ig+=ye[nc]);for(var Ya=D.Cm(),qa=0;qa<Jb;qa++)if(ca=gf[qa],
ca.visible||ca===Hk){var vb=this.me(ca.Zb),Xa=this.le(ca.column),Qd=0;isFinite(Xa.width)?Qd=Xa.width:(Qd=isFinite(cd)&&null!==ye[ca.column]?0===ig?Xa.Qa+cd:ye[ca.column]/ig*yh:null!==ye[ca.column]?cd:Xa.Qa||cd,Qd=Math.max(0,Qd-Xa.ff()));var Rd=0;isFinite(vb.height)?Rd=vb.height:(Rd=isFinite(Md)&&null!==ze[ca.Zb]?0===ji?vb.Qa+Md:ze[ca.Zb]/ji*xh:null!==ze[ca.Zb]?Md:vb.Qa||Md,Rd=Math.max(0,Rd-vb.ff()));Ya.m(Math.max(Xa.Pj,Math.min(Qd,Xa.vf)),Math.max(vb.Pj,Math.min(Rd,vb.vf)));Pc=Xo(ca,vb,Xa,!1);switch(Pc){case vo:Ya.height=
Math.max(Ya.height,vb.Qa+Md);break;case uo:Ya.width=Math.max(Ya.width,Xa.Qa+cd)}xc=ca.margin;Ae=xc.right+xc.left;vd=xc.top+xc.bottom;ca.xq();Ak(ca,Ya.width,Ya.height,Xa.Pj,vb.Pj);If=ca.Fa;Wb=Math.max(If.width+Ae,0);Od=Math.max(If.height+vd,0);isFinite(cd)&&(Wb=Math.min(Wb,Ya.width));isFinite(Md)&&(Od=Math.min(Od,Ya.height));var jf=0,jf=vb.Qa;vb.Qa=Math.max(vb.Qa,Od);Nd=vb.Qa-jf;Md=Math.max(Md-Nd,0);jf=Xa.Qa;Xa.Qa=Math.max(Xa.Qa,Wb);Nd=Xa.Qa-jf;cd=Math.max(cd-Nd,0)}D.Aa(gf);for(var Jf=D.Cm(),Jb=Se.length,
qa=0;qa<Jb;qa++)if(ca=Se[qa],ca.visible||ca===Hk){vb=this.me(ca.Zb);Xa=this.le(ca.column);Ya.m(Math.max(Xa.Pj,Math.min(di,Xa.vf)),Math.max(vb.Pj,Math.min(ei,vb.vf)));Pc=Xo(ca,vb,Xa,!1);switch(Pc){case rf:0!==Xa.Qa&&(Ya.width=Math.min(Ya.width,Xa.Qa));0!==vb.Qa&&(Ya.height=Math.min(Ya.height,vb.Qa));break;case vo:0!==Xa.Qa&&(Ya.width=Math.min(Ya.width,Xa.Qa));break;case uo:0!==vb.Qa&&(Ya.height=Math.min(Ya.height,vb.Qa))}isFinite(Xa.width)&&(Ya.width=Xa.width);isFinite(vb.height)&&(Ya.height=vb.height);
Jf.m(0,0);for(var rb=1;rb<ca.rj&&!(ca.Zb+rb>=this.Nq);rb++)$=this.me(ca.Zb+rb),Jf.height+=Math.max($.Pj,isNaN($.pf)?$.vf:Math.min($.pf,$.vf));for(rb=1;rb<ca.Qi&&!(ca.column+rb>=this.fq);rb++)$=this.le(ca.column+rb),Jf.width+=Math.max($.Pj,isNaN($.pf)?$.vf:Math.min($.pf,$.vf));Ya.width+=Jf.width;Ya.height+=Jf.height;xc=ca.margin;Ae=xc.right+xc.left;vd=xc.top+xc.bottom;Ak(ca,Ya.width,Ya.height,qj,rj);for(var If=ca.Fa,Wb=Math.max(If.width+Ae,0),Od=Math.max(If.height+vd,0),kf=0,rb=0;rb<ca.rj&&!(ca.Zb+
rb>=this.Nq);rb++)$=this.me(ca.Zb+rb),kf+=$.total||0;if(kf<Od){var ld=Od-kf,Gg=Od-kf;if(null!==ca.Iy)for(var lf=ca.Iy,rb=0;rb<ca.rj&&!(0>=ld)&&!(ca.Zb+rb>=this.Nq);rb++){var $=this.me(ca.Zb+rb),Fc=$.Za||0,Kf=lf(ca,$,Gg);v&&"number"!==typeof Kf&&D.k(ca+" spanAllocation does not return a number: "+Kf);$.Qa=Math.min($.vf,Fc+Kf);$.Za!==Fc&&(ld-=$.Za-Fc)}for(;0<ld;){Fc=$.Za||0;isNaN($.height)&&$.vf>Fc&&($.Qa=Math.min($.vf,Fc+ld),$.Za!==Fc&&(ld-=$.Za-Fc));if(0===$.index)break;$=this.me($.index-1)}}for(var Te=
0,rb=0;rb<ca.Qi&&!(ca.column+rb>=this.fq);rb++)$=this.le(ca.column+rb),Te+=$.total||0;if(Te<Wb){ld=Wb-Te;Gg=Wb-Te;if(null!==ca.Iy)for(lf=ca.Iy,rb=0;rb<ca.Qi&&!(0>=ld)&&!(ca.column+rb>=this.fq);rb++)$=this.le(ca.column+rb),Fc=$.Za||0,Kf=lf(ca,$,Gg),v&&"number"!==typeof Kf&&D.k(ca+" spanAllocation does not return a number: "+Kf),$.Qa=Math.min($.vf,Fc+Kf),$.Za!==Fc&&(ld-=$.Za-Fc);for(;0<ld;){Fc=$.Za||0;isNaN($.width)&&$.vf>Fc&&($.Qa=Math.min($.vf,Fc+ld),$.Za!==Fc&&(ld-=$.Za-Fc));if(0===$.index)break;
$=this.le($.index-1)}}}D.Aa(Se);D.Rk(Jf);D.Rk(Ya);for(var Hg=0,Ig=0,Pc=Jo(this,!0),uj=this.Ea,Kk=this.kf,Be=wd=he=0,dd=0,Jb=this.fq,qa=0;qa<Jb;qa++)void 0!==this.de[qa]&&($=this.le(qa),isFinite($.width)?(Be+=$.width,Be+=$.ff()):Qp($)===Rp?(Be+=$.Za,Be+=$.ff()):0!==$.Za&&(he+=$.Za,he+=$.ff()));var Hg=isFinite(uj.width)?Math.min(uj.width,Kk.width):Pc!==Sj&&isFinite(di)?di:he,Hg=Math.max(Hg,this.hg.width),Hg=Math.max(Hg-Be,0),Lk=Math.max(Hg/he,1);isFinite(Lk)||(Lk=1);for(qa=0;qa<Jb;qa++)void 0!==this.de[qa]&&
($=this.le(qa),isFinite($.width)||Qp($)===Rp||($.Qa=$.Za*Lk),$.position=e.width,0!==$.Za&&(e.width+=$.Za,e.width+=$.ff()));Jb=this.Nq;for(qa=0;qa<Jb;qa++)void 0!==this.he[qa]&&($=this.me(qa),isFinite($.height)?(dd+=$.height,dd+=$.ff()):Qp($)===Rp?(dd+=$.Za,dd+=$.ff()):0!==$.Za&&(wd+=$.Za,0!==$.Za&&(wd+=$.ff())));var Ig=isFinite(uj.height)?Math.min(uj.height,Kk.height):Pc!==Sj&&isFinite(ei)?ei:wd,Ig=Math.max(Ig,this.hg.height),Ig=Math.max(Ig-dd,0),zh=Math.max(Ig/wd,1);isFinite(zh)||(zh=1);for(qa=0;qa<
Jb;qa++)void 0!==this.he[qa]&&($=this.me(qa),isFinite($.height)||Qp($)===Rp||($.Qa=$.Za*zh),$.position=e.height,0!==$.Za&&(e.height+=$.Za,0!==$.Za&&(e.height+=$.ff())));Jb=th.length;for(qa=0;qa<Jb;qa++){var md=th[qa];md.type===Oo?(Qd=e.width,$=this.me(md.Zb),Rd=$.Qa):($=this.le(md.column),Qd=$.Qa,Rd=e.height);md.Ad.m(0,0,Qd,Rd);em(md,!1);mc[md.Zb]||(mc[md.Zb]=[]);mc[md.Zb][md.column]||(mc[md.Zb][md.column]=[]);mc[md.Zb][md.column].push(md)}D.Aa(th);this.jt=mc;break;case "Viewbox":var vj=a,lm=b,mt=
c,nt=d;1<m.length&&D.k("Viewbox Panel cannot contain more than one GraphObject.");var mf=m[0];mf.Bb=1;mf.xq();Ak(mf,Infinity,Infinity,mt,nt);var Mk=mf.Fa,mm=mf.margin,ot=mm.right+mm.left,pt=mm.top+mm.bottom;if(isFinite(vj)||isFinite(lm)){var hw=mf.scale,nm=Mk.width,om=Mk.height,qt=Math.max(vj-ot,0),rt=Math.max(lm-pt,0),Nk=1;this.Xp===Uj?0!==nm&&0!==om&&(Nk=Math.min(qt/nm,rt/om)):0!==nm&&0!==om&&(Nk=Math.max(qt/nm,rt/om));0===Nk&&(Nk=1E-4);mf.Bb*=Nk;hw!==mf.scale&&(em(mf,!0),Ak(mf,Infinity,Infinity,
mt,nt))}Mk=mf.Fa;e.width=isFinite(vj)?vj:Math.max(Mk.width+ot,0);e.height=isFinite(lm)?lm:Math.max(Mk.height+pt,0);break;case "Link":var st=m.length;if(this instanceof da||this instanceof J){var li=null;this instanceof J&&(li=this);this instanceof da&&(li=this.Zf);if(li instanceof J){var Ok=li;if(0===st){var pm=this.Ga;wb(pm,0,0);var Ce=this.Fa;Ce.m(0,0,0,0)}else{var qm=this instanceof da?null:li.path,Jg=li.qo,nf=this.wj;nf.assign(Jg);nf.x=0;nf.y=0;var Ah=Ok.points,mi=li.ta;this.Gu(!1);var tt=Jg.width,
ut=Jg.height;this.hj.m(Jg.x,Jg.y);null===this.ph&&(this.ph=new K(B));this.ph.clear();null!==qm&&(Sp(qm,tt,ut,this),Ce=qm.Fa,nf.Wh(Ce),this.ph.add(Ce));for(var Kg=D.Of(),Pk=D.P(),Lg=D.P(),np=0;np<st;np++){var ac=m[np];if(ac!==qm)if(ac.Gf&&ac instanceof z)Sp(ac,tt,ut,this),Ce=ac.Fa,nf.Wh(Ce),this.ph.add(Ce);else if(2>mi)Ak(ac,Infinity,Infinity),Ce=ac.Fa,nf.Wh(Ce),this.ph.add(Ce);else{var xd=ac.Te,wt=ac.zB,op=ac.Gh;op.Zd()&&(op=gc);var jg=ac.Oq,iw=ac.AB,Qk=0,Rk=0,rm=0;if(xd<-mi||xd>=mi){var xt=Ok.eG,
Lf=Ok.dG;jg!==nj&&(rm=Ok.computeAngle(ac,jg,Lf),ac.rg=rm);Qk=xt.x-Jg.x;Rk=xt.y-Jg.y}else{var Sd,of;if(0<=xd)Sd=Ah.ea(xd),of=xd<mi-1?Ah.ea(xd+1):Sd;else{var ni=mi+xd;Sd=Ah.ea(ni);of=0<ni?Ah.ea(ni-1):Sd}if(Sd.Sc(of)){var oi,pi;0<=xd?(oi=0<xd?Ah.ea(xd-1):Sd,pi=xd<mi-2?Ah.ea(xd+2):of):(oi=ni<mi-1?Ah.ea(ni+1):Sd,pi=1<ni?Ah.ea(ni-2):of);var yt=oi.Cf(Sd),zt=of.Cf(pi),Lf=yt>zt+10?0<=xd?oi.Jc(Sd):Sd.Jc(oi):zt>yt+10?0<=xd?of.Jc(pi):pi.Jc(of):0<=xd?oi.Jc(pi):pi.Jc(oi)}else Lf=0<=xd?Sd.Jc(of):of.Jc(Sd);jg!==
nj&&(rm=Ok.computeAngle(ac,jg,Lf),ac.rg=rm);Qk=Sd.x+(of.x-Sd.x)*wt-Jg.x;Rk=Sd.y+(of.y-Sd.y)*wt-Jg.y}Ak(ac,Infinity,Infinity);var Ce=ac.Fa,pm=ac.Ga,Sk=0;ac instanceof z&&(Sk=ac.jb);var qi=pm.width+Sk,wj=pm.height+Sk;Kg.reset();Kg.translate(-Ce.x,-Ce.y);Kg.scale(ac.scale,ac.scale);Kg.rotate(jg===nj?ac.angle:Lf,qi/2,wj/2);jg!==Tp&&jg!==Up||Kg.rotate(90,qi/2,wj/2);jg!==Vp&&jg!==Wp||Kg.rotate(-90,qi/2,wj/2);jg===Xp&&(45<Lf&&135>Lf||225<Lf&&315>Lf)&&Kg.rotate(-Lf,qi/2,wj/2);var Bj=new B(0,0,qi,wj);Pk.so(Bj,
op);Kg.vb(Pk);var jw=-Pk.x+Sk/2,kw=-Pk.y+Sk/2;Lg.assign(iw);isNaN(Lg.x)&&(Lg.x=0<=xd?qi/2+3:-(qi/2+3));isNaN(Lg.y)&&(Lg.y=-(wj/2+3));Lg.rotate(Lf);Qk+=Lg.x;Rk+=Lg.y;Bj.set(Ce);Bj.x=Qk+jw;Bj.y=Rk+kw;this.ph.add(Bj);nf.Wh(Bj)}}if(this instanceof J)for(var At=this.If;At.next();)Ak(At.value,Infinity,Infinity);this.wj=nf;var pp=this.hj;pp.m(pp.x+nf.x,pp.y+nf.y);wb(e,nf.width||0,nf.height||0);D.He(Kg);D.A(Pk);D.A(Lg)}}}break;case "Grid":break;case "Graduated":var lw=a,mw=b,nw=c,ow=d,Mg=this.Vd();this.Pm=
[];var Cj=Mg.margin,pw=Cj.right+Cj.left,qw=Cj.top+Cj.bottom;Ak(Mg,lw,mw,nw,ow);var Bt=Mg.Fa,rw=Bt.height,sw=Math.max(Bt.width+pw,0),tw=Math.max(rw+qw,0),Ct=new B(-Cj.left,-Cj.top,sw,tw);this.Pm.push(Ct);e.assign(Ct);for(var Uk=Mg.Df,Dt=Mg.jb,qp=Uk.JA,Dj=Uk.Kx,ri=Uk.KA,uw=qp.length,rp=0,sp=0,Ej=D.tb(),tp=0;tp<uw;tp++){for(var up=qp[tp],Et=[],sp=rp=0,vw=up.length,Fj=0;Fj<vw;Fj+=2){var Ft=up[Fj],Gt=up[Fj+1];if(0!==Fj){var yd=180*Math.atan2(Gt-sp,Ft-rp)/Math.PI;0>yd&&(yd+=360);Et.push(yd)}rp=Ft;sp=Gt}Ej.push(Et)}var Ht;
if(null===this.kk){for(var It=[],vp=this.xa.o,Jt=vp.length,wp=0;wp<Jt;wp++){var Vk=vp[wp],Kt=[];It.push(Kt);if(Vk.visible)for(var ww=Vk.interval,xp=0;xp<Jt;xp++){var Wk=vp[xp];if(Wk.visible&&Vk!==Wk&&!(Vk instanceof z&&!(Wk instanceof z)||Vk instanceof na&&!(Wk instanceof na))){var Lt=Wk.interval;Lt>ww&&Kt.push(Lt)}}}this.kk=It}Ht=this.kk;var Mt=this.xa.o,xw=Mt.length,Bh=0,Nt=0,Ot=ri;this.Rm=[];for(var sm=[],tm=0;tm<xw;tm++){var Ch=Mt[tm],sm=[];if(Ch.visible&&Ch!==Mg){var Pt=Ch.interval,Qt=this.RA;
if(!(2>Qt*Pt*ri/this.Nx)){var ie=this.AF,Rt=Ht[tm],si=Dj[0][0],Mf=0,zd=0,Nt=ri*Ch.zF-1E-4,Ot=ri*Ch.xF+1E-4,Gj=Qt*Pt;if(ie<this.Tk)var ti=(this.Tk-ie)/Gj,ti=0===ti%1?ti:Math.floor(ti+1),ie=ie+ti*Gj;else ie>this.Tk+Gj&&(ti=Math.floor((ie-this.Tk)/Gj),ie-=ti*Gj);for(;ie<=this.QA;){var yp;a:{for(var yw=Rt.length,zp=0;zp<yw;zp++)if(yb((ie-this.AF)%(Rt[zp]*this.RA),0)){yp=!1;break a}yp=!0}if(yp&&(Bh=(ie-this.Tk)*ri/this.Nx,Bh>ri&&(Bh=ri),Nt<=Bh&&Bh<=Ot)){for(var yd=Ej[Mf][zd],Hj=Dj[Mf][zd];Mf<Dj.length;){for(;Bh>
si&&zd<Dj[Mf].length-1;)zd++,yd=Ej[Mf][zd],Hj=Dj[Mf][zd],si+=Hj;if(Bh<=si)break;Mf++;zd=0;yd=Ej[Mf][zd];Hj=Dj[Mf][zd];si+=Hj}var Td=qp[Mf],St=Td[2*zd],Tt=Td[2*zd+1],um=(Bh-(si-Hj))/Hj,Ap=new O(St+(Td[2*zd+2]-St)*um+Dt/2-Uk.sb.x,Tt+(Td[2*zd+3]-Tt)*um+Dt/2-Uk.sb.y);Ap.scale(Mg.scale,Mg.scale);var kg=yd,Ij=Ej[Mf];1E-4>um?0<zd?kg=Ij[zd-1]:yb(Td[0],Td[Td.length-2])&&yb(Td[1],Td[Td.length-1])&&(kg=Ij[Ij.length-1]):.9999<um&&(zd+1<Ij.length?kg=Ij[zd+1]:yb(Td[0],Td[Td.length-2])&&yb(Td[1],Td[Td.length-1])&&
(kg=Ij[0]));yd!==kg&&(180<Math.abs(yd-kg)&&(yd<kg?yd+=360:kg+=360),yd=(yd+kg)/2%360);if(Ch instanceof na){var vm="",vm=null!==Ch.yF?Ch.yF(ie):(+ie.toFixed(2)).toString();v&&D.h(vm,"string");""!==vm&&sm.push([Ap,yd,vm])}else sm.push([Ap,yd])}ie+=Gj}}}this.Rm.push(sm)}D.Aa(Ej);for(var zw=this.Rm,Aw=m.length,wm=0;wm<Aw;wm++){var ui=m[wm],Bp=zw[wm];if(ui.visible&&ui!==Mg&&0!==Bp.length){if(ui instanceof z){var Dh=ui,Ut=Bp,Bw=e,Cp=Dh.Gh;Cp.Zd()&&(Cp=dc);var Cw=Dh.angle;Dh.rg=0;Ak(Dh,Infinity,Infinity);
Dh.rg=Cw;var Vt=Dh.Fa,Dp=Vt.width,Ep=Vt.height,Wt=D.gh(0,0,Dp,Ep),je=D.P();je.so(Wt,Cp);D.Mb(Wt);for(var xm=-je.x,ym=-je.y,vi=new B,Dw=Ut.length,zm=0;zm<Dw;zm++)for(var Fp=Ut[zm],Xt=Fp[0].x,Yt=Fp[0].y,Zt=Fp[1],Am=0;4>Am;Am++){switch(Am){case 0:je.m(xm,ym);break;case 1:je.m(xm+Dp,ym);break;case 2:je.m(xm,ym+Ep);break;case 3:je.m(xm+Dp,ym+Ep)}je.rotate(Zt+Dh.angle);je.offset(Xt,Yt);0===zm&&0===Am?vi.m(je.x,je.y,0,0):vi.Ki(je);je.offset(-Xt,-Yt);je.rotate(-Zt-Dh.angle)}D.A(je);this.Pm.push(vi);Ob(Bw,
vi.x,vi.y,vi.width,vi.height)}else if(ui instanceof na){var Xk=ui,$t=Bp,Ew=e;null===this.Ck&&(this.Ck=new na);var Nf=this.Ck;Kp(Xk,Nf);var Gp=Xk.Gh;Gp.Zd()&&(Gp=dc);for(var Eh=Xk.Oq,Fw=Xk.AB,wi=null,Bm=0,Cm=0,Ng=0,Hp=0,Gw=$t.length,Dm=0;Dm<Gw;Dm++){var lg=$t[Dm],Bm=lg[0].x,Cm=lg[0].y,Ng=lg[1];Eh!==nj&&(Hp=Xk.computeAngle(Eh,Ng),Nf.rg=Hp);Nf.text=lg[2];Ak(Nf,Infinity,Infinity);var Fh=Nf.Fa,Jj=Nf.Ga,Kj=Jj.width,Lj=Jj.height,Og=D.Of();Og.reset();Og.translate(-Fh.x,-Fh.y);Og.scale(Nf.scale,Nf.scale);
Og.rotate(Eh===nj?Nf.angle:Ng,Kj/2,Lj/2);Eh!==Tp&&Eh!==Up||Og.rotate(90,Kj/2,Lj/2);Eh!==Vp&&Eh!==Wp||Og.rotate(-90,Kj/2,Lj/2);Eh===Xp&&(45<Ng&&135>Ng||225<Ng&&315>Ng)&&Og.rotate(-Ng,Kj/2,Lj/2);var au=D.gh(0,0,Kj,Lj),Yk=D.P();Yk.so(au,Gp);Og.vb(Yk);var Hw=-Yk.x,Iw=-Yk.y,Pg=D.P();Pg.assign(Fw);isNaN(Pg.x)&&(Pg.x=Kj/2+3);isNaN(Pg.y)&&(Pg.y=-(Lj/2+3));Pg.rotate(Ng);var Bm=Bm+(Pg.x+Hw),Cm=Cm+(Pg.y+Iw),Ip=new B(Bm,Cm,Fh.width,Fh.height),Jw=new B(Fh.x,Fh.y,Fh.width,Fh.height),Kw=new B(Jj.x,Jj.y,Jj.width,
Jj.height),bu=new Yp;bu.gq(Nf.gi);lg.push(Hp);lg.push(Nf.ue);lg.push(bu);lg.push(Ip);lg.push(Jw);lg.push(Kw);0===Dm?wi=Ip.copy():wi.Wh(Ip);D.A(Pg);D.A(Yk);D.Mb(au);D.He(Og)}this.Pm.push(wi);Ob(Ew,wi.x,wi.y,wi.width,wi.height)}em(ui,!1)}}break;case "TableRow":case "TableColumn":D.k(this.toString()+" is not an element of a Table Panel. TableRow and TableColumn Panels can only be elements of a Table Panel.");break;default:D.k("Unknown panel type: "+n)}}var pf=e.width,qf=e.height,Em=this.padding,Lw=Em.top+
Em.bottom,pf=pf+(Em.left+Em.right),qf=qf+Lw;isFinite(g.width)&&(pf=g.width);isFinite(g.height)&&(qf=g.height);pf=Math.min(k.width,pf);qf=Math.min(k.height,qf);pf=Math.max(h.width,pf);qf=Math.max(h.height,qf);pf=Math.max(c,pf);qf=Math.max(d,qf);e.width=pf;e.height=qf;wb(this.$c,pf,qf);Go(this,0,0,pf,qf)};x.prototype.findMainElement=x.prototype.Vd=function(){if(null===this.wn){var a=this.xa.o,b=a.length;if(0===b)return null;for(var c=0;c<b;c++){var d=a[c];if(!0===d.Gf)return this.wn=d}this.wn=a[0]}return this.wn};
function Np(a){return null!==a.Y?a.Y.uf:null}
x.prototype.yj=function(a,b,c,d){var e=this.wj,g=this.xa.o,h=D.gh(0,0,0,0);if(0===g.length){var k=this.$;k.x=a;k.y=b;k.width=c;k.height=d}else{if(!this.Ea.F()){var l=Jo(this,!0),m=this.Ad,n=m.width,p=m.height,q=this.margin,r=q.left+q.right,s=q.top+q.bottom;n===c&&p===d&&(l=Sj);switch(l){case Sj:if(n>c||p>d)this.K(),Ak(this,n>c?c:n,p>d?d:p);break;case rf:this.K(!0);Ak(this,c+r,d+s,0,0);break;case vo:this.K(!0);Ak(this,c+r,p+s,0,0);break;case uo:this.K(!0),Ak(this,n+r,d+s,0,0)}}k=this.$;k.x=a;k.y=b;
k.width=c;k.height=d;var u=this.ca.Xb;switch(u){case "Position":for(var t=g.length,y=e.x-this.padding.left,w=e.y-this.padding.top,C=0;C<t;C++){var A=g[C],N=A.Fa,H=A.margin,W=A.position.x,fa=A.position.y;h.x=isNaN(W)?-y:W-y;h.y=isNaN(fa)?-w:fa-w;if(A instanceof z){var S=A;if(S.NF){var ba=S.jb/2;h.x-=ba;h.y-=ba}}h.x+=H.left;h.y+=H.top;h.width=N.width;h.height=N.height;A.visible&&A.oc(h.x,h.y,h.width,h.height)}break;case "Vertical":for(var ia=g.length,U=this.padding.left,Ua=this.TF,lb=Ua?e.height:this.padding.top,
ua=0;ua<ia;ua++){var Oa=U,Fa=g[ua];if(Fa.visible){var Vb=Fa.Fa,Rb=Fa.margin,de=Rb.left+Rb.right,sd=U+this.padding.right,vc=Vb.width,Bg=Jo(Fa,!1);if(isNaN(Fa.Ea.width)&&Bg===rf||Bg===vo)vc=Math.max(e.width-de-sd,0);var Ff=vc+de+sd,Za=Fa.alignment;Za.ed()&&(Za=this.gm);Za.fd()||(Za=gc);Ua&&(lb-=Vb.height+Rb.bottom+Rb.top);Fa.oc(Oa+Za.offsetX+Rb.left+(e.width*Za.x-Ff*Za.x),lb+Za.offsetY+Rb.top,vc,Vb.height);Ua||(lb+=Vb.height+Rb.bottom+Rb.top)}}break;case "Horizontal":for(var pb=g.length,sa=this.padding.top,
pa=this.TF,mb=pa?e.width:this.padding.left,nb=0;nb<pb;nb++){var ib=sa,ve=g[nb];if(ve.visible){var Id=ve.Fa,zb=ve.margin,Oe=zb.top+zb.bottom,jd=sa+this.padding.bottom,eg=Id.height,Gf=Jo(ve,!1);if(isNaN(ve.Ea.height)&&Gf===rf||Gf===uo)eg=Math.max(e.height-Oe-jd,0);var Cg=eg+Oe+jd,ob=ve.alignment;ob.ed()&&(ob=this.gm);ob.fd()||(ob=gc);pa&&(mb-=Id.width+zb.left+zb.right);ve.oc(mb+ob.offsetX+zb.left,ib+ob.offsetY+zb.top+(e.height*ob.y-Cg*ob.y),Id.width,eg);pa||(mb+=Id.width+zb.left+zb.right)}}break;case "Spot":var hc=
g.length,Zc=this.Vd(),fg=Zc.Fa,Cb=fg.width,Sb=fg.height,we=this.padding,Dg=we.left,Jd=we.top;h.x=Dg-e.x;h.y=Jd-e.y;Zc.oc(h.x,h.y,Cb,Sb);for(var qb=0;qb<hc;qb++){var Nc=g[qb];if(Nc!==Zc){var Hf=Nc.Fa,Pe=Hf.width,Zh=Hf.height,Va=Nc.alignment;Va.ed()&&(Va=this.gm);Va.fd()||(Va=gc);var eb=Nc.Gh;eb.ed()&&(eb=gc);var Ac=null;Nc instanceof x&&""!==Nc.$j&&(Ac=Nc.Ed(Nc.$j),Ac===Nc&&(Ac=null));if(null!==Ac){for(var wc=Ac.Ga,$c=D.Fb(eb.x*wc.width+eb.offsetX,eb.y*wc.height+eb.offsetY);Ac!==Nc;)Ac.transform.vb($c),
Ac=Ac.Q;h.x=Va.x*Cb+Va.offsetX-$c.x;h.y=Va.y*Sb+Va.offsetY-$c.y;D.A($c)}else h.x=Va.x*Cb+Va.offsetX-(eb.x*Pe-eb.offsetX),h.y=Va.y*Sb+Va.offsetY-(eb.y*Zh-eb.offsetY);h.x-=e.x;h.y-=e.y;Nc.visible&&Nc.oc(Dg+h.x,Jd+h.y,Pe,Zh)}}break;case "Auto":var oh=g.length,ab=this.Vd(),Db=ab.Fa,Ab=D.Nf();Ab.m(0,0,1,1);var Bc=ab.margin,Eb=Bc.left,tb=Bc.top,Fb=this.padding,ee=Fb.left,Ib=Fb.top;h.x=Eb;h.y=tb;h.width=Db.width;h.height=Db.height;ab.oc(ee+h.x,Ib+h.y,h.width,h.height);var Mb=Op(ab),Oc=Pp(ab),$h=0+Mb.y*Db.height+
Mb.offsetY,Nb=0+Oc.x*Db.width+Oc.offsetX,Tb=0+Oc.y*Db.height+Oc.offsetY;Ab.x=0+Mb.x*Db.width+Mb.offsetX;Ab.y=$h;Ob(Ab,Nb,Tb,0,0);Ab.x+=Eb+ee;Ab.y+=tb+Ib;for(var Cc=0;Cc<oh;Cc++){var ad=g[Cc];if(ad!==ab){var td=ad.Fa,Bc=ad.margin,Eg=Math.max(td.width+Bc.right+Bc.left,0),ai=Math.max(td.height+Bc.top+Bc.bottom,0),ub=ad.alignment;ub.ed()&&(ub=this.gm);ub.fd()||(ub=gc);h.x=Ab.width*ub.x+ub.offsetX-Eg*ub.x+Bc.left+Ab.x;h.y=Ab.height*ub.y+ub.offsetY-ai*ub.y+Bc.top+Ab.y;h.width=Ab.width;h.height=Ab.height;
ad.visible&&(Pb(Ab.x,Ab.y,Ab.width,Ab.height,h.x,h.y,td.width,td.height)?ad.oc(h.x,h.y,td.width,td.height):ad.oc(h.x,h.y,td.width,td.height,new B(Ab.x,Ab.y,Ab.width,Ab.height)))}}D.Mb(Ab);break;case "Table":for(var bd=g.length,bi=this.padding,Qe=bi.left,ic=bi.top,xe=this.jt,Zb=0,Dc=0,ud=xe.length,jc=0,Wa=0;Wa<ud;Wa++)xe[Wa]&&(jc=Math.max(jc,xe[Wa].length));for(var kc=Math.min(this.vj,ud-1);kc!==ud&&(void 0===this.he[kc]||0===this.he[kc].Za);)kc++;for(var kc=Math.min(kc,ud-1),ci=-this.he[kc].qb,ef=
Math.min(this.fj,jc-1);ef!==jc&&(void 0===this.de[ef]||0===this.de[ef].Za);)ef++;for(var ef=Math.min(ef,jc-1),Kd=-this.de[ef].qb,fe=D.Cm(),Wa=0;Wa<ud;Wa++)if(xe[Wa]){var jc=xe[Wa].length,ph=this.me(Wa),Dc=ph.qb+ci+ic;0!==ph.Za&&(Dc+=ph.PE());for(var Ld=0;Ld<jc;Ld++)if(xe[Wa][Ld]){var qh=this.le(Ld),Zb=qh.qb+Kd+Qe;0!==qh.Za&&(Zb+=qh.PE());for(var pj=xe[Wa][Ld],rh=pj.length,Gk=0;Gk<rh;Gk++){var Gb=pj[Gk],ge=Gb.Fa,kd=Gb instanceof x?Gb:null;if(null===kd||kd.type!==Oo&&kd.type!==Po){fe.m(0,0);for(var Re=
1;Re<Gb.rowSpan&&!(Wa+Re>=this.Nq);Re++){var di=this.me(Wa+Re);fe.height+=di.total}for(Re=1;Re<Gb.cI&&!(Ld+Re>=this.fq);Re++){var ei=this.le(Ld+Re);fe.width+=ei.total}var qj=qh.Za+fe.width,rj=ph.Za+fe.height;h.x=Zb;h.y=Dc;h.width=qj;h.height=rj;var Jb=Zb,sh=Dc,th=qj,qa=rj;Zb+qj>e.width&&(th=Math.max(e.width-Zb,0));Dc+rj>e.height&&(qa=Math.max(e.height-Dc,0));var ca=Gb.alignment,$b=0,gg=0,fi=0,lc=0;if(ca.ed()){ca=this.gm;ca.fd()||(ca=gc);var $b=ca.x,gg=ca.y,fi=ca.offsetX,lc=ca.offsetY,gi=qh.alignment,
mc=ph.alignment;gi.fd()&&($b=gi.x,fi=gi.offsetX);mc.fd()&&(gg=mc.y,lc=mc.offsetY)}else $b=ca.x,gg=ca.y,fi=ca.offsetX,lc=ca.offsetY;if(isNaN($b)||isNaN(gg))gg=$b=.5,lc=fi=0;var ff=ge.width,Se=ge.height,gf=Gb.margin,ye=gf.left+gf.right,ze=gf.top+gf.bottom,cd=Xo(Gb,ph,qh,!1);!isNaN(Gb.Ea.width)||cd!==rf&&cd!==vo||(ff=Math.max(qj-ye,0));!isNaN(Gb.Ea.height)||cd!==rf&&cd!==uo||(Se=Math.max(rj-ze,0));var Md=Gb.kf,uh=Gb.hg,ff=Math.min(Md.width,ff),Se=Math.min(Md.height,Se),ff=Math.max(uh.width,ff),Se=Math.max(uh.height,
Se),$=Se+ze;h.x+=h.width*$b-(ff+ye)*$b+fi+gf.left;h.y+=h.height*gg-$*gg+lc+gf.top;Gb.visible&&(Pb(Jb,sh,th,qa,h.x,h.y,ge.width,ge.height)?Gb.oc(h.x,h.y,ff,Se):Gb.oc(h.x,h.y,ff,Se,new B(Jb,sh,th,qa)))}else{Gb.$i();Gb.ac.Ya();var hf=Gb.ac;hf.x=kd.type===Oo?Qe:Zb;hf.y=kd.type===Po?ic:Dc;hf.width=ge.width;hf.height=ge.height;Gb.ac.freeze();Ko(Gb,!1)}}}}D.Rk(fe);for(Wa=0;Wa<bd;Wa++)Gb=g[Wa],kd=Gb instanceof x?Gb:null,null===kd||kd.type!==Oo&&kd.type!==Po||(hf=Gb.ac,Gb.$c.Ya(),Gb.$c.m(0,0,hf.width,hf.height),
Gb.$c.freeze());break;case "Viewbox":var hg=g[0],vh=hg.Fa,wh=hg.margin,Nd=wh.top+wh.bottom,Hk=Math.max(vh.width+(wh.right+wh.left),0),vb=Math.max(vh.height+Nd,0),Xa=hg.alignment;Xa.ed()&&(Xa=this.gm);Xa.fd()||(Xa=gc);h.x=e.width*Xa.x-Hk*Xa.x+Xa.offsetX;h.y=e.height*Xa.y-vb*Xa.y+Xa.offsetY;h.width=vh.width;h.height=vh.height;hg.oc(h.x,h.y,h.width,h.height);break;case "Link":var hm=g.length;if(this instanceof da||this instanceof J){var Ik=null;this instanceof J&&(Ik=this);this instanceof da&&(Ik=this.Zf);
var sj=Ik,hi=this instanceof da?null:sj.path;if(null!==this.ph){var xc=this.ph.o,Ae=0;if(null!==hi&&Ae<this.ph.count){var vd=xc[Ae];Ae++;hi.oc(vd.x-this.wj.x,vd.y-this.wj.y,vd.width,vd.height)}for(var Pc=0;Pc<hm;Pc++){var Jk=g[Pc];Jk!==hi&&Ae<this.ph.count&&(vd=xc[Ae],Ae++,Jk.oc(vd.x-this.wj.x,vd.y-this.wj.y,vd.width,vd.height))}}var im=sj.points,jm=im.count;if(2<=jm&&this instanceof J)for(var If=this.If;If.next();){var Wb=If.value,Od=jm,Pd=im,Ec=Wb.Te,he=Wb.zB,wd=Wb.Gh,Fg=Wb.Oq,tj=Wb.AB,xh=0,yh=
0,ii=0;if(Ec<-Od||Ec>=Od){var ji=this.eG,ig=this.dG;Fg!==nj&&(ii=this.computeAngle(Wb,Fg,ig),Wb.angle=ii);xh=ji.x;yh=ji.y}else{var nc=void 0,Ya=void 0;if(0<=Ec)nc=Pd.o[Ec],Ya=Ec<Od-1?Pd.o[Ec+1]:nc;else var Qd=Od+Ec,nc=Pd.o[Qd],Ya=0<Qd?Pd.o[Qd-1]:nc;if(nc.Sc(Ya)){var Rd=void 0,jf=void 0;0<=Ec?(Rd=0<Ec?Pd.o[Ec-1]:nc,jf=Ec<Od-2?Pd.o[Ec+2]:Ya):(Rd=Qd<Od-1?Pd.o[Qd+1]:nc,jf=1<Qd?Pd.o[Qd-2]:Ya);var Jf=Rd.Cf(nc),rb=Ya.Cf(jf),ig=Jf>rb+10?0<=Ec?Rd.Jc(nc):nc.Jc(Rd):rb>Jf+10?0<=Ec?Ya.Jc(jf):jf.Jc(Ya):0<=Ec?Rd.Jc(jf):
jf.Jc(Rd)}else ig=0<=Ec?nc.Jc(Ya):Ya.Jc(nc);Fg!==nj&&(ii=this.computeAngle(Wb,Fg,ig),Wb.angle=ii);xh=nc.x+(Ya.x-nc.x)*he;yh=nc.y+(Ya.y-nc.y)*he}if(wd.O(bc))Wb.location=new O(xh,yh);else{wd.Zd()&&(wd=gc);var kf=D.Of();kf.reset();kf.scale(Wb.scale,Wb.scale);kf.rotate(Wb.angle,0,0);var ld=Wb.Ga,Gg=D.gh(0,0,ld.width,ld.height),lf=D.P();lf.so(Gg,wd);kf.vb(lf);var Fc=-lf.x,Kf=-lf.y,Te=tj.copy();isNaN(Te.x)&&(Te.x=0<=Ec?lf.x+3:-(lf.x+3));isNaN(Te.y)&&(Te.y=-(lf.y+3));Te.rotate(ig);xh+=Te.x;yh+=Te.y;kf.fH(Gg);
var Fc=Fc+Gg.x,Kf=Kf+Gg.y,Hg=D.Fb(xh+Fc,yh+Kf);Wb.move(Hg);D.A(Hg);D.A(lf);D.Mb(Gg);D.He(kf)}}this.Gu(!1)}break;case "Grid":break;case "Graduated":if(null!==this.Pm){var Ig=this.Vd(),uj=this.Rm,Kk=this.Pm,Be=0,dd=Kk[Be];Be++;Ig.oc(dd.x-e.x,dd.y-e.y,dd.width,dd.height);for(var Lk=g.length,zh=0;zh<Lk;zh++){var md=g[zh],vj=uj[zh];md.visible&&md!==Ig&&0!==vj.length&&(dd=Kk[Be],Be++,md.oc(dd.x-e.x,dd.y-e.y,dd.width,dd.height))}this.Pm=null}break;case "TableRow":case "TableColumn":D.k(this.toString()+" is not an element of a Table Panel.TableRow and TableColumn panels can only be elements of a Table Panel.");
break;default:D.k("Unknown panel type: "+u)}D.Mb(h)}};x.prototype.Mk=function(a){var b=this.Ga,c=Np(this);if(Pb(0,0,b.width,b.height,a.x,a.y)){for(var b=this.xa.o,d=b.length,e=D.Fb(0,0);d--;){var g=b[d];if(g.visible||g===c)if(hb(e.set(a),g.transform),g.Oa(e))return D.A(e),!0}D.A(e);return null===this.Kb&&null===this.hc?!1:!0}return!1};x.prototype.Gx=function(a){if(this.Jo===a)return this;for(var b=this.xa.o,c=b.length,d=0;d<c;d++){var e=b[d].Gx(a);if(null!==e)return e}return null};
function dp(a,b,c){c(a,b);if(b instanceof x){b=b.xa.o;for(var d=b.length,e=0;e<d;e++)dp(a,b[e],c)}}function Rm(a,b){Zp(a,a,b)}function Zp(a,b,c){c(b);b=b.xa.o;for(var d=b.length,e=0;e<d;e++){var g=b[e];g instanceof x&&Zp(a,g,c)}}x.prototype.walkVisualTree=x.prototype.AK=function(a){$p(this,this,a)};function $p(a,b,c){c(b);if(b instanceof x){b=b.xa.o;for(var d=b.length,e=0;e<d;e++)$p(a,b[e],c)}}x.prototype.findInVisualTree=x.prototype.gu=function(a){return aq(this,this,a)};
function aq(a,b,c){if(c(b))return b;if(b instanceof x){b=b.xa.o;for(var d=b.length,e=0;e<d;e++){var g=aq(a,b[e],c);if(null!==g)return g}}return null}x.prototype.findObject=x.prototype.Ed=function(a){if(this.name===a)return this;for(var b=this.xa.o,c=b.length,d=0;d<c;d++){var e=b[d];if(e.name===a)return e;if(e instanceof x)if(null===e.cj&&null===e.Eg){if(e=e.Ed(a),null!==e)return e}else if(pn(e)&&(e=e.xa.first(),null!==e&&(e=e.Ed(a),null!==e)))return e}return null};
function bq(a){a=a.xa.o;for(var b=a.length,c=0,d=0;d<b;d++){var e=a[d];if(e instanceof x)c=Math.max(c,bq(e));else if(e instanceof z){a:{if(null!==!e.Xf)switch(e.ap){case "None":case "Square":case "Ellipse":case "Circle":case "LineH":case "LineV":case "FramedRectangle":case "RoundedRectangle":case "Line1":case "Line2":case "Border":case "Cube1":case "Cube2":case "Junction":case "Cylinder1":case "Cylinder2":case "Cylinder3":case "Cylinder4":case "PlusLine":case "XLine":case "ThinCross":case "ThickCross":e=
0;break a}e=e.Ng/2*e.vn*e.Fj()}c=Math.max(c,e)}}return c}f=x.prototype;f.kh=function(){return!(this.type===Oo||this.type===Po)};
f.Ge=function(a,b,c){if(!1===this.pg)return null;void 0===b&&(b=null);void 0===c&&(c=null);if(Im(this))return null;var d=this.Ga,e=1/this.Fj(),g=this.kh(),h=g?a:hb(D.Fb(a.x,a.y),this.transform),k=this.g,l=10,m=5;null!==k&&(l=k.pu("extraTouchArea"),m=l/2);if(Pb(-(m*e),-(m*e),d.width+l*e,d.height+l*e,h.x,h.y)){if(!this.Yn){var e=this.xa.o,n=e.length,k=D.P(),m=(l=this.yq)?this.Vd():null;if(l&&(m.kh()?hb(k.set(a),m.transform):k.set(a),!m.Oa(k)))return D.A(k),g||D.A(h),null;for(var p=Np(this);n--;){var q=
e[n];if(q.visible||q===p)if(q.kh()?hb(k.set(a),q.transform):k.set(a),!l||q!==m){var r=null;q instanceof x?r=q.Ge(k,b,c):!0===q.pg&&q.Oa(k)&&(r=q);if(null!==r&&(null!==b&&(r=b(r)),null!==r&&(null===c||c(r))))return D.A(k),g||D.A(h),r}}D.A(k)}if(null===this.background&&null===this.Zl)return g||D.A(h),null;a=Pb(0,0,d.width,d.height,h.x,h.y)?this:null;g||D.A(h);return a}g||D.A(h);return null};
f.hu=function(a,b,c,d){if(!1===this.pg)return!1;void 0===b&&(b=null);void 0===c&&(c=null);d instanceof K||d instanceof L||(d=new K(P));var e=this.Ga,g=this.kh(),h=g?a:hb(D.Fb(a.x,a.y),this.transform);if(Pb(0,0,e.width,e.height,h.x,h.y)){if(!this.Yn){for(var e=this.xa.o,k=e.length,l=D.P(),m=Np(this);k--;){var n=e[k];if(n.visible||n===m){n.kh()?hb(l.set(a),n.transform):l.set(a);var p=n,n=n instanceof x?n:null;(null!==n?n.hu(l,b,c,d):p.Oa(l))&&!1!==p.pg&&(null!==b&&(p=b(p)),null===p||null!==c&&!c(p)||
d.add(p))}}D.A(l)}g||D.A(h);return null!==this.background||null!==this.Zl}g||D.A(h);return!1};
f.Qk=function(a,b,c,d,e,g){if(!1===this.pg)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var h=g;void 0===g&&(h=D.Of(),h.reset());h.multiply(this.transform);if(this.Hn(a,h))return cq(this,b,c,e),void 0===g&&D.He(h),!0;if(this.Wg(a,h)){if(!this.Yn)for(var k=Np(this),l=this.xa.o,m=l.length;m--;){var n=l[m];if(n.visible||n===k){var p=n.$,q=this.Ga;if(!(p.x>q.width||p.y>q.height||0>p.x+p.width||0>p.y+p.height)){p=n;n=n instanceof x?n:null;q=D.Of();q.set(h);if(null!==n?n.Qk(a,b,c,d,e,q):Io(p,a,d,
q))null!==b&&(p=b(p)),null===p||null!==c&&!c(p)||e.add(p);D.He(q)}}}void 0===g&&D.He(h);return d}void 0===g&&D.He(h);return!1};function cq(a,b,c,d){for(var e=a.xa.o,g=e.length;g--;){var h=e[g];if(h.visible){var k=h.$,l=a.Ga;k.x>l.width||k.y>l.height||0>k.x+k.width||0>k.y+k.height||(h instanceof x&&cq(h,b,c,d),null!==b&&(h=b(h)),null===h||null!==c&&!c(h)||d.add(h))}}}
f.On=function(a,b,c,d,e,g){if(!1===this.pg)return!1;void 0===c&&(c=null);void 0===d&&(d=null);var h=this.Ga,k=this.kh(),l=k?a:hb(D.Fb(a.x,a.y),this.transform),m=k?b:hb(D.Fb(b.x,b.y),this.transform),n=l.Cf(m),p=0<l.x&&l.x<h.width&&0<l.y&&l.y<h.height||jb(l.x,l.y,0,0,0,h.height)<n||jb(l.x,l.y,0,h.height,h.width,h.height)<n||jb(l.x,l.y,h.width,h.height,h.width,0)<n||jb(l.x,l.y,h.width,0,0,0)<n,h=0<l.x&&l.x<h.width&&0<l.y&&l.y<h.height&&jb(l.x,l.y,0,0,0,h.height)<n&&jb(l.x,l.y,0,h.height,h.width,h.height)<
n&&jb(l.x,l.y,h.width,h.height,h.width,0)<n&&jb(l.x,l.y,h.width,0,0,0)<n;k||(D.A(l),D.A(m));if(p){if(!this.Yn){for(var k=D.P(),l=D.P(),m=Np(this),n=this.xa.o,q=n.length;q--;){var r=n[q];if(r.visible||r===m){var s=r.$,u=this.Ga;s.x>u.width||s.y>u.height||0>s.x+s.width||0>s.y+s.height||(r.kh()?(s=r.transform,hb(k.set(a),s),hb(l.set(b),s)):(k.set(a),l.set(b)),s=r,r=r instanceof x?r:null,null!==r?!r.On(k,l,c,d,e,g):!s.pF(k,l,e))||(null!==c&&(s=c(s)),null===s||null!==d&&!d(s)||g.add(s))}}D.A(k);D.A(l)}return e?
p:h}return!1};function Op(a){var b=null;a instanceof z&&(b=a.C,b===Tc&&(b=null),a=a.Df,null!==a&&null===b&&(b=a.C));null===b&&(b=cc);return b}function Pp(a){var b=null;a instanceof z&&(b=a.D,b===Tc&&(b=null),a=a.Df,null!==a&&null===b&&(b=a.D));null===b&&(b=rc);return b}x.prototype.add=x.prototype.add=function(a){D.l(a,P,x,"add:element");this.Xd(this.xa.count,a)};x.prototype.elt=x.prototype.ea=function(a){return this.xa.ea(a)};
x.prototype.insertAt=x.prototype.Xd=function(a,b){b instanceof F&&D.k("Cannot add a Part to a Panel: "+b);if(this===b||this.tm(b))this===b&&D.k("Cannot make a Panel contain itself: "+this.toString()),D.k("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+b.toString());var c=b.Q;null!==c&&c!==this&&D.k("Cannot add a GraphObject that already belongs to another Panel to this Panel: "+b.toString()+", already contained by "+c.toString()+", cannot be shared by this Panel: "+
this.toString());this.ca!==Nl||b instanceof z||D.k("Can only add Shapes to a Grid Panel, not: "+b);this.ca!==mp||b instanceof z||b instanceof na||D.k("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+b);b.ym(this);b.kn=null;if(null!==this.Xk){var d=b.data;null!==d&&"object"===typeof d&&(null===this.Dg&&(this.Dg=new ma(Object,x)),this.Dg.add(d,b))}var e=this.xa,d=-1;if(c===this){for(var g=-1,h=this.xa.o,k=h.length,l=0;l<k;l++)if(h[l]===b){g=l;break}if(-1!==g){if(g===a||g+1>=e.count&&
a>=e.count)return;e.jd(g);d=g}else D.k("element "+b.toString()+" has panel "+c.toString()+" but is not contained by it.")}if(0>a||a>e.count)a=e.count;e.Xd(a,b);this.K();b.K();null!==b.sd?this.Uk=!0:b instanceof x&&!0===b.Uk&&(this.Uk=!0);this.kk=null;c=this.Y;null!==c&&(c.Jl=null,c.tk=NaN,this.Uk&&c instanceof G&&(c.Uk=!0),c.Uk&&c instanceof G&&(c.xe=null),e=this.g,null!==e&&e.ra.nb||(-1!==d&&c.hd(ng,"elements",this,b,null,d,null),c.hd(mg,"elements",this,null,b,null,a),this.vu()||dq(this,b,!1)))};
D.defineProperty(x,{Uk:null},function(){return 0!==(this.T&8388608)},function(a){0!==(this.T&8388608)!==a&&(this.T^=8388608)});function eq(a,b){a.T=b?a.T|16777216:a.T&-16777217}x.prototype.remove=x.prototype.remove=function(a){D.l(a,P,x,"remove:element");for(var b=this.xa.o,c=b.length,d=-1,e=0;e<c;e++)if(b[e]===a){d=e;break}-1!==d&&this.rf(d)};x.prototype.removeAt=x.prototype.jd=function(a){v&&D.p(a,x,"removeAt:idx");0<=a&&this.rf(a)};
x.prototype.rf=function(a){var b=this.xa,c=b.ea(a);c.kn=null;c.ym(null);if(null!==this.Dg){var d=c.data;"object"===typeof d&&this.Dg.remove(d)}b.jd(a);em(this,!1);this.K();this.wn===c&&(this.wn=null);this.kk=null;b=this.Y;null!==b&&(b.Jl=null,b.tk=NaN,b.ne(),d=this.g,null!==d&&d.ra.nb||b.hd(ng,"elements",this,c,null,a,null))};D.w(x,{Nq:"rowCount"},function(){return void 0===this.he?0:this.he.length});
x.prototype.getRowDefinition=x.prototype.me=function(a){v&&D.p(a,x,"getRowDefinition:idx");0>a&&D.ua(a,">= 0",x,"getRowDefinition:idx");a=Math.round(a);var b=this.he;if(void 0===b[a]){var c=new ch;c.ym(this);c.Ie=!0;c.index=a;b[a]=c}return b[a]};x.prototype.removeRowDefinition=x.prototype.wG=function(a){v&&D.p(a,x,"removeRowDefinition:idx");0>a&&D.ua(a,">= 0",x,"removeRowDefinition:idx");a=Math.round(a);var b=this.he;this.hd(ng,"coldefs",this,b[a],null,a,null);b[a]&&delete b[a];this.K()};
D.w(x,{fq:"columnCount"},function(){return void 0===this.de?0:this.de.length});x.prototype.getColumnDefinition=x.prototype.le=function(a){v&&D.p(a,x,"getColumnDefinition:idx");0>a&&D.ua(a,">= 0",x,"getColumnDefinition:idx");a=Math.round(a);var b=this.de;if(void 0===b[a]){var c=new ch;c.ym(this);c.Ie=!1;c.index=a;b[a]=c}return b[a]};
x.prototype.removeColumnDefinition=x.prototype.tG=function(a){v&&D.p(a,x,"removeColumnDefinition:idx");0>a&&D.ua(a,">= 0",x,"removeColumnDefinition:idx");a=Math.round(a);var b=this.de;this.hd(ng,"coldefs",this,b[a],null,a,null);b[a]&&delete b[a];this.K()};
D.defineProperty(x,{cK:"rowSizing"},function(){return void 0===this.nn?lp:this.nn},function(a){if(void 0!==this.nn){var b=this.nn;b!==a&&(a!==lp&&a!==Rp&&D.k("Panel.rowSizing must be RowColumnDefinition.ProportionalExtra or RowColumnDefinition.None, not: "+a),this.nn=a,this.K(),this.i("rowSizing",b,a))}});
D.defineProperty(x,{bI:"columnSizing"},function(){return void 0===this.Km?lp:this.Km},function(a){if(void 0!==this.Km){var b=this.Km;b!==a&&(a!==lp&&a!==Rp&&D.k("Panel.columnSizing must be RowColumnDefinition.ProportionalExtra or RowColumnDefinition.None, not: "+a),this.Km=a,this.K(),this.i("columnSizing",b,a))}});
D.defineProperty(x,{cH:"topIndex"},function(){return void 0===this.vj?0:this.vj},function(a){if(void 0!==this.vj){var b=this.vj;b!==a&&((!isFinite(a)||0>a)&&D.k("Panel.topIndex must be greater than zero and a real number, not: "+a),this.vj=a,this.K(),this.i("topIndex",b,a))}});
D.defineProperty(x,{$F:"leftIndex"},function(){return void 0===this.fj?0:this.fj},function(a){if(void 0!==this.fj){var b=this.fj;b!==a&&((!isFinite(a)||0>a)&&D.k("Panel.leftIndex must be greater than zero and a real number, not: "+a),this.fj=a,this.K(),this.i("leftIndex",b,a))}});x.prototype.findRowForLocalY=function(a){if(0>a)return-1;if(this.type!==ea)return NaN;for(var b=0,c=this.he,d=c.length,e=this.vj;e<d;e++){var g=c[e];if(void 0!==g&&(b+=g.total,a<b))return e}return-1};
x.prototype.findColumnForLocalX=function(a){if(0>a)return-1;if(this.type!==ea)return NaN;for(var b=0,c=this.de,d=c.length,e=this.fj;e<d;e++){var g=c[e];if(void 0!==g&&(b+=g.total,a<b))return e}return-1};x.prototype.graduatedPointForValue=function(a,b){void 0===b&&(b=new O(NaN,NaN));if(this.type!==mp)return b.m(NaN,NaN),b;a=Math.min(Math.max(a,this.Tk),this.QA);var c=(a-this.Tk)/this.Nx,d=this.Vd();d.Df.NI(c,b);c=D.Of();c.set(d.transform);b.transform(c);D.He(c);return b};
x.prototype.graduatedValueForPoint=function(a){if(this.type!==mp)return NaN;var b=this.Vd(),c=b.Df,d=D.Of();d.set(b.transform);d.Qx();a.transform(d);D.He(d);return c.JI(a)*this.Nx+this.Tk};
D.defineProperty(x,{data:"data"},function(){return this.Nd},function(a){var b=this.Nd;if(b!==a){var c=this instanceof F&&!(this instanceof da);c&&D.h(a,"object",x,"data");Kh(this);this.Nd=a;var d=this.g;null!==d&&(c?this instanceof J?(null!==b&&d.ck.remove(b),null!==a&&d.ck.add(a,this)):this instanceof F&&(null!==b&&d.Ti.remove(b),null!==a&&d.Ti.add(a,this)):(c=this.Q,null!==c&&null!==c.Dg&&(null!==b&&c.Dg.remove(b),null!==a&&c.Dg.add(a,this))));this.i("data",b,a);null!==d&&d.ra.nb||null!==a&&this.Nb()}});
D.defineProperty(x,{Au:"itemIndex"},function(){return this.ns},function(a){var b=this.ns;b!==a&&(this.ns=a,this.i("itemIndex",b,a))});function ep(a){a=a.pl;return null!==a&&a.J}
function Kh(a){var b=a.pl;if(null===b)null!==a.data&&D.k("Template cannot have .data be non-null: "+a),a.pl=b=new K(ih);else if(b.J)return;var c=new K(P);eq(a,!1);dp(a,a,function(a,d){var e=d.Bc;if(null!==e)for($o(d,!1),e=e.j;e.next();){var g=e.value;g.mode===kh&&$o(d,!0);var h=g.Vq;null!==h&&("/"===h&&eq(a,!0),h=lh(g,a,d),null!==h&&(c.add(h),null===h.Np&&(h.Np=new K(ih)),h.Np.add(g)));b.add(g)}if(d instanceof x&&d.type===ea){if(0<d.he.length)for(e=d.he,g=e.length,h=0;h<g;h++){var k=e[h];if(void 0!==
k&&null!==k.Bc)for(var l=k.Bc.j;l.next();){var t=l.value;t.Og=k;t.Et=2;t.Up=k.index;b.add(t)}}if(0<d.de.length)for(e=d.de,g=e.length,h=0;h<g;h++)if(k=e[h],void 0!==k&&null!==k.Bc)for(l=k.Bc.j;l.next();)t=l.value,t.Og=k,t.Et=1,t.Up=k.index,b.add(t)}});for(var d=c.j;d.next();){var e=d.value;if(null!==e.Np){$o(e,!0);for(var g=e.Np.j;g.next();){var h=g.value;null===e.Bc&&(e.Bc=new K(ih));e.Bc.add(h)}}e.Np=null}for(d=b.j;d.next();)if(e=d.value,g=e.Og,null!==g){e.Og=null;var k=e.ev,l=k.indexOf(".");0<l&&
g instanceof x&&(h=k.substring(0,l),k=k.substr(l+1),l=g.Ed(h),null!==l?(g=l,e.ev=k):D.trace('Warning: unable to find GraphObject named "'+h+'" for Binding: '+e.toString()));g instanceof ch?(e.Bm=D.Fd(g.Q),g.Q.Jo=e.Bm):(e.Bm=D.Fd(g),g.Jo=e.Bm)}b.freeze();a instanceof F&&(a.oe()&&a.hf(),v&&!fq&&dp(a,a,function(a,c){if(c instanceof x&&(c.type===Kl||c.type===Qj||c.type===mp)&&1>=c.elements.count&&!(c instanceof F)){if(1===c.elements.count){var d=null!==c.Xk;if(!d)for(var e=b.j;e.next();)if("itemArray"===
e.value.ev){d=!0;break}}d||(D.trace("Auto, Spot, or Graduated Panel should not have zero or one elements: "+c.toString()+" in "+a.toString()),fq=!0)}}))}var fq=!1;x.prototype.copyTemplate=function(){var a=this.copy();a.AK(function(a){a instanceof x&&(a.pl=null,a.Nd=null);var c=a.Bc;null!==c&&(a.Bc=null,c.each(function(c){a.bind(c.copy())}))});return a};
x.prototype.updateTargetBindings=x.prototype.Nb=function(a){var b=this.pl;if(null!==b)for(void 0===a&&(a=""),b=b.j;b.next();){var c=b.value,d=c.TG;if(""===a||""===d||d===a)if(d=c.ev,null!==c.gI||""!==d){var d=this.data,e=c.Vq;if(null!==e)d=""===e?this:"/"===e?this:"."===e?this:".."===e?this:this.Ed(e);else{var g=this.g;null!==g&&c.Yx&&(d=g.ga.Yk)}if(null===d)v&&D.trace("Binding error: missing GraphObject named "+e+" in "+this.toString());else{var g=this,h=c.Bm;if(-1!==h){if(g=this.Gx(h),null===g)continue}else null!==
c.Og&&(g=c.Og);"/"===e?d=g.Y:"."===e?d=g:".."===e&&(d=g.Q);e=c.Et;if(0!==e){if(!(g instanceof x))continue;h=g;1===e?g=h.le(c.Up):2===e&&(g=h.me(c.Up))}void 0!==g&&c.iH(g,d)}}}};
D.defineProperty(x,{Xk:"itemArray"},function(){return this.cj},function(a){var b=this.cj;if(b!==a){v&&null!==a&&!D.isArray(a)&&D.k("Panel.itemArray must be an Array-like object or null, not: "+a);var c=this.g;null!==c&&null!==b&&Xm(c,this);this.cj=a;null!==c&&null!==a&&Tm(c,this);this.i("itemArray",b,a);null!==c&&c.ra.nb||this.uB()}});function pn(a){return a.type===Qj||a.type===Kl||a.type===kj||a.type===ea&&0<a.xa.length&&(a=a.xa.ea(0),a.Gf&&a instanceof x&&(a.type===Oo||a.type===Po))?!0:!1}
x.prototype.rebuildItemElements=x.prototype.uB=function(){var a=0;for(pn(this)&&(a=1);this.xa.length>a;)this.rf(this.xa.length-1);a=this.Xk;if(null!==a)for(var b=D.cb(a),c=0;c<b;c++)on(this,D.La(a,c),c)};x.prototype.findItemPanelForData=x.prototype.DI=function(a){if(void 0===a||null===a||null===this.Dg)return null;D.h(a,"object",x,"findItemPanelForData");return this.Dg.oa(a)};
function on(a,b,c){if(!(void 0===b||null===b||0>c)){var d;d=gq(a,b);var e=a.mJ,g=null;null!==e&&(g=e.oa(d));null===g&&(hq||(hq=!0,D.trace('No item template Panel found for category "'+d+'" on '+a),D.trace("  Using default item template."),d=new x,e=new na,e.bind(new ih("text","",ja)),d.add(e),iq=d),g=iq);d=g;null!==d&&(Kh(d),d=d.copy(),0!==(d.T&16777216)&&(e=a.lm(),null!==e&&eq(e,!0)),"object"===typeof b&&(null===a.Dg&&(a.Dg=new ma(Object,x)),a.Dg.add(b,d)),e=c,pn(a)&&e++,a.Xd(e,d),d.Nd=b,qn(a,e,
c),d.Nd=null,d.data=b)}}function qn(a,b,c){for(a=a.xa;b<a.length;){var d=a.ea(b);if(d instanceof x){var e=b,g=c;d.type===Oo?d.Zb=e:d.type===Po&&(d.column=e);d.Au=g}b++;c++}}
D.defineProperty(x,{LL:"itemTemplate"},function(){return null===this.Eg?null:this.Eg.oa("")},function(a){if(null===this.Eg){if(null===a)return;this.Eg=new ma("string",x)}var b=this.Eg.oa("");b!==a&&(D.l(a,x,x,"itemTemplate"),(a instanceof F||a.Gf)&&D.k("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+a),this.Eg.add("",a),this.i("itemTemplate",b,a),a=this.g,null!==a&&a.ra.nb||this.uB())});
D.defineProperty(x,{mJ:"itemTemplateMap"},function(){return this.Eg},function(a){var b=this.Eg;if(b!==a){D.l(a,ma,x,"itemTemplateMap");for(var c=a.j;c.next();){var d=c.value;(d instanceof F||d.Gf)&&D.k("Template in Panel.itemTemplateMap must not be a Part or be Panel.isPanelMain: "+d)}this.Eg=a;this.i("itemTemplateMap",b,a);a=this.g;null!==a&&a.ra.nb||this.uB()}});
D.defineProperty(x,{WF:"itemCategoryProperty"},function(){return this.qp},function(a){var b=this.qp;b!==a&&("string"!==typeof a&&"function"!==typeof a&&D.gc(a,"string or function",x,"itemCategoryProperty"),this.qp=a,this.i("itemCategoryProperty",b,a))});
function gq(a,b){if(null===b)return"";var c=a.qp,d="";if("function"===typeof c)d=c(b);else if("string"===typeof c&&"object"===typeof b){if(""===c)return"";d=D.ub(b,c)}else return"";if(void 0===d)return"";if("string"===typeof d)return d;D.k("Panel.getCategoryForItemData found a non-string category for "+b+": "+d);return""}var hq=!1,iq=null;
D.defineProperty(x,{Yn:"isAtomic"},function(){return 0!==(this.T&1048576)},function(a){var b=0!==(this.T&1048576);b!==a&&(D.h(a,"boolean",x,"isAtomic"),this.T^=1048576,this.i("isAtomic",b,a))});D.defineProperty(x,{yq:"isClipping"},function(){return 0!==(this.T&2097152)},function(a){var b=0!==(this.T&2097152);b!==a&&(D.h(a,"boolean",x,"isClipping"),this.T^=2097152,this.K(),this.i("isClipping",b,a))});
D.defineProperty(x,{TF:"isOpposite"},function(){return 0!==(this.T&33554432)},function(a){var b=0!==(this.T&33554432);b!==a&&(D.h(a,"boolean",x,"isOpposite"),this.T^=33554432,this.K(),this.i("isOpposite",b,a))});D.defineProperty(x,{isEnabled:"isEnabled"},function(){return 0!==(this.T&4194304)},function(a){var b=0!==(this.T&4194304);if(b!==a){D.h(a,"boolean",x,"isEnabled");var c=null===this.Q||this.Q.vu();this.T^=4194304;this.i("isEnabled",b,a);b=this.g;null!==b&&b.ra.nb||c&&dq(this,this,a)}});
function dq(a,b,c){var d=b.iF;null!==d&&d(b,c);if(b instanceof x){b=b.xa.o;for(var d=b.length,e=0;e<d;e++){var g=b[e];c&&g instanceof x&&!g.isEnabled||dq(a,g,c)}}}D.defineProperty(x,{EK:"alignmentFocusName"},function(){return this.$j},function(a){var b=this.$j;b!==a&&(v&&D.h(a,"string",x,"alignmentFocusName"),this.$j=a,this.K(),this.i("alignmentFocusName",b,a))});
function ch(){D.tc(this);this.Bh=null;this.hw=!0;this.Cc=0;this.pf=NaN;this.vk=0;this.uk=Infinity;this.re=Tc;this.qb=this.Za=0;this.Bc=null;this.vt=jq;this.Mg=to;this.qt=this.zk=null;this.rt=NaN;this.Kb=this.ni=null;this.yr=!1}D.ja("RowColumnDefinition",ch);
ch.prototype.copy=function(){var a=new ch;a.hw=this.hw;a.Cc=this.Cc;a.pf=this.pf;a.vk=this.vk;a.uk=this.uk;a.re=this.re;a.Za=this.Za;a.qb=this.qb;a.Mg=this.Mg;a.vt=this.vt;a.zk=null===this.zk?null:this.zk.V();a.qt=this.qt;a.rt=this.rt;a.ni=null;null!==this.ni&&(a.ni=D.cm(this.ni));a.Kb=this.Kb;a.yr=this.yr;a.Bc=this.Bc;return a};
ch.prototype.gq=function(a){D.l(a,ch,ch,"copyFrom:pd");a.Ie?this.height=a.height:this.width=a.width;this.Pj=a.Pj;this.vf=a.vf;this.alignment=a.alignment;this.stretch=a.stretch;this.bv=a.bv;this.zk=null===a.zk?null:a.zk.V();this.Pq=a.Pq;this.Qq=a.Qq;this.ni=null;a.ni&&(this.ni=D.cm(a.ni));this.background=a.background;this.zA=a.zA;this.Bc=a.Bc};ch.prototype.nc=function(a){a.Ne===ch?this.bv=a:D.Xj(this,a)};
ch.prototype.toString=function(){return"RowColumnDefinition "+(this.Ie?"(Row ":"(Column ")+this.index+") #"+D.Fd(this)};var jq;ch.Default=jq=D.s(ch,"Default",0);var Rp;ch.None=Rp=D.s(ch,"None",1);var lp;ch.ProportionalExtra=lp=D.s(ch,"ProportionalExtra",2);ch.prototype.ym=function(a){this.Bh=a};
ch.prototype.computeEffectiveSpacingTop=ch.prototype.PE=function(){var a=0;if(0!==this.index){var b=this.Bh,c=this.Pq;null===c&&null!==b&&(c=this.Ie?b.Ui:b.$h);null!==c&&(a=this.Qq,isNaN(a)&&(a=null!==b?this.Ie?b.bi:b.ai:0))}b=this.NG;if(null===b)if(b=this.Bh,null!==b)b=b.dk;else return a;return a+(this.Ie?b.top:b.left)};
ch.prototype.computeEffectiveSpacing=ch.prototype.ff=function(){var a=0;if(0!==this.index){var b=this.Bh,c=this.Pq;null===c&&null!==b&&(c=this.Ie?b.Ui:b.$h);null!==c&&(a=this.Qq,isNaN(a)&&(a=null!==b?this.Ie?b.bi:b.ai:0))}b=this.NG;if(null===b)if(b=this.Bh,null!==b)b=b.dk;else return a;return a+(this.Ie?b.top+b.bottom:b.left+b.right)};
ch.prototype.pd=function(a,b,c,d,e){var g=this.Bh;if(null!==g&&(g.hd(cg,a,this,b,c,d,e),null!==this.Bc&&(b=g.g,null!==b&&!b.Ue&&(g=g.lm(),null!==g&&(b=g.data,null!==b)))))for(c=this.Bc.j;c.next();)c.value.Jy(this,b,a,g)};D.w(ch,{Q:"panel"},function(){return this.Bh});D.defineProperty(ch,{Ie:"isRow"},function(){return this.hw},function(a){this.hw=a});D.defineProperty(ch,{index:"index"},function(){return this.Cc},function(a){this.Cc=a});
D.defineProperty(ch,{height:"height"},function(){return this.pf},function(a){var b=this.pf;b!==a&&(v&&D.h(a,"number",ch,"height"),0>a&&D.ua(a,">= 0",ch,"height"),this.pf=a,this.Qa=this.Za,null!==this.Q&&this.Q.K(),this.pd("height",b,a))});D.defineProperty(ch,{width:"width"},function(){return this.pf},function(a){var b=this.pf;b!==a&&(v&&D.h(a,"number",ch,"width"),0>a&&D.ua(a,">= 0",ch,"width"),this.pf=a,this.Qa=this.Za,null!==this.Q&&this.Q.K(),this.pd("width",b,a))});
D.defineProperty(ch,{Pj:"minimum"},function(){return this.vk},function(a){var b=this.vk;b!==a&&(v&&D.h(a,"number",ch,"minimum"),(0>a||!isFinite(a))&&D.ua(a,">= 0",ch,"minimum"),this.vk=a,this.Qa=this.Za,null!==this.Q&&this.Q.K(),this.pd("minimum",b,a))});D.defineProperty(ch,{vf:"maximum"},function(){return this.uk},function(a){var b=this.uk;b!==a&&(v&&D.h(a,"number",ch,"maximum"),0>a&&D.ua(a,">= 0",ch,"maximum"),this.uk=a,this.Qa=this.Za,null!==this.Q&&this.Q.K(),this.pd("maximum",b,a))});
D.defineProperty(ch,{alignment:"alignment"},function(){return this.re},function(a){var b=this.re;b.O(a)||(v&&D.l(a,R,ch,"alignment"),this.re=a.V(),null!==this.Q&&this.Q.K(),this.pd("alignment",b,a))});D.defineProperty(ch,{stretch:"stretch"},function(){return this.Mg},function(a){var b=this.Mg;b!==a&&(v&&D.Ca(a,P,ch,"stretch"),this.Mg=a,null!==this.Q&&this.Q.K(),this.pd("stretch",b,a))});
D.defineProperty(ch,{NG:"separatorPadding"},function(){return this.zk},function(a){"number"===typeof a?a=new Hb(a):null!==a&&v&&D.l(a,Hb,ch,"separatorPadding");var b=this.zk;null!==a&&null!==b&&b.O(a)||(null!==a&&(a=a.V()),this.zk=a,null!==this.Q&&this.Q.K(),this.pd("separatorPadding",b,a))});
D.defineProperty(ch,{Pq:"separatorStroke"},function(){return this.qt},function(a){var b=this.qt;b!==a&&(null===a||"string"===typeof a||a instanceof Ba)&&(a instanceof Ba&&a.freeze(),this.qt=a,null!==this.Q&&this.Q.K(),this.pd("separatorStroke",b,a))});D.defineProperty(ch,{Qq:"separatorStrokeWidth"},function(){return this.rt},function(a){var b=this.rt;b!==a&&(this.rt=a,null!==this.Q&&this.Q.K(),this.pd("separatorStrokeWidth",b,a))});
D.defineProperty(ch,{rM:"separatorDashArray"},function(){return this.ni},function(a){var b=this.ni;if(b!==a){null===a||Array.isArray(a)||D.gc(a,"Array",ch,"separatorDashArray:value");if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var g=a[e];"number"===typeof g&&0<=g&&isFinite(g)||D.k("separatorDashArray value "+g+" at index "+e+" must be a positive number or zero.");d+=g}if(0===d){if(null===b)return;a=null}}this.ni=a;null!==this.Q&&this.Q.qa();this.pd("separatorDashArray",b,a)}});
D.defineProperty(ch,{background:"background"},function(){return this.Kb},function(a){var b=this.Kb;b!==a&&(null===a||"string"===typeof a||a instanceof Ba)&&(a instanceof Ba&&a.freeze(),this.Kb=a,null!==this.Q&&this.Q.qa(),this.pd("background",b,a))});D.defineProperty(ch,{zA:"coversSeparators"},function(){return this.yr},function(a){var b=this.yr;b!==a&&(D.h(a,"boolean",ch,"coversSeparators"),this.yr=a,null!==this.Q&&this.Q.qa(),this.pd("coversSeparators",b,a))});
D.defineProperty(ch,{bv:"sizing"},function(){return this.vt},function(a){var b=this.vt;b!==a&&(v&&D.Ca(a,ch,ch,"sizing"),this.vt=a,null!==this.Q&&this.Q.K(),this.pd("sizing",b,a))});function Qp(a){if(a.bv===jq){var b=a.Bh;return a.Ie?b.cK:b.bI}return a.bv}D.defineProperty(ch,{Qa:"actual"},function(){return this.Za},function(a){this.Za=isNaN(this.pf)?Math.max(Math.min(this.uk,a),this.vk):Math.max(Math.min(this.uk,this.pf),this.vk)});
D.defineProperty(ch,{total:"total"},function(){return this.Za+this.ff()},function(a){this.Za=isNaN(this.pf)?Math.max(Math.min(this.uk,a),this.vk):Math.max(Math.min(this.uk,this.pf),this.vk);this.Za=Math.max(0,this.Za-this.ff())});D.defineProperty(ch,{position:"position"},function(){return this.qb},function(a){this.qb=a});
ch.prototype.bind=ch.prototype.bind=function(a){a.Og=this;var b=this.Q;if(null!==b){var c=b.lm();null!==c&&ep(c)&&D.k("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+a+" on "+b)}null===this.Bc&&(this.Bc=new K(ih));this.Bc.add(a)};
function z(){P.call(this);this.Xf=this.ob=null;this.ap="None";this.Wr=to;this.xc=this.Od="black";this.Ng=1;this.Qp="butt";this.Sp="miter";this.vn=10;this.Rp=null;this.Af=0;this.vi=this.ui=Tc;this.Ts=this.Ss=NaN;this.es=!1;this.Vs=null;this.dp=this.Wp="None";this.Bg=1;this.Ag=0;this.zg=1}D.Sa(z,P);D.ja("Shape",z);
z.prototype.cloneProtected=function(a){P.prototype.cloneProtected.call(this,a);a.ob=this.ob;a.ap=this.ap;a.Wr=this.Wr;a.Xf=this.Xf;a.Od=this.Od;a.xc=this.xc;a.Ng=this.Ng;a.Qp=this.Qp;a.Sp=this.Sp;a.vn=this.vn;null!==this.Rp&&(a.Rp=D.cm(this.Rp));a.Af=this.Af;a.ui=this.ui.V();a.vi=this.vi.V();a.Ss=this.Ss;a.Ts=this.Ts;a.es=this.es;a.Vs=this.Vs;a.Wp=this.Wp;a.dp=this.dp;a.Bg=this.Bg;a.Ag=this.Ag;a.zg=this.zg};
z.prototype.nc=function(a){a===Sj||a===Uj||a===Vj||a===to?this.NA=a:P.prototype.nc.call(this,a)};z.prototype.toString=function(){return"Shape("+("None"!==this.Jb?this.Jb:"None"!==this.Wq?this.Wq:this.LA)+")#"+D.Fd(this)};
function kq(a,b,c,d){var e=c.length;if(!(4>e)){for(var g=d.Fa,h=Math.max(1,g.width),g=g.height,k=c[0],l=c[1],m=0,n=0,p=0,q=0,r=0,s=0,u=q=0,t=D.tb(),y=2;y<e;y+=2)m=c[y],n=c[y+1],p=m-k,q=n-l,0===p&&(p=.001),r=q/p,s=Math.atan2(q,p),q=Math.sqrt(p*p+q*q),t.push([p,s,r,q]),u+=q,k=m,l=n;k=c[0];l=c[1];p=d.Fa.width;d instanceof z&&(p-=d.jb);1>p&&(p=1);for(var e=c=p,m=h/2,n=0===m?!1:!0,y=0,q=t[y],p=q[0],s=q[1],r=q[2],q=q[3],w=0;.1<=u;){0===w&&(n?(e=c,e-=m,u-=m,n=!1):e=c,0===e&&(e=1));if(e>u){D.Aa(t);return}e>
q?(w=e-q,e=q):w=0;var C=Math.sqrt(e*e/(1+r*r));0>p&&(C=-C);k+=C;l+=r*C;a.translate(k,l);a.rotate(s);a.translate(-(h/2),-(g/2));0===w&&d.Pk(a,b);a.translate(h/2,g/2);a.rotate(-s);a.translate(-k,-l);u-=e;q-=e;if(0!==w){y++;if(y===t.length){D.Aa(t);return}q=t[y];p=q[0];s=q[1];r=q[2];q=q[3];e=w}}D.Aa(t)}}
z.prototype.Pk=function(a,b){if(null!==this.xc||null!==this.Od){null!==this.Od&&So(this,a,this.Od,!0,!1);null!==this.xc&&So(this,a,this.xc,!1,!1);var c=this.Ng;if(0===c){var d=this.Y;d instanceof da&&d.type===kj&&"Selection"===d.Dd&&d.zb instanceof z&&d.Zf.Vd()===d.zb&&(c=d.zb.jb)}a.lineWidth=c;a.lineJoin=this.Sp;a.lineCap=this.Qp;a.miterLimit=this.vn;var e=!1;this.Y&&b.Gj("drawShadows")&&(e=this.Y.Wk);var g=!0;null!==this.xc&&null===this.Od&&(g=!1);var d=!1,h=!0,k=this.WG;null!==k&&(d=!0,h=a.GA(k,
this.Af));var l=this.ob;if(null!==l){if(l.ca===sf)a.beginPath(),d&&!h?Do(a,l.wc,l.Gc,l.Ab,l.Ib,k,this.Af):(a.moveTo(l.wc,l.Gc),a.lineTo(l.Ab,l.Ib)),null!==this.Od&&a.Ug(this.Od),0!==c&&null!==this.xc&&a.Vj();else if(l.ca===tf){var m=l.wc,n=l.Gc,p=l.Ab,q=l.Ib,l=Math.min(m,p),r=Math.min(n,q),m=Math.abs(p-m),n=Math.abs(q-n);null!==this.Od&&(a.beginPath(),a.rect(l,r,m,n),a.Ug(this.Od));if(null!==this.xc){var s=p=0,u=0;g&&e&&(p=a.shadowOffsetX,s=a.shadowOffsetY,u=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=
0,a.shadowBlur=0);d&&!h?(h=D.tb(),h.push(l),h.push(r),h.push(l+m),h.push(r),h.push(l+m),h.push(r+n),h.push(l),h.push(r+n),h.push(l),h.push(r),a.beginPath(),lq(a,h,k,this.Af),a.Vj(),D.Aa(h)):0!==c&&(a.beginPath(),a.rect(l,r,m,n),a.Vj());g&&e&&(a.shadowOffsetX=p,a.shadowOffsetY=s,a.shadowBlur=u)}}else if(l.ca===uf)m=l.wc,n=l.Gc,p=l.Ab,q=l.Ib,l=Math.abs(p-m)/2,r=Math.abs(q-n)/2,m=Math.min(m,p)+l,n=Math.min(n,q)+r,a.beginPath(),a.moveTo(m,n-r),a.bezierCurveTo(m+Fd*l,n-r,m+l,n-Fd*r,m+l,n),a.bezierCurveTo(m+
l,n+Fd*r,m+Fd*l,n+r,m,n+r),a.bezierCurveTo(m-Fd*l,n+r,m-l,n+Fd*r,m-l,n),a.bezierCurveTo(m-l,n-Fd*r,m-Fd*l,n-r,m,n-r),a.closePath(),null!==this.Od&&a.Ug(this.Od),d&&!h&&(h=D.tb(),Fe(m,n-r,m+Fd*l,n-r,m+l,n-Fd*r,m+l,n,.5,h),Fe(m+l,n,m+l,n+Fd*r,m+Fd*l,n+r,m,n+r,.5,h),Fe(m,n+r,m-Fd*l,n+r,m-l,n+Fd*r,m-l,n,.5,h),Fe(m-l,n,m-l,n-Fd*r,m-Fd*l,n-r,m,n-r,.5,h),a.beginPath(),lq(a,h,k,this.Af),D.Aa(h)),0!==c&&null!==this.xc&&(g&&e?(p=a.shadowOffsetX,s=a.shadowOffsetY,u=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=
0,a.shadowBlur=0,a.Vj(),a.shadowOffsetX=p,a.shadowOffsetY=s,a.shadowBlur=u):a.Vj());else if(l.ca===cf){r=l.fk;n=r.length;for(q=0;q<n;q++){m=r.o[q];a.beginPath();a.moveTo(m.ma,m.ka);for(var p=m.Db.o,s=p.length,t=null,u=0;u<s;u++){var y=p[u];switch(y.ca){case Ef:a.moveTo(y.H,y.I);break;case wf:a.lineTo(y.H,y.I);break;case Of:a.bezierCurveTo(y.Pd,y.df,y.Ch,y.Kg,y.Ab,y.Ib);break;case Pf:a.quadraticCurveTo(y.Pd,y.df,y.Ab,y.Ib);break;case Qf:if(y.radiusX===y.radiusY)t=Math.PI/180,a.arc(y.Pd,y.df,y.radiusX,
y.Le*t,(y.Le+y.xf)*t,0>y.xf);else{var t=Sf(y,m),w=t.length;if(0===w){a.lineTo(y.na,y.va);break}for(var C=0;C<w;C++){var A=t[C];0===C&&a.lineTo(A[0],A[1]);a.bezierCurveTo(A[2],A[3],A[4],A[5],A[6],A[7])}}break;case Rf:C=w=0;if(null!==t&&t.type===Qf){t=Sf(t,m);A=t.length;if(0===A){a.lineTo(y.na,y.va);break}t=t[A-1]||null;null!==t&&(w=t[6],C=t[7])}else w=null!==t?t.H:m.ma,C=null!==t?t.I:m.ka;t=Tf(y,m,w,C);w=t.length;if(0===w){a.lineTo(y.na,y.va);break}for(C=0;C<w;C++)A=t[C],a.bezierCurveTo(A[2],A[3],
A[4],A[5],A[6],A[7]);break;default:D.k("Segment not of valid type: "+y.ca)}y.ei&&a.closePath();t=y}e?(u=s=p=0,m.np?(!0===m.Tm&&null!==this.Od?(a.Ug(this.Od),g=!0):g=!1,0!==c&&null!==this.xc&&(g&&(p=a.shadowOffsetX,s=a.shadowOffsetY,u=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0),d&&!h||a.Vj(),g&&(a.shadowOffsetX=p,a.shadowOffsetY=s,a.shadowBlur=u))):(g&&(p=a.shadowOffsetX,s=a.shadowOffsetY,u=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0),!0===m.Tm&&null!==this.Od&&
a.Ug(this.Od),0!==c&&null!==this.xc&&(d&&!h||a.Vj()),g&&(a.shadowOffsetX=p,a.shadowOffsetY=s,a.shadowBlur=u))):(!0===m.Tm&&null!==this.Od&&a.Ug(this.Od),0===c||null===this.xc||d&&!h||a.Vj())}if(d&&!h)for(c=g,g=l.fk,h=g.length,l=0;l<h;l++){r=g.o[l];a.beginPath();n=D.tb();n.push(r.ma);n.push(r.ka);q=r.ma;m=r.ka;p=q;s=m;u=r.Db.o;y=u.length;for(t=0;t<y;t++){w=u[t];switch(w.ca){case Ef:lq(a,n,k,this.Af);n.length=0;n.push(w.H);n.push(w.I);q=w.H;m=w.I;p=q;s=m;break;case wf:n.push(w.H);n.push(w.I);q=w.H;
m=w.I;break;case Of:Fe(q,m,w.Pd,w.df,w.Ch,w.Kg,w.Ab,w.Ib,.5,n);q=w.H;m=w.I;break;case Pf:Je(q,m,w.Pd,w.df,w.Ab,w.Ib,.5,n);q=w.H;m=w.I;break;case Qf:C=Sf(w,r);A=C.length;if(0===A){n.push(w.na);n.push(w.va);q=w.na;m=w.va;break}for(var N=0;N<A;N++){var H=C[N];Fe(q,m,H[2],H[3],H[4],H[5],H[6],H[7],.5,n);q=H[6];m=H[7]}break;case Rf:C=Tf(w,r,q,m);A=C.length;if(0===A){n.push(w.na);n.push(w.va);q=w.na;m=w.va;break}for(N=0;N<A;N++)H=C[N],Fe(q,m,H[2],H[3],H[4],H[5],H[6],H[7],.5,n),q=H[6],m=H[7];break;default:D.k("Segment not of valid type: "+
w.ca)}w.ei&&(n.push(p),n.push(s),lq(a,n,k,this.Af))}lq(a,n,k,this.Af);D.Aa(n);null!==this.xc&&(q=n=r=0,c&&e&&(r=a.shadowOffsetX,n=a.shadowOffsetY,q=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0),a.Vj(),c&&e&&(a.shadowOffsetX=r,a.shadowOffsetY=n,a.shadowBlur=q))}}d&&a.BA();if(null!==this.oy){d=this.oy;Ak(d,Infinity,Infinity);k=d.Fa;d.oc(0,0,k.width,k.height);c=this.Df;a.save();a.beginPath();k=D.tb();if(c.type===sf)k.push(c.ma),k.push(c.ka),k.push(c.H),k.push(c.I),kq(a,b,k,d);else if(c.type===
cf)for(h=c.kc.j;h.next();){l=h.value;k.length=0;k.push(l.ma);k.push(l.ka);g=l.ma;r=l.ka;n=g;q=r;m=l.Db.o;p=m.length;for(s=0;s<p;s++){u=m[s];switch(u.ca){case Ef:kq(a,b,k,d);k.length=0;k.push(u.H);k.push(u.I);g=u.H;r=u.I;n=g;q=r;break;case wf:k.push(u.H);k.push(u.I);g=u.H;r=u.I;break;case Of:Fe(g,r,u.Pd,u.df,u.Ch,u.Kg,u.Ab,u.Ib,.5,k);g=u.H;r=u.I;break;case Pf:Je(g,r,u.Pd,u.df,u.Ab,u.Ib,.5,k);g=u.H;r=u.I;break;case Qf:c=Sf(u,l);e=c.length;if(0===e){k.push(u.na);k.push(u.va);g=u.na;r=u.va;break}for(y=
0;y<e;y++)t=c[y],Fe(g,r,t[2],t[3],t[4],t[5],t[6],t[7],.5,k),g=t[6],r=t[7];break;case Rf:c=Tf(u,l,g,r);e=c.length;if(0===e){k.push(u.na);k.push(u.va);g=u.na;r=u.va;break}for(y=0;y<e;y++)t=c[y],Fe(g,r,t[2],t[3],t[4],t[5],t[6],t[7],.5,k),g=t[6],r=t[7];break;default:D.k("Segment not of valid type: "+u.ca)}u.ei&&(k.push(n),k.push(q),kq(a,b,k,d))}kq(a,b,k,d)}else if(c.type===tf)k.push(c.ma),k.push(c.ka),k.push(c.H),k.push(c.ka),k.push(c.H),k.push(c.I),k.push(c.ma),k.push(c.I),k.push(c.ma),k.push(c.ka),
kq(a,b,k,d);else if(c.type===uf){h=new df;h.ma=c.H;h.ka=(c.ka+c.I)/2;g=new Xf(Qf);g.Le=0;g.xf=360;g.na=(c.ma+c.H)/2;g.va=(c.ka+c.I)/2;g.radiusX=Math.abs(c.ma-c.H)/2;g.radiusY=Math.abs(c.ka-c.I)/2;h.add(g);c=Sf(g,h);e=c.length;if(0===e)k.push(g.na),k.push(g.va);else for(g=h.ma,r=h.ka,y=0;y<e;y++)t=c[y],Fe(g,r,t[2],t[3],t[4],t[5],t[6],t[7],.5,k),g=t[6],r=t[7];kq(a,b,k,d)}D.Aa(k);a.restore();a.Be(!1)}}}};
function lq(a,b,c,d){var e=b.length;if(!(4>e)){var g=.001,h=c.length,k=b[0],l=b[1];if(4===e)Do(a,k,l,b[2],b[3],c,d);else{a.moveTo(k,l);for(var m=g=0,n=0,p=0,q=0,r=p=0,s=D.tb(),u=2;u<e;u+=2)g=b[u],m=b[u+1],n=g-k,p=m-l,0===n&&(n=.001),q=p/n,p=Math.sqrt(n*n+p*p),s.push([n,q,p]),r+=p,k=g,l=m;k=b[0];l=b[1];b=0;for(var e=!0,g=c[b%h],m=0!==d,u=0,p=s[u],n=p[0],q=p[1],p=p[2],t=0;.1<=r;){0===t&&(g=c[b%h],b++,m&&(d%=g,g-=d,m=!1));g>r&&(g=r);g>p?(t=g-p,g=p):t=0;var y=Math.sqrt(g*g/(1+q*q));0>n&&(y=-y);k+=y;l+=
q*y;e?a.lineTo(k,l):a.moveTo(k,l);r-=g;p-=g;if(0!==t){u++;if(u===s.length){D.Aa(s);return}p=s[u];n=p[0];q=p[1];p=p[2];g=t}else e=!e}D.Aa(s)}}}z.prototype.getDocumentPoint=z.prototype.eb=function(a,b){void 0===b&&(b=new O);if(a instanceof R){a.Zd()&&D.k("getDocumentPoint Spot must be a real, specific Spot, not: "+a.toString());var c=this.Ga,d=this.jb;b.m(a.x*(c.width+d)-d/2+c.x+a.offsetX,a.y*(c.height+d)-d/2+c.y+a.offsetY)}else b.set(a);this.Hh.vb(b);return b};
z.prototype.Mk=function(a,b){var c=this.Df;if(null===c||null===this.fill&&null===this.stroke)return!1;var d=c.sb,e=this.jb/2;c.type!==sf||b||(e+=2);var g=D.Nf();g.assign(d);g.eg(e+2,e+2);if(!g.Oa(a))return D.Mb(g),!1;d=e+1E-4;if(c.type===sf){if(null===this.stroke)return!1;d=(c.H-c.ma)*(a.x-c.ma)+(c.I-c.ka)*(a.y-c.ka);if(0>(c.ma-c.H)*(a.x-c.H)+(c.ka-c.I)*(a.y-c.I)||0>d)return!1;D.Mb(g);return ue(c.ma,c.ka,c.H,c.I,e,a.x,a.y)}if(c.type===tf){var h=c.ma,k=c.ka,l=c.H,m=c.I;g.x=Math.min(h,l);g.y=Math.min(k,
m);g.width=Math.abs(l-h);g.height=Math.abs(m-k);if(null===this.fill){g.eg(-d,-d);if(g.Oa(a))return D.Mb(g),!1;g.eg(d,d)}null!==this.stroke&&g.eg(e,e);e=g.Oa(a);D.Mb(g);return e}if(c.type===uf){var h=c.ma,k=c.ka,l=c.H,m=c.I,c=Math.min(h,l),n=Math.min(k,m),h=Math.abs(l-h)/2,k=Math.abs(m-k)/2,c=a.x-(c+h),n=a.y-(n+k);if(null===this.fill){h-=d;k-=d;if(0>=h||0>=k||1>=c*c/(h*h)+n*n/(k*k))return D.Mb(g),!1;h+=d;k+=d}null!==this.stroke&&(h+=e,k+=e);D.Mb(g);return 0>=h||0>=k?!1:1>=c*c/(h*h)+n*n/(k*k)}if(c.type===
cf)return D.Mb(g),null===this.fill?Vf(c,a.x,a.y,e):c.Oa(a,e,1<this.jb,b);D.k("Unknown Geometry type: "+c.type);return!1};
z.prototype.ho=function(a,b,c,d){var e=this.Ea,g=this.Ng;a=Math.max(a,0);b=Math.max(b,0);var h;if(null!==this.Xf)h=this.Df.sb;else{var k=this.Jb,l=qe[k];if(void 0===l){var m=mq[k];"string"===typeof m&&(m=mq[m]);"function"===typeof m?(l=m(null,100,100),qe[k]=l):D.k("Unsupported Figure: "+k)}h=l.sb}var k=h.width,l=h.height,m=h.width,n=h.height;switch(Jo(this,!0)){case Sj:d=c=0;break;case rf:m=Math.max(a-g,0);n=Math.max(b-g,0);break;case vo:m=Math.max(a-g,0);d=0;break;case uo:c=0,n=Math.max(b-g,0)}isFinite(e.width)&&
(m=e.width);isFinite(e.height)&&(n=e.height);e=this.kf;h=this.hg;c=Math.max(c,h.width)-g;d=Math.max(d,h.height)-g;m=Math.min(e.width,m);n=Math.min(e.height,n);m=isFinite(m)?Math.max(c,m):Math.max(k,c);n=isFinite(n)?Math.max(d,n):Math.max(l,d);c=Tj(this);switch(c){case Sj:break;case rf:k=m;l=n;break;case Uj:c=Math.min(m/k,n/l);isFinite(c)||(c=1);k*=c;l*=c;break;default:D.k(c+" is not a valid geometryStretch.")}null!==this.Xf?(k=Math.max(k,.01),l=Math.max(l,.01),h=null!==this.Xf?this.Xf:this.ob,e=k,
d=l,c=h.copy(),h=h.sb,e/=h.width,d/=h.height,isFinite(e)||(e=1),isFinite(d)||(d=1),1===e&&1===d||c.scale(e,d),v&&c.freeze(),this.ob=c):null!==this.ob&&yb(this.ob.mp,a-g)&&yb(this.ob.kp,b-g)||(this.ob=z.makeGeometry(this,k,l));h=this.ob.sb;Infinity===a||Infinity===b?Go(this,h.x-g/2,h.y-g/2,0===a&&0===k?0:h.width+g,0===b&&0===l?0:h.height+g):Go(this,-(g/2),-(g/2),m+g,n+g)};
function Sp(a,b,c,d){if(!1!==Hm(a)){a.Ad.Ya();var e=a.Ng;0===e&&d instanceof da&&d.type===kj&&d.zb instanceof z&&(e=d.zb.jb);e*=a.Bb;d instanceof J&&null!==d.ob?(b=d.ob.sb,Go(a,b.x-e/2,b.y-e/2,b.width+e,b.height+e)):Go(a,-(e/2),-(e/2),b+e,c+e);a.Ad.freeze();a.Ad.F()||D.k("Non-real measuredBounds has been set. Object "+a+", measuredBounds: "+a.Ad.toString());em(a,!1)}}function Tj(a){var b=a.NA;return null!==a.Xf?b===to?rf:b:b===to?qe[a.Jb].je:b}z.prototype.yj=function(a,b,c,d){Lo(this,a,b,c,d)};
z.prototype.getNearestIntersectionPoint=z.prototype.vF=function(a,b,c){return this.Tn(a.x,a.y,b.x,b.y,c)};
z.prototype.Tn=function(a,b,c,d,e){var g=this.transform,h=1/(g.m11*g.m22-g.m12*g.m21),k=g.m22*h,l=-g.m12*h,m=-g.m21*h,n=g.m11*h,p=h*(g.m21*g.dy-g.m22*g.dx),q=h*(g.m12*g.dx-g.m11*g.dy),g=a*k+b*m+p,h=a*l+b*n+q,k=c*k+d*m+p,l=c*l+d*n+q,m=this.jb/2,p=this.ob;null===p&&(Ak(this,Infinity,Infinity),p=this.ob);q=p.sb;n=!1;if(p.type===sf)if(1.5>=this.jb)n=Me(p.wc,p.Gc,p.Ab,p.Ib,g,h,k,l,e);else{var r=0,s=0;p.wc===p.Ab?(r=m,s=0):(b=(p.Ib-p.Gc)/(p.Ab-p.wc),s=m/Math.sqrt(1+b*b),r=s*b);d=D.tb();b=new O;Me(p.wc+
r,p.Gc+s,p.Ab+r,p.Ib+s,g,h,k,l,b)&&d.push(b);b=new O;Me(p.wc-r,p.Gc-s,p.Ab-r,p.Ib-s,g,h,k,l,b)&&d.push(b);b=new O;Me(p.wc+r,p.Gc+s,p.wc-r,p.Gc-s,g,h,k,l,b)&&d.push(b);b=new O;Me(p.Ab+r,p.Ib+s,p.Ab-r,p.Ib-s,g,h,k,l,b)&&d.push(b);b=d.length;if(0===b)return D.Aa(d),!1;n=!0;s=Infinity;for(r=0;r<b;r++){var k=d[r],u=(k.x-g)*(k.x-g)+(k.y-h)*(k.y-h);u<s&&(s=u,e.x=k.x,e.y=k.y)}D.Aa(d)}else if(p.type===tf)b=q.x-m,n=Ne(b,q.y-m,q.x+q.width+m,q.y+q.height+m,g,h,k,l,e);else if(p.type===uf)a:if(b=q.copy().eg(m,
m),0===b.width)n=Me(b.x,b.y,b.x,b.y+b.height,g,h,k,l,e);else if(0===b.height)n=Me(b.x,b.y,b.x+b.width,b.y,g,h,k,l,e);else{a=b.width/2;var t=b.height/2;d=b.x+a;b=b.y+t;c=9999;g!==k&&(c=(h-l)/(g-k));if(9999>Math.abs(c)){n=h-b-c*(g-d);if(0>a*a*c*c+t*t-n*n){e.x=NaN;e.y=NaN;n=!1;break a}m=Math.sqrt(a*a*c*c+t*t-n*n);k=(-(a*a*c*n)+a*t*m)/(t*t+a*a*c*c)+d;a=(-(a*a*c*n)-a*t*m)/(t*t+a*a*c*c)+d;l=c*(k-d)+n+b;b=c*(a-d)+n+b;d=Math.abs((g-k)*(g-k))+Math.abs((h-l)*(h-l));h=Math.abs((g-a)*(g-a))+Math.abs((h-b)*(h-
b));d<h?(e.x=k,e.y=l):(e.x=a,e.y=b)}else{k=t*t;l=g-d;k-=k/(a*a)*l*l;if(0>k){e.x=NaN;e.y=NaN;n=!1;break a}m=Math.sqrt(k);l=b+m;b-=m;d=Math.abs(l-h);h=Math.abs(b-h);d<h?(e.x=g,e.y=l):(e.x=g,e.y=b)}n=!0}else if(p.type===cf){var y=0,w=0,C=u=0,q=D.P(),r=k-g,s=l-h,s=r*r+s*s;e.x=k;e.y=l;for(r=0;r<p.kc.count;r++)for(var A=p.kc.o[r],N=A.Db,y=A.ma,w=A.ka,H=y,W=w,fa=0;fa<N.count;fa++){var S=N.o[fa],ba=S.type,u=S.H,C=S.I,ia=!1;switch(ba){case Ef:H=u;W=C;break;case wf:ia=nq(y,w,u,C,g,h,k,l,q);break;case Of:var ia=
S.Ac,ba=S.Wc,U=S.Rh,Ua=S.Sh,ia=Ke(y,w,ia,ba,U,Ua,u,C,g,h,k,l,.5,q);break;case Pf:ia=(y+2*S.Ac)/3;ba=(w+2*S.Wc)/3;U=(2*S.Ac+u)/3;Ua=(2*S.Ac+u)/3;ia=Ke(y,w,ia,ba,U,Ua,u,C,g,h,k,l,.5,q);break;case Qf:case Rf:ba=S.type===Qf?Sf(S,A):Tf(S,A,y,w);U=ba.length;if(0===U){ia=nq(y,w,S.na,S.va,g,h,k,l,q);break}for(C=0;C<U;C++)t=ba[C],0===C&&nq(y,w,t[0],t[1],g,h,k,l,q)&&(u=oq(g,h,q,s,e),u<s&&(s=u,n=!0)),Ke(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],g,h,k,l,.5,q)&&(u=oq(g,h,q,s,e),u<s&&(s=u,n=!0));u=t[6];C=t[7];break;
default:D.k("Unknown Segment type: "+ba)}y=u;w=C;ia&&(u=oq(g,h,q,s,e),u<s&&(s=u,n=!0));S.Rx&&(u=H,C=W,nq(y,w,u,C,g,h,k,l,q)&&(u=oq(g,h,q,s,e),u<s&&(s=u,n=!0)))}g=c-a;h=d-b;b=Math.sqrt(g*g+h*h);0!==b&&(g/=b,h/=b);e.x-=g*m;e.y-=h*m;D.A(q)}else D.k("Unknown Geometry type: "+p.type);if(!n)return!1;this.transform.vb(e);return!0};function oq(a,b,c,d,e){a=c.x-a;b=c.y-b;b=a*a+b*b;return b<d?(e.x=c.x,e.y=c.y,b):d}
function nq(a,b,c,d,e,g,h,k,l){var m=!1,n=(e-h)*(b-d)-(g-k)*(a-c);if(0===n)return!1;l.x=((e*k-g*h)*(a-c)-(e-h)*(a*d-b*c))/n;l.y=((e*k-g*h)*(b-d)-(g-k)*(a*d-b*c))/n;(a>c?a-c:c-a)<(b>d?b-d:d-b)?(e=b<d?b:d,a=b<d?d:b,(l.y>e||yb(l.y,e))&&(l.y<a||yb(l.y,a))&&(m=!0)):(e=a<c?a:c,a=a<c?c:a,(l.x>e||yb(l.x,e))&&(l.x<a||yb(l.x,a))&&(m=!0));return m}
z.prototype.containedInRect=z.prototype.Hn=function(a,b){if(void 0===b)return a.Nk(this.$);var c=this.ob;null===c&&(Ak(this,Infinity,Infinity),c=this.ob);var c=c.sb,d=this.jb/2,e=!1,g=D.P();g.m(c.x-d,c.y-d);a.Oa(b.vb(g))&&(g.m(c.x-d,c.bottom+d),a.Oa(b.vb(g))&&(g.m(c.right+d,c.bottom+d),a.Oa(b.vb(g))&&(g.m(c.right+d,c.y-d),a.Oa(b.vb(g))&&(e=!0))));D.A(g);return e};
z.prototype.intersectsRect=z.prototype.Wg=function(a,b){if(this.Hn(a,b)||void 0===b&&(b=this.transform,a.Nk(this.$)))return!0;var c=D.Of();c.set(b);c.Qx();var d=a.left,e=a.right,g=a.top,h=a.bottom,k=D.P();k.m(d,g);c.vb(k);if(this.Mk(k,!0))return D.A(k),!0;k.m(e,g);c.vb(k);if(this.Mk(k,!0))return D.A(k),!0;k.m(d,h);c.vb(k);if(this.Mk(k,!0))return D.A(k),!0;k.m(e,h);c.vb(k);if(this.Mk(k,!0))return D.A(k),!0;var l=D.P(),m=D.P();c.set(b);c.lB(this.transform);c.Qx();l.x=e;l.y=g;l.transform(c);k.x=d;k.y=
g;k.transform(c);var n=!1;pq(this,k,l,m)?n=!0:(k.x=e,k.y=h,k.transform(c),pq(this,k,l,m)?n=!0:(l.x=d,l.y=h,l.transform(c),pq(this,k,l,m)?n=!0:(k.x=d,k.y=g,k.transform(c),pq(this,k,l,m)&&(n=!0))));D.A(k);D.He(c);D.A(l);D.A(m);return n};function pq(a,b,c,d){if(!a.vF(b,c,d))return!1;a=b.x;b=b.y;var e=c.x;c=c.y;var g=d.x;d=d.y;if(a===e){var h=0;a=0;b<c?(h=b,a=c):(h=c,a=b);return d>=h&&d<=a}a<e?(h=a,a=e):h=e;return g>=h&&g<=a}
z.prototype.pF=function(a,b,c){function d(a,b){for(var c=a.length,d=0;d<c;d+=2)if(b.mq(a[d],a[d+1])>e)return!0;return!1}if(c&&null!==this.fill&&this.Mk(a,!0))return!0;var e=a.Cf(b);b=e;1.5<this.jb&&(e=this.jb/2+Math.sqrt(e),e*=e);var g=this.ob;if(null===g&&(Ak(this,Infinity,Infinity),g=this.ob,null===g))return!1;if(!c){var h=g.sb,k=h.x,l=h.y,m=h.x+h.width,h=h.y+h.height;if(kb(a.x,a.y,k,l)<=e&&kb(a.x,a.y,m,l)<=e&&kb(a.x,a.y,k,h)<=e&&kb(a.x,a.y,m,h)<=e)return!0}k=g.wc;l=g.Gc;m=g.Ab;h=g.Ib;if(g.type===
sf){if(c=jb(a.x,a.y,k,l,m,h),g=(k-m)*(a.x-m)+(l-h)*(a.y-h),c<=(0<=(m-k)*(a.x-k)+(h-l)*(a.y-l)&&0<=g?e:b))return!0}else{if(g.type===tf)return b=!1,c&&(b=jb(a.x,a.y,k,l,k,h)<=e||jb(a.x,a.y,k,l,m,l)<=e||jb(a.x,a.y,m,l,m,h)<=e||jb(a.x,a.y,k,h,m,h)<=e),b;if(g.type===uf){b=a.x-(k+m)/2;var g=a.y-(l+h)/2,n=Math.abs(m-k)/2,p=Math.abs(h-l)/2;if(0===n||0===p)return c=jb(a.x,a.y,k,l,m,h),c<=e?!0:!1;if(c){if(a=af(n,p,b,g),a*a<=e)return!0}else return kb(b,g,-n,0)>=e||kb(b,g,0,-p)>=e||kb(b,g,0,p)>=e||kb(b,g,n,0)>=
e?!1:!0}else if(g.type===cf){h=g.sb;k=h.x;l=h.y;m=h.x+h.width;h=h.y+h.height;if(a.x>m&&a.x<k&&a.y>h&&a.y<l&&jb(a.x,a.y,k,l,k,h)>e&&jb(a.x,a.y,k,l,m,l)>e&&jb(a.x,a.y,m,h,k,h)>e&&jb(a.x,a.y,m,h,m,l)>e)return!1;b=Math.sqrt(e);if(c){if(null===this.fill?Vf(g,a.x,a.y,b):g.Oa(a,b,!0))return!0}else{c=g.kc;for(b=0;b<c.count;b++){k=c.o[b];n=k.ma;p=k.ka;if(a.mq(n,p)>e)return!1;l=k.Db.o;m=l.length;for(h=0;h<m;h++){var q=l[h];switch(q.type){case Ef:case wf:n=q.H;p=q.I;if(a.mq(n,p)>e)return!1;break;case Of:g=D.tb();
Fe(n,p,q.Ac,q.Wc,q.Rh,q.Sh,q.H,q.I,.8,g);n=d(g,a);D.Aa(g);if(n)return!1;n=q.H;p=q.I;if(a.mq(n,p)>e)return!1;break;case Pf:g=D.tb();Je(n,p,q.Ac,q.Wc,q.H,q.I,.8,g);n=d(g,a);D.Aa(g);if(n)return!1;n=q.H;p=q.I;if(a.mq(n,p)>e)return!1;break;case Qf:case Rf:var r=q.type===Qf?Sf(q,k):Tf(q,k,n,p),s=r.length;if(0===s){n=q.na;p=q.va;if(a.mq(n,p)>e)return!1;break}q=null;g=D.tb();for(b=0;b<s;b++)if(q=r[b],g.length=0,Fe(q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7],.8,g),d(g,a))return D.Aa(g),!1;D.Aa(g);null!==q&&(n=
q[6],p=q[7]);break;default:D.k("Unknown Segment type: "+q.type)}}}return!0}}}return!1};D.defineProperty(z,{Df:"geometry"},function(){return null!==this.ob?this.ob:this.Xf},function(a){var b=this.ob;if(b!==a){null!==a?(v&&D.l(a,bf,z,"geometry"),this.Xf=this.ob=a.freeze()):this.Xf=this.ob=null;var c=this.Y;null!==c&&(c.tk=NaN);this.K();this.i("geometry",b,a);Eo(this)&&(a=this.Y,null!==a&&Fo(this,a,"geometryString"))}});
D.defineProperty(z,{II:"geometryString"},function(){return null===this.Df?"":this.Df.toString()},function(a){a=yf(a);var b=a.normalize();this.Df=a;this.position=a=D.Fb(-b.x,-b.y);D.A(a)});D.defineProperty(z,{NF:"isGeometryPositioned"},function(){return this.es},function(a){v&&D.h(a,"boolean",z,"isGeometryPositioned");var b=this.es;b!==a&&(this.es=a,this.K(),this.i("isGeometryPositioned",b,a))});z.prototype.Re=function(){this.ob=null};
D.defineProperty(z,{fill:"fill"},function(){return this.Od},function(a){var b=this.Od;b!==a&&(v&&null!==a&&D.Yt(a,"Shape.fill"),a instanceof Ba&&a.freeze(),this.Od=a,this.qa(),this.i("fill",b,a))});D.defineProperty(z,{stroke:"stroke"},function(){return this.xc},function(a){var b=this.xc;b!==a&&(v&&null!==a&&D.Yt(a,"Shape.stroke"),a instanceof Ba&&a.freeze(),this.xc=a,this.qa(),this.i("stroke",b,a))});
D.defineProperty(z,{jb:"strokeWidth"},function(){return this.Ng},function(a){var b=this.Ng;if(b!==a)if(v&&D.p(a,z,"strokeWidth"),0<=a){this.Ng=a;this.K();var c=this.Y;null!==c&&(c.tk=NaN);this.i("strokeWidth",b,a)}else D.ua(a,"value >= 0",z,"strokeWidth:value")});
D.defineProperty(z,{wM:"strokeCap"},function(){return this.Qp},function(a){var b=this.Qp;b!==a&&("string"!==typeof a||"butt"!==a&&"round"!==a&&"square"!==a?D.ua(a,'"butt", "round", or "square"',z,"strokeCap"):(this.Qp=a,this.qa(),this.i("strokeCap",b,a)))});
D.defineProperty(z,{yM:"strokeJoin"},function(){return this.Sp},function(a){var b=this.Sp;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?D.ua(a,'"miter", "bevel", or "round"',z,"strokeJoin"):(this.Sp=a,this.qa(),this.i("strokeJoin",b,a)))});
D.defineProperty(z,{zM:"strokeMiterLimit"},function(){return this.vn},function(a){var b=this.vn;if(b!==a)if(v&&D.p(a,z,"strokeMiterLimit"),1<=a){this.vn=a;this.qa();var c=this.Y;null!==c&&(c.tk=NaN);this.i("strokeMiterLimit",b,a)}else D.ua(a,"value >= 1",z,"strokeWidth:value")});
D.defineProperty(z,{WG:"strokeDashArray"},function(){return this.Rp},function(a){var b=this.Rp;if(b!==a){null===a||Array.isArray(a)||D.gc(a,"Array",z,"strokeDashArray:value");if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var g=a[e];"number"===typeof g&&0<=g&&isFinite(g)||D.k("strokeDashArray:value "+g+" at index "+e+" must be a positive number or zero.");d+=g}if(0===d){if(null===b)return;a=null}}this.Rp=a;this.qa();this.i("strokeDashArray",b,a)}});
D.defineProperty(z,{xM:"strokeDashOffset"},function(){return this.Af},function(a){var b=this.Af;b!==a&&(v&&D.p(a,z,"strokeDashOffset"),0<=a&&(this.Af=a,this.qa(),this.i("strokeDashOffset",b,a)))});
D.defineProperty(z,{Jb:"figure"},function(){return this.ap},function(a){var b=this.ap;if(b!==a){v&&D.h(a,"string",z,"figure");var c=mq[a];"function"===typeof c?c=a:(c=mq[a.toLowerCase()])||D.k("Unknown Shape.figure: "+a);b!==c&&(a=this.Y,null!==a&&(a.tk=NaN),this.ap=c,this.Xf=null,this.Re(),this.K(),this.i("figure",b,c))}});
D.defineProperty(z,{Wq:"toArrow"},function(){return this.Wp},function(a){var b=this.Wp;!0===a?a="Standard":!1===a&&(a="");if(b!==a){v&&D.h(a,"string",z,"toArrow");var c=qq(a);null===c?D.k("Unknown Shape.toArrow: "+a):b!==c&&(this.Wp=c,this.Xf=null,this.Re(),this.K(),rq(this),this.i("toArrow",b,c))}});
D.defineProperty(z,{LA:"fromArrow"},function(){return this.dp},function(a){var b=this.dp;!0===a?a="Standard":!1===a&&(a="");if(b!==a){v&&D.h(a,"string",z,"fromArrow");var c=qq(a);null===c?D.k("Unknown Shape.fromArrow: "+a):b!==c&&(this.dp=c,this.Xf=null,this.Re(),this.K(),rq(this),this.i("fromArrow",b,c))}});function rq(a){var b=a.g;null!==b&&b.ra.nb||(a.Oq=sq,"None"!==a.Wp?(a.Te=-1,a.Gh=fd):"None"!==a.dp&&(a.Te=0,a.Gh=new R(1-fd.x,fd.y)))}
D.defineProperty(z,{C:"spot1"},function(){return this.ui},function(a){D.l(a,R,z,"spot1");var b=this.ui;b.O(a)||(this.ui=a=a.V(),this.K(),this.i("spot1",b,a))});D.defineProperty(z,{D:"spot2"},function(){return this.vi},function(a){D.l(a,R,z,"spot2");var b=this.vi;b.O(a)||(this.vi=a=a.V(),this.K(),this.i("spot2",b,a))});D.defineProperty(z,{Oc:"parameter1"},function(){return this.Ss},function(a){var b=this.Ss;b!==a&&(this.Ss=a,this.Re(),this.K(),this.i("parameter1",b,a))});
D.defineProperty(z,{Qu:"parameter2"},function(){return this.Ts},function(a){var b=this.Ts;b!==a&&(this.Ts=a,this.Re(),this.K(),this.i("parameter2",b,a))});D.w(z,{Ga:"naturalBounds"},function(){if(null!==this.ob)return this.$c.assign(this.ob.sb),this.$c;var a=this.Ea;return new B(0,0,a.width,a.height)});D.defineProperty(z,{oy:"pathPattern"},function(){return this.Vs},function(a){var b=this.Vs;b!==a&&(v&&D.l(a,P,z,"pathPattern"),this.Vs=a,this.qa(),this.i("pathPattern",b,a))});
D.defineProperty(z,{lM:"pathObject"},function(){return this.oy},function(a){this.oy=a});D.defineProperty(z,{NA:"geometryStretch"},function(){return this.Wr},function(a){var b=this.Wr;b!==a&&(D.Ca(a,P,z,"geometryStretch"),this.Wr=a,this.i("geometryStretch",b,a))});
D.defineProperty(z,{interval:"interval"},function(){return this.Bg},function(a){var b=this.Bg;v&&D.p(a,z,"interval");a=Math.floor(a);if(b!==a&&0<=a){this.Bg=a;var c=this.g;null!==c&&this.Q===c.Vn&&fm(c);this.K();c=this.Q;null!==c&&c.type===mp&&(c.kk=null);this.i("interval",b,a)}});D.defineProperty(z,{zF:"graduatedStart"},function(){return this.Ag},function(a){var b=this.Ag;v&&D.p(a,z,"graduatedStart");b!==a&&(0>a?a=0:1<a&&(a=1),this.Ag=a,this.K(),this.i("graduatedStart",b,a))});
D.defineProperty(z,{xF:"graduatedEnd"},function(){return this.zg},function(a){var b=this.zg;v&&D.p(a,z,"graduatedEnd");b!==a&&(0>a?a=0:1<a&&(a=1),this.zg=a,this.K(),this.i("graduatedEnd",b,a))});z.makeGeometry=function(a,b,c){var d=null;if("None"!==a.Wq)d=re[a.Wq];else if("None"!==a.LA)d=re[a.LA];else{var e=mq[a.Jb];"string"===typeof e&&(e=mq[e]);void 0===e&&D.k("Unknown Shape.figure: "+a.Jb);d=e(a,b,c);d.mp=b;d.kp=c}null===d&&(e=mq.Rectangle,"function"===typeof e&&(d=e(a,b,c)));return d};
z.getFigureGenerators=function(){var a=new ma("string","function"),b;for(b in mq)if(b!==b.toLowerCase()){var c=mq[b];"function"===typeof c&&a.add(b,c)}a.freeze();return a};
z.defineFigureGenerator=function(a,b){D.h(a,"string",z,"defineFigureGenerator:name");"string"===typeof b?""!==b&&mq[b]||D.k("Shape.defineFigureGenerator synonym must not be empty or None or not a defined figure name: "+b):D.h(b,"function",z,"defineFigureGenerator:func");var c=a.toLowerCase();""!==a&&"none"!==c&&a!==c||D.k("Shape.defineFigureGenerator name must not be empty or None or all-lower-case: "+a);mq[a]=b;mq[c]=a};
z.getArrowheadGeometries=function(){var a=new ma("string",bf),b;for(b in tq)if(void 0===re[b]){var c=yf(tq[b],!1);re[b]=c;c=b.toLowerCase();c!==b&&(re[c]=b)}for(b in re)b!==b.toLowerCase()&&(c=re[b],c instanceof bf&&a.add(b,c));a.freeze();return a};
z.defineArrowheadGeometry=function(a,b){D.h(a,"string",z,"defineArrowheadGeometry:name");var c=null;"string"===typeof b?(D.h(b,"string",z,"defineArrowheadGeometry:pathstr"),c=yf(b,!1)):(D.l(b,bf,z,"defineArrowheadGeometry:pathstr"),c=b);var d=a.toLowerCase();""!==a&&"none"!==d&&a!==d||D.k("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+a);re[a]=c;re[d]=a};
function na(){P.call(this);this.Sd="";this.xc="black";this.xg="13px sans-serif";this.Pl="start";this.wg=Sj;this.Tl=Wc;this.Vm=!0;this.pk=this.qk=!1;this.nj=uq;this.Ik=vq;this.pw=this.ue=0;this.Om=this.Mz=this.Nz=null;this.gi=new Yp;this.Pr=!1;this.$e=this.or=this.Ft=this.Ql=this.Gt=null;this.ti=this.si=0;this.vh=Infinity;this.tp=0;this.Bg=1;this.Ag=0;this.zg=1;this.Qm=null}D.Sa(na,P);D.ja("TextBlock",na);var wq=/[ \u200b\u00ad]/;
na.prototype.cloneProtected=function(a){P.prototype.cloneProtected.call(this,a);a.Sd=this.Sd;a.xc=this.xc;a.xg=this.xg;a.Pl=this.Pl;a.wg=this.wg;a.Tl=this.Tl;a.Vm=this.Vm;a.qk=this.qk;a.pk=this.pk;a.nj=this.nj;a.Ik=this.Ik;a.ue=this.ue;a.pw=this.pw;a.Nz=this.Nz;a.Mz=this.Mz;a.Om=this.Om;a.gi.gq(this.gi);a.Pr=this.Pr;a.Gt=this.Gt;a.Ql=this.Ql;a.Ft=this.Ft;a.or=this.or;a.$e=this.$e;a.si=this.si;a.ti=this.ti;a.vh=this.vh;a.tp=this.tp;a.Bg=this.Bg;a.Ag=this.Ag;a.zg=this.zg;a.Qm=this.Qm};
na.prototype.nc=function(a){a.Ne===na?this.kH=a:P.prototype.nc.call(this,a)};na.prototype.toString=function(){return 22<this.Sd.length?'TextBlock("'+this.Sd.substring(0,20)+'"...)':'TextBlock("'+this.Sd+'")'};var xq=new la,yq=0,zq=new la,Aq=0,Bq="...",Cq="",Dq=(new ka(null)).Ok;na.getEllipsis=function(){return Bq};na.setEllipsis=function(a){Bq=a;zq=new la;Aq=0};var Eq;na.None=Eq=D.s(na,"None",0);var Fq;na.WrapFit=Fq=D.s(na,"WrapFit",1);var vq;na.WrapDesiredSize=vq=D.s(na,"WrapDesiredSize",2);var uq;
na.OverflowClip=uq=D.s(na,"OverflowClip",0);var Gq;na.OverflowEllipsis=Gq=D.s(na,"OverflowEllipsis",1);na.prototype.K=function(){P.prototype.K.call(this);this.Mz=this.Nz=null};D.defineProperty(na,{font:"font"},function(){return this.xg},function(a){var b=this.xg;b!==a&&(v&&(D.h(a,"string",na,"font"),Hq(a)||D.k('Not a valid font: "'+a+'"')),this.xg=a,this.Om=null,this.K(),this.i("font",b,a))});var Hq;
na.isValidFont=Hq=function(a){var b=Dq.font;if(a===b||"10px sans-serif"===a)return!0;Dq.font="10px sans-serif";var c;Dq.font=a;var d=Dq.font;if("10px sans-serif"!==d)return Dq.font=b,!0;Dq.font="19px serif";c=Dq.font;Dq.font=a;d=Dq.font;Dq.font=b;return d!==c};D.defineProperty(na,{text:"text"},function(){return this.Sd},function(a){var b=this.Sd;a=null!==a&&void 0!==a?a.toString():"";b!==a&&(this.Sd=a,this.K(),this.i("text",b,a))});
D.defineProperty(na,{textAlign:"textAlign"},function(){return this.Pl},function(a){var b=this.Pl;b!==a&&(v&&D.h(a,"string",na,"textAlign"),"start"===a||"end"===a||"left"===a||"right"===a||"center"===a?(this.Pl=a,this.qa(),this.i("textAlign",b,a)):D.ua(a,'"start", "end", "left", "right", or "center"',na,"textAlign"))});D.defineProperty(na,{ku:"flip"},function(){return this.wg},function(a){var b=this.wg;b!==a&&(D.Ca(a,P,na,"flip"),this.wg=a,this.qa(),this.i("flip",b,a))});
D.defineProperty(na,{EM:"verticalAlignment"},function(){return this.Tl},function(a){var b=this.Tl;b.O(a)||(v&&D.l(a,R,na,"verticalAlignment"),a.Zd()&&D.k("TextBlock.verticalAlignment for "+this+" must be a real Spot, not:"+a),this.Tl=a=a.V(),Wo(this),this.i("verticalAlignment",b,a))});D.w(na,{Ga:"naturalBounds"},function(){if(!this.$c.F()){var a=Iq(this,this.Sd,this.gi,999999).width,b=Jq(this,a,this.gi),c=this.Ea;isNaN(c.width)||(a=c.width);isNaN(c.height)||(b=c.height);wb(this.$c,a,b)}return this.$c});
D.defineProperty(na,{Xx:"isMultiline"},function(){return this.Vm},function(a){var b=this.Vm;b!==a&&(v&&D.h(a,"boolean",na,"isMultiline"),this.Vm=a,this.K(),this.i("isMultiline",b,a))});D.defineProperty(na,{KL:"isUnderline"},function(){return this.qk},function(a){var b=this.qk;b!==a&&(v&&D.h(a,"boolean",na,"isUnderline"),this.qk=a,this.qa(),this.i("isUnderline",b,a))});
D.defineProperty(na,{JL:"isStrikethrough"},function(){return this.pk},function(a){var b=this.pk;b!==a&&(v&&D.h(a,"boolean",na,"isStrikethrough"),this.pk=a,this.qa(),this.i("isStrikethrough",b,a))});D.defineProperty(na,{kH:"wrap"},function(){return this.Ik},function(a){var b=this.Ik;b!==a&&(v&&D.Ca(a,na,na,"wrap"),this.Ik=a,this.K(),this.i("wrap",b,a))});
D.defineProperty(na,{overflow:"overflow"},function(){return this.nj},function(a){var b=this.nj;b!==a&&(v&&D.Ca(a,na,na,"overflow"),this.nj=a,this.K(),this.i("overflow",b,a))});D.defineProperty(na,{stroke:"stroke"},function(){return this.xc},function(a){var b=this.xc;b!==a&&(v&&null!==a&&D.Yt(a,"TextBlock.stroke"),a instanceof Ba&&a.freeze(),this.xc=a,this.qa(),this.i("stroke",b,a))});D.w(na,{rJ:"lineCount"},function(){return this.ue});
D.defineProperty(na,{FA:"editable"},function(){return this.Pr},function(a){var b=this.Pr;b!==a&&(v&&D.h(a,"boolean",na,"editable"),this.Pr=a,this.i("editable",b,a))});D.defineProperty(na,{ZG:"textEditor"},function(){return this.Gt},function(a){var b=this.Gt;b!==a&&(!v||a instanceof HTMLElement||a instanceof ak||D.k("TextEditingTool.defaultTextEditor must be an HTMLElement or HTMLInfo."),this.Gt=a,this.i("textEditor",b,a))});
D.defineProperty(na,{HA:"errorFunction"},function(){return this.$e},function(a){var b=this.$e;b!==a&&(null!==a&&D.h(a,"function",na,"errorFunction"),this.$e=a,this.i("errorFunction",b,a))});D.defineProperty(na,{interval:"interval"},function(){return this.Bg},function(a){var b=this.Bg;v&&D.p(a,na,"interval");a=Math.floor(a);if(b!==a&&0<=a){this.Bg=a;this.K();var c=this.Q;null!==c&&c.type===mp&&(c.kk=null);this.i("interval",b,a)}});
D.defineProperty(na,{zF:"graduatedStart"},function(){return this.Ag},function(a){var b=this.Ag;v&&D.p(a,na,"graduatedStart");b!==a&&(0>a?a=0:1<a&&(a=1),this.Ag=a,this.K(),this.i("graduatedStart",b,a))});D.defineProperty(na,{xF:"graduatedEnd"},function(){return this.zg},function(a){var b=this.zg;v&&D.p(a,na,"graduatedEnd");b!==a&&(0>a?a=0:1<a&&(a=1),this.zg=a,this.K(),this.i("graduatedEnd",b,a))});
D.defineProperty(na,{yF:"graduatedFunction"},function(){return this.Qm},function(a){var b=this.Qm;b!==a&&(null!==a&&D.h(a,"function",na,"graduatedFunction"),this.Qm=a,this.K(),this.i("graduatedFunction",b,a))});
na.prototype.Pk=function(a,b){if(null!==this.xc&&0!==this.Sd.length&&null!==this.xg){var c=this.Ga.width,d=this.Ga.height,e=Kq(this),g=a.textAlign=this.Pl,h=b.hs;"start"===g&&(g=h?"right":"left");"end"===g&&(g=h?"left":"right");So(this,a,this.xc,!0,!1);(this.qk||this.pk)&&So(this,a,this.xc,!1,!1);var k=0,h=!1,l=D.Fb(0,0);this.Hh.vb(l);var m=D.Fb(0,e);this.Hh.vb(m);var n=l.Cf(m);D.A(l);D.A(m);l=b.scale;8>n*l*l&&(h=!0);b.md!==a&&(h=!1);!1===b.Gj("textGreeking")&&(h=!1);n=this.si;l=this.ti;switch(this.ku){case xo:a.translate(c,
0);a.scale(-1,1);break;case wo:a.translate(0,d);a.scale(1,-1);break;case yo:a.translate(c,d),a.scale(-1,-1)}var m=this.ue,p=(n+e+l)*m;d>p&&(k=this.Tl,k=k.y*d-k.y*p+k.offsetY);for(var p=this.gi,q=0;q<m;q++){var r=p.yf[q],s=p.Xe[q];r>c&&(r=c);var k=k+n,u=s,s=a,t=k,y=c,w=e,C=g,A=0;h?("left"===C?A=0:"right"===C?A=y-r:"center"===C&&(A=(y-r)/2),s.fillRect(0+A,t+.25*w,r,1)):("left"===C?A=0:"right"===C?A=y:"center"===C&&(A=y/2),s.fillText(u,0+A,t+w-.25*w),u=w/20|0,0===u&&(u=1),"right"===C?A-=r:"center"===
C&&(A-=r/2),this.qk&&(s.beginPath(),s.lineWidth=u,s.moveTo(0+A,t+w-.2*w),s.lineTo(0+A+r,t+w-.2*w),s.stroke()),this.pk&&(s.beginPath(),s.lineWidth=u,t=t+w-w/2.2|0,0!==u%2&&(t+=.5),s.moveTo(0+A,t),s.lineTo(0+A+r,t),s.stroke()));k+=e+l}switch(this.ku){case xo:a.scale(-1,1);a.translate(-c,0);break;case wo:a.scale(1,-1);a.translate(0,-d);break;case yo:a.scale(-1,-1),a.translate(-c,-d)}}};
na.prototype.computeAngle=function(a,b){var c=0;switch(a){default:case nj:c=0;break;case sq:c=b;break;case Tp:c=b+90;break;case Vp:c=b-90;break;case Lq:c=b+180;break;case Mq:c=Ye(b);90<c&&270>c&&(c-=180);break;case Up:c=Ye(b+90);90<c&&270>c&&(c-=180);break;case Wp:c=Ye(b-90);90<c&&270>c&&(c-=180);break;case Xp:c=Ye(b);if(45<c&&135>c||225<c&&315>c)return 0;90<c&&270>c&&(c-=180)}return Ye(c)};
na.prototype.ho=function(a,b,c,d){this.tp=a;var e=this.gi;e.reset();var g=0,h=0;if(isNaN(this.Ea.width)){g=this.Sd.replace(/\r\n/g,"\n").replace(/\r/g,"\n");if(0===g.length)g=0;else if(this.Xx){for(var k=h=0,l=!1;!l;){var m=g.indexOf("\n",k);-1===m&&(m=g.length,l=!0);k=Nq(g.substr(k,m-k).replace(/^\s+|\s+$/g,""),this.xg);k>h&&(h=k);k=m+1}g=h}else h=g.indexOf("\n",0),0<=h&&(g=g.substr(0,h)),g=k=Nq(g,this.xg);g=Math.min(g,a/this.scale);g=Math.max(8,g)}else g=this.Ea.width;null!==this.Q&&(g=Math.min(g,
this.Q.kf.width),g=Math.max(g,this.Q.hg.width));h=Jq(this,g,e);m=h=isNaN(this.Ea.height)?Math.min(h,b/this.scale):this.Ea.height;if(0!==e.nf&&1!==e.Xe.length&&this.nj===Gq&&(b=this.xg,l=this.nj===Gq?Oq(b):0,k=this.si+this.ti,k=Math.max(0,Kq(this)+k),m=Math.min(this.zJ-1,Math.max(Math.floor(m/k+.01)-1,0)),!(m+1>=e.Xe.length))){k=e.Xe[m];for(a=Math.max(1,a-l);Nq(k,b)>a&&1<k.length;)k=k.substr(0,k.length-1);k+=Bq;a=Nq(k,b);e.Xe[m]=k;e.Xe=e.Xe.slice(0,m+1);e.yf[m]=a;e.yf=e.yf.slice(0,m+1);e.xj=e.Xe.length;
e.nf=Math.max(e.nf,a);this.ue=e.xj}if(this.kH===Fq||isNaN(this.Ea.width))g=e.nf,isNaN(this.Ea.width)&&(g=Math.max(8,g));g=Math.max(c,g);h=Math.max(d,h);wb(this.$c,g,h);Go(this,0,0,g,h)};na.prototype.yj=function(a,b,c,d){Lo(this,a,b,c,d)};
function Iq(a,b,c,d){b=b.replace(/^\s+|\s+$/g,"");var e=0,g=0,h=0,k=a.xg,g=a.si+a.ti,l=Math.max(0,Kq(a)+g),h=a.nj===Gq?Oq(k):0;if(a.ue>=a.vh)return new Ca(0,l);if(a.Ik===Eq){c.xj=1;g=Nq(b,k);if(0===h||g<=d)return c.nf=g,c.yf.push(c.nf),c.Xe.push(b),new Ca(g,l);var m=Pq(b);b=b.substr(m.length);for(var n=Pq(b),g=Nq(m+n,k);0<n.length&&g<=d;)m+=n,b=b.substr(n.length),n=Pq(b),g=Nq((m+n).replace(/^\s+|\s+$/g,""),k);m+=n.replace(/^\s+|\s+$/g,"");for(d=Math.max(1,d-h);Nq(m,k)>d&&1<m.length;)m=m.substr(0,
m.length-1);m+=Bq;h=Nq(m,k);c.yf.push(h);c.nf=h;c.Xe.push(m);return new Ca(h,l)}var p=0;0===b.length&&(p=1,c.yf.push(0),c.Xe.push(b));for(;0<b.length;){m=Pq(b);for(b=b.substr(m.length);Nq(m,k)>d;){n=1;g=Nq(m.substr(0,n),k);for(h=0;g<=d;)n++,h=g,g=Nq(m.substr(0,n),k);1===n?(c.yf[a.ue+p]=g,e=Math.max(e,g)):(c.yf[a.ue+p]=h,e=Math.max(e,h));n--;1>n&&(n=1);c.Xe[a.ue+p]=m.substr(0,n);p++;m=m.substr(n);if(a.ue+p>a.vh)break}n=Pq(b);for(g=Nq(m+n,k);0<n.length&&g<=d;)m+=n,b=b.substr(n.length),n=Pq(b),g=Nq((m+
n).replace(/^\s+|\s+$/g,""),k);m=m.replace(/^\s+|\s+$/g,"");if(""!==m&&("\u00ad"===m[m.length-1]&&(m=m.substring(0,m.length-1)+"\u2010"),0===n.length?(c.yf.push(g),e=Math.max(e,g)):(h=Nq(m,k),c.yf.push(h),e=Math.max(e,h)),c.Xe.push(m),p++,a.ue+p>a.vh))break}c.xj=Math.min(a.vh,p);c.nf=Math.max(c.nf,e);return new Ca(c.nf,l*c.xj)}function Pq(a){for(var b=a.length,c=0;c<b&&!wq.test(a.charAt(c));)c++;for(;c<b&&wq.test(a.charAt(c));)c++;return c>=b?a:a.substr(0,c)}
function Nq(a,b){Cq!==b&&(Cq=Dq.font=b);return Dq.measureText(a).width}function Kq(a){if(null!==a.Om)return a.Om;var b=a.xg;Cq!==b&&(Cq=Dq.font=b);var c=0;void 0!==xq[b]&&5E3>yq?c=xq[b]:(c=1.3*Dq.measureText("M").width,xq[b]=c,yq++);return a.Om=c}function Oq(a){Cq!==a&&(Cq=Dq.font=a);var b=0;void 0!==zq[a]&&5E3>Aq?b=zq[a]:(b=Dq.measureText(Bq).width,zq[a]=b,Aq++);return b}
function Jq(a,b,c){var d=a.Sd.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),e=a.si+a.ti,e=Math.max(0,Kq(a)+e);if(0===d.length)return c.nf=0,a.ue=1,e;if(!a.Xx){var g=d.indexOf("\n",0);0<=g&&(d=d.substr(0,g))}for(var g=0,h=a.ue=0,k=-1,l=!1;!l;)k=d.indexOf("\n",h),-1===k&&(k=d.length,l=!0),h<=k&&(h=d.substr(h,k-h),a.Ik!==Eq?(c.xj=0,h=Iq(a,h,c,b),g+=h.height,a.ue+=c.xj):(Iq(a,h,c,b),g+=e,a.ue++),a.ue===a.vh&&(l=!0)),h=k+1;return a.pw=g}
D.defineProperty(na,{NB:"textValidation"},function(){return this.Ql},function(a){var b=this.Ql;b!==a&&(null!==a&&D.h(a,"function",na,"textValidation"),this.Ql=a,this.i("textValidation",b,a))});D.defineProperty(na,{YG:"textEdited"},function(){return this.Ft},function(a){var b=this.Ft;b!==a&&(null!==a&&D.h(a,"function",na,"textEdited"),this.Ft=a,this.i("textEdited",b,a))});
D.defineProperty(na,{tM:"spacingAbove"},function(){return this.si},function(a){var b=this.si;b!==a&&(v&&D.h(a,"number",na,"spacingAbove"),this.si=a,this.i("spacingAbove",b,a))});D.defineProperty(na,{uM:"spacingBelow"},function(){return this.ti},function(a){var b=this.ti;b!==a&&(v&&D.h(a,"number",na,"spacingBelow"),this.ti=a,this.i("spacingBelow",b,a))});
D.defineProperty(na,{zJ:"maxLines"},function(){return this.vh},function(a){var b=this.vh;b!==a&&(v&&D.h(a,"number",na,"maxLines"),a=Math.floor(a),0>=a&&D.ua(a,"> 0",na,"maxLines"),this.vh=a,this.i("maxLines",b,a),this.K())});D.w(na,{UL:"metrics"},function(){return this.gi});D.defineProperty(na,{cL:"choices"},function(){return this.or},function(a){var b=this.or;b!==a&&(null===a||Array.isArray(a)||D.gc(a,"Array",na,"choices:value"),this.or=a,this.i("choices",b,a))});
function Yp(){this.nf=this.xj=0;this.yf=[];this.Xe=[]}Yp.prototype.reset=function(){this.nf=this.xj=0;this.yf=[];this.Xe=[]};Yp.prototype.gq=function(a){this.xj=a.xj;this.nf=a.nf;this.yf=D.cm(a.yf);this.Xe=D.cm(a.Xe)};D.w(Yp,{$K:"arrSize"},function(){return this.yf});D.w(Yp,{aL:"arrText"},function(){return this.Xe});D.w(Yp,{TL:"maxLineWidth"},function(){return this.nf});
function Cl(){P.call(this);this.Ze=null;this.xt="";this.Ak=ne;this.hp=rf;this.wi=this.$e=null;this.gp=gc;this.wg=Sj;this.Tp=null;this.Hz=!1;this.bp=!0;this.nw=!1;this.Lp=null}D.Sa(Cl,P);D.ja("Picture",Cl);Cl.prototype.cloneProtected=function(a){P.prototype.cloneProtected.call(this,a);a.element=this.Ze;a.xt=this.xt;a.Ak=this.Ak.V();a.hp=this.hp;a.wg=this.wg;a.$e=this.$e;a.wi=this.wi;a.gp=this.gp.V();a.bp=this.bp;a.Lp=this.Lp};
Cl.prototype.nc=function(a){a===Sj||a===Uj||a===Vj?this.YI=a:P.prototype.nc.call(this,a)};Cl.prototype.toString=function(){return"Picture("+this.source+")#"+D.Fd(this)};var Qq=new la,Rq=0,wl=[];function Sq(){var a=wl;if(0===a.length)for(var b=window.document.getElementsByTagName("canvas"),c=b.length,d=0;d<c;d++){var e=b[d];e.parentElement&&e.parentElement.ba&&a.push(e.parentElement.ba)}return a}var Tq;
Cl.clearCache=Tq=function(a){void 0===a&&(a="");D.h(a,"string",Cl,"clearCache:url");""!==a?Qq[a]&&(delete Qq[a],Rq--):(Qq=new la,Rq=0)};
D.defineProperty(Cl,{element:"element"},function(){return this.Ze},function(a){var b=this.Ze;if(b!==a){null===a||a instanceof HTMLImageElement||a instanceof HTMLVideoElement||a instanceof HTMLCanvasElement||D.k("Picture.element must be an instance of Image, Canvas, or Video, not: "+a);this.Hz=a instanceof HTMLCanvasElement;this.Ze=a;if(null!==a)if(a instanceof HTMLCanvasElement||!0===a.complete)a.fp instanceof Event&&null!==this.$e&&this.$e(this,a.fp),!0===a.ew&&null!==this.wi&&this.wi(this,a.Wz),
a.ew=!0,this.Ea.F()||(em(this,!1),this.K());else{var c=this;a.bD||(a.addEventListener("load",function(b){Uq(a,b);c.Ea.F()||(em(c,!1),c.K())}),a.addEventListener("error",function(b){Vq(a,b)}),a.bD=!0)}this.i("element",b,a);this.qa()}});
D.defineProperty(Cl,{source:"source"},function(){return this.xt},function(a){var b=this.xt;if(b!==a){D.h(a,"string",Cl,"source");this.xt=a;var c=Qq,d=this.g;if(void 0!==c[a])var e=c[a].$p[0].source;else{30<Rq&&(Tq(),c=Qq);var e=D.createElement("img"),g=this;e.addEventListener("load",function(a){Uq(e,a);g.Ea.F()||(em(g,!1),g.K())});e.addEventListener("error",function(a){Vq(e,a)});e.bD=!0;var h=this.Lp;null!==h&&(e.crossOrigin=h(this));e.src=a;c[a]=new Wq(e);Rq++}null!==d&&sn(d,this);this.element=e;
null!==d&&rn(d,this);this.K();this.qa();this.i("source",b,a)}});function Uq(a,b){a.ew=!0;a.fp=!1;for(var c=null,d=Sq(),e=d.length,g=0;g<e;g++){var h=d[g],k=h.Ep.oa(a.src);if(null!==k)for(e=k.length,g=0;g<e;g++)c=k[g],h.Tz.add(c),h.Se(),null===a.Wz&&(a.Wz=b,null!==c.wi&&c.wi(c,b))}}function Vq(a,b){a.fp=b;for(var c=null,d=Sq(),e=d.length,g=0;g<e;g++)if(c=d[g].Ep.oa(a.src),null!==c){for(var e=c.length,h=D.tb(),g=0;g<e;g++)h.push(c[g]);for(g=0;g<e;g++)c=h[g],null!==c.$e&&c.$e(c,b);D.Aa(h)}}
D.defineProperty(Cl,{sM:"sourceCrossOrigin"},function(){return this.Lp},function(a){if(this.Lp!==a&&(null!==a&&D.h(a,"function",Cl,"sourceCrossOrigin"),this.Lp=a,null!==this.element)){var b=this.element.src;null===a&&"string"===typeof b?this.element.crossOrigin=null:null!==a&&(this.element.crossOrigin=a(this));this.element.src=b}});
D.defineProperty(Cl,{Uj:"sourceRect"},function(){return this.Ak},function(a){var b=this.Ak;b.O(a)||(D.l(a,B,Cl,"sourceRect"),this.Ak=a=a.V(),this.qa(),this.i("sourceRect",b,a))});D.defineProperty(Cl,{YI:"imageStretch"},function(){return this.hp},function(a){var b=this.hp;b!==a&&(D.Ca(a,P,Cl,"imageStretch"),this.hp=a,this.qa(),this.i("imageStretch",b,a))});
D.defineProperty(Cl,{ku:"flip"},function(){return this.wg},function(a){var b=this.wg;b!==a&&(D.Ca(a,P,Cl,"flip"),this.wg=a,this.qa(),this.i("flip",b,a))});D.defineProperty(Cl,{DL:"imageAlignment"},function(){return this.gp},function(a){D.l(a,R,Cl,"imageAlignment");var b=this.gp;b.O(a)||(this.gp=a=a.V(),this.K(),this.i("imageAlignment",b,a))});
D.defineProperty(Cl,{HA:"errorFunction"},function(){return this.$e},function(a){var b=this.$e;b!==a&&(null!==a&&D.h(a,"function",Cl,"errorFunction"),this.$e=a,this.i("errorFunction",b,a))});D.defineProperty(Cl,{CM:"successFunction"},function(){return this.wi},function(a){var b=this.wi;b!==a&&(null!==a&&D.h(a,"function",Cl,"successFunction"),this.wi=a,this.i("successFunction",b,a))});
Cl.prototype.Pk=function(a,b){var c=this.Ze;if(null!==c){var d=c.src;null!==d&&""!==d||D.k('Element has no source ("src") attribute: '+c);if(!(c.fp instanceof Event)&&!0===c.ew){var d=this.Ga,e=0,g=0,h=this.Hz,k=h?+c.width:c.naturalWidth,h=h?+c.height:c.naturalHeight;void 0===k&&c.videoWidth&&(k=c.videoWidth);void 0===h&&c.videoHeight&&(h=c.videoHeight);k=k||d.width;h=h||d.height;if(0!==k&&0!==h){var l=k,m=h;this.Uj.F()&&(e=this.Ak.x,g=this.Ak.y,k=this.Ak.width,h=this.Ak.height);var n=k,p=h,q=this.hp,
r=this.gp;switch(q){case Sj:if(this.Uj.F())break;n>=d.width&&(e=e+r.offsetX+(n*r.x-d.width*r.x));p>=d.height&&(g=g+r.offsetY+(p*r.y-d.height*r.y));k=Math.min(d.width,n);h=Math.min(d.height,p);break;case rf:n=d.width;p=d.height;break;case Uj:case Vj:var s=0;q===Uj?(s=Math.min(d.height/p,d.width/n),n*=s,p*=s):q===Vj&&(s=Math.max(d.height/p,d.width/n),n*=s,p*=s,n>=d.width&&(e=(e+r.offsetX+(n*r.x-d.width*r.x)/n)*k),p>=d.height&&(g=(g+r.offsetY+(p*r.y-d.height*r.y)/p)*h),k*=1/(n/d.width),h*=1/(p/d.height),
n=d.width,p=d.height)}var q=this.Fj()*b.scale,u=k*h/(n*q*p*q),s=Qq[this.source],q=null;if(void 0!==s&&16<u){2>s.$p.length&&(Xq(s,4,l,m),Xq(s,16,l,m));for(var l=s.$p,m=l.length,q=l[0],t=0;t<m;t++)if(l[t].Gq*l[t].Gq<u)q=l[t];else break}if(!b.Yo){if(null===this.Tp)if(null===this.Ze)this.Tp=!1;else{l=(new ka(null)).Ok;l.drawImage(this.Ze,0,0);try{l.getImageData(0,0,1,1).data[3]&&(this.Tp=!1),this.Tp=!1}catch(y){this.Tp=!0}}if(this.Tp)return}l=0;n<d.width&&(l=r.offsetX+(d.width*r.x-n*r.x));m=0;p<d.height&&
(m=r.offsetY+(d.height*r.y-p*r.y));switch(this.ku){case xo:a.translate(Math.min(d.width,n),0);a.scale(-1,1);break;case wo:a.translate(0,Math.min(d.height,p));a.scale(1,-1);break;case yo:a.translate(Math.min(d.width,n),Math.min(d.height,p)),a.scale(-1,-1)}if(b.Gj("pictureRatioOptimization")&&!b.Iz&&void 0!==s&&null!==q&&1!==q.Gq){a.save();s=q.Gq;try{a.drawImage(q.source,e/s,g/s,Math.min(q.source.width,k/s),Math.min(q.source.height,h/s),l,m,Math.min(d.width,n),Math.min(d.height,p))}catch(w){v&&this.bp&&
D.trace(w.toString()),this.bp=!1}a.restore()}else try{a.drawImage(c,e,g,k,h,l,m,Math.min(d.width,n),Math.min(d.height,p))}catch(C){v&&this.bp&&D.trace(C.toString()),this.bp=!1}switch(this.ku){case xo:a.scale(-1,1);a.translate(-Math.min(d.width,n),0);break;case wo:a.scale(1,-1);a.translate(0,-Math.min(d.height,p));break;case yo:a.scale(-1,-1),a.translate(-Math.min(d.width,n),-Math.min(d.height,p))}}}}};D.w(Cl,{Ga:"naturalBounds"},function(){return this.$c});
Cl.prototype.ho=function(a,b,c,d){var e=this.Ea,g=Jo(this,!0),h=this.Ze,k=this.Hz;if(k||!this.nw&&h&&h.complete)this.nw=!0;null===h&&(isFinite(a)||(a=0),isFinite(b)||(b=0));isFinite(e.width)||g===rf||g===vo?(isFinite(a)||(a=this.Uj.F()?this.Uj.width:k?+h.width:h.naturalWidth),c=0):null!==h&&!1!==this.nw&&(a=this.Uj.F()?this.Uj.width:k?+h.width:h.naturalWidth);isFinite(e.height)||g===rf||g===uo?(isFinite(b)||(b=this.Uj.F()?this.Uj.height:k?+h.height:h.naturalHeight),d=0):null!==h&&!1!==this.nw&&(b=
this.Uj.F()?this.Uj.height:k?+h.height:h.naturalHeight);isFinite(e.width)&&(a=e.width);isFinite(e.height)&&(b=e.height);e=this.kf;g=this.hg;c=Math.max(c,g.width);d=Math.max(d,g.height);a=Math.min(e.width,a);b=Math.min(e.height,b);a=Math.max(c,a);b=Math.max(d,b);null===h||h.complete||(isFinite(a)||(a=0),isFinite(b)||(b=0));wb(this.$c,a,b);Go(this,0,0,a,b)};Cl.prototype.yj=function(a,b,c,d){Lo(this,a,b,c,d)};function Wq(a){this.$p=[new Yq(a,1)]}
function Xq(a,b,c,d){var e=new ka(null),g=e.Ok,h=1/b;e.width=c/b;e.height=d/b;b=new Yq(e.Ud,b);c=a.$p[a.$p.length-1];g.setTransform(h*c.Gq,0,0,h*c.Gq,0,0);g.drawImage(c.source,0,0);a.$p.push(b)}function Yq(a,b){this.source=a;this.Gq=b}function Ea(){this.q=new bf;this.cc=null}f=Ea.prototype;f.reset=function(){this.q=new bf;this.cc=null};
function T(a,b,c,d,e,g){null===a.q&&D.k("StreamGeometryContext has been closed");void 0!==e&&!0===e?(null===a.cc&&D.k("Need to call beginFigure first"),d=new Xf(Ef),d.H=b,d.I=c,a.cc.Db.add(d)):(a.cc=new df,a.cc.ma=b,a.cc.ka=c,a.cc.wu=d,a.q.kc.add(a.cc));void 0!==g&&(a.cc.np=g)}function X(a){null===a.q&&D.k("StreamGeometryContext has been closed");null===a.cc&&D.k("Need to call beginFigure first");var b=a.cc.Db.length;0<b&&a.cc.Db.ea(b-1).close()}
function Bf(a){null===a.q&&D.k("StreamGeometryContext has been closed");null===a.cc&&D.k("Need to call beginFigure first");0<a.cc.Db.length&&(a.cc.wu=!0)}f.ib=function(a){null===this.q&&D.k("StreamGeometryContext has been closed");null===this.cc&&D.k("Need to call beginFigure first");this.cc.Wk=a};f.moveTo=function(a,b,c){void 0===c&&(c=!1);null===this.q&&D.k("StreamGeometryContext has been closed");null===this.cc&&D.k("Need to call beginFigure first");var d=new Xf(Ef);d.H=a;d.I=b;c&&d.close();this.cc.Db.add(d)};
f.lineTo=function(a,b,c){void 0===c&&(c=!1);null===this.q&&D.k("StreamGeometryContext has been closed");null===this.cc&&D.k("Need to call beginFigure first");var d=new Xf(wf);d.H=a;d.I=b;c&&d.close();this.cc.Db.add(d)};function V(a,b,c,d,e,g,h,k){void 0===k&&(k=!1);null===a.q&&D.k("StreamGeometryContext has been closed");null===a.cc&&D.k("Need to call beginFigure first");var l=new Xf(Of);l.Ac=b;l.Wc=c;l.Rh=d;l.Sh=e;l.H=g;l.I=h;k&&l.close();a.cc.Db.add(l)}
function zf(a,b,c,d,e){var g;void 0===g&&(g=!1);null===a.q&&D.k("StreamGeometryContext has been closed");null===a.cc&&D.k("Need to call beginFigure first");var h=new Xf(Pf);h.Ac=b;h.Wc=c;h.H=d;h.I=e;g&&h.close();a.cc.Db.add(h)}f.arcTo=function(a,b,c,d,e,g,h){void 0===g&&(g=0);void 0===h&&(h=!1);null===this.q&&D.k("StreamGeometryContext has been closed");null===this.cc&&D.k("Need to call beginFigure first");var k=new Xf(Qf);k.Le=a;k.xf=b;k.na=c;k.va=d;k.radiusX=e;k.radiusY=0!==g?g:e;h&&k.close();this.cc.Db.add(k)};
function Af(a,b,c,d,e,g,h,k){var l;void 0===l&&(l=!1);null===a.q&&D.k("StreamGeometryContext has been closed");null===a.cc&&D.k("Need to call beginFigure first");b=new Xf(Rf,h,k,b,c,d,e,g);l&&b.close();a.cc.Db.add(b)}function Zq(a){a=$q(a);var b=D.tb();b[0]=a[0];for(var c=1,d=1;d<a.length;)b[c]=a[d],b[c+1]=a[d],b[c+2]=a[d+1],d+=2,c+=3;D.Aa(a);return b}
function $q(a){var b=ar(a),c=D.tb(),d=Math.floor(b.length/2),e=b.length-1;a=0===a%2?2:1;for(var g=0;g<e;g++){var h=b[g],k=b[g+1],l=b[(d+g-1)%e],m=b[(d+g+a)%e];c[2*g]=h;c[2*g+1]=Ue(h.x,h.y,l.x,l.y,k.x,k.y,m.x,m.y,new O)}c[c.length]=c[0];D.Aa(b);return c}function ar(a){for(var b=D.tb(),c=1.5*Math.PI,d=0,e=0;e<a;e++)d=2*Math.PI/a*e+c,b[e]=new O(.5+.5*Math.cos(d),.5+.5*Math.sin(d));b.push(b[0]);return b}
var mq={None:"Rectangle",Rectangle:function(a,b,c){a=new bf;a.type=tf;a.ma=0;a.ka=0;a.H=b;a.I=c;return a},Square:function(a,b,c){a=new bf;a.je=Uj;a.type=tf;a.ma=0;a.ka=0;a.H=Math.min(b,c);a.I=Math.min(b,c);return a},Ellipse:function(a,b,c){a=new bf;a.type=uf;a.ma=0;a.ka=0;a.H=b;a.I=c;a.C=oe;a.D=pe;return a},Circle:function(a,b,c){a=new bf;a.je=Uj;a.type=uf;a.ma=0;a.ka=0;a.H=Math.min(b,c);a.I=Math.min(b,c);a.C=oe;a.D=pe;return a},Connector:"Ellipse",TriangleRight:function(a,b,c){a=new bf;var d=new df,
e=new Xf;e.H=b;e.I=.5*c;d.Db.add(e);b=new Xf;b.H=0;b.I=c;d.Db.add(b.close());a.kc.add(d);a.C=new R(0,.25);a.D=new R(.5,.75);return a},TriangleDown:function(a,b,c){a=new bf;var d=new df,e=new Xf;e.H=b;e.I=0;d.Db.add(e);e=new Xf;e.H=.5*b;e.I=c;d.Db.add(e.close());a.kc.add(d);a.C=new R(.25,0);a.D=new R(.75,.5);return a},TriangleLeft:function(a,b,c){a=new bf;var d=new df;d.ma=b;d.ka=c;var e=new Xf;e.H=0;e.I=.5*c;d.Db.add(e);c=new Xf;c.H=b;c.I=0;d.Db.add(c.close());a.kc.add(d);a.C=new R(.5,.25);a.D=new R(1,
.75);return a},TriangleUp:function(a,b,c){a=new bf;var d=new df;d.ma=b;d.ka=c;var e=new Xf;e.H=0;e.I=c;d.Db.add(e);c=new Xf;c.H=.5*b;c.I=0;d.Db.add(c.close());a.kc.add(d);a.C=new R(.25,.5);a.D=new R(.75,1);return a},Line1:function(a,b,c){a=new bf;a.type=sf;a.ma=0;a.ka=0;a.H=b;a.I=c;return a},Line2:function(a,b,c){a=new bf;a.type=sf;a.ma=b;a.ka=0;a.H=0;a.I=c;return a},MinusLine:"LineH",LineH:function(a,b,c){a=new bf;a.type=sf;a.ma=0;a.ka=c/2;a.H=b;a.I=c/2;return a},LineV:function(a,b,c){a=new bf;a.type=
sf;a.ma=b/2;a.ka=0;a.H=b/2;a.I=c;return a},BarH:"Rectangle",BarV:"Rectangle",Curve1:function(a,b,c){a=D.v();T(a,0,0,!1);V(a,Fd*b,0,1*b,(1-Fd)*c,b,c);b=a.q;D.u(a);return b},Curve2:function(a,b,c){a=D.v();T(a,0,0,!1);V(a,0,Fd*c,(1-Fd)*b,c,b,c);b=a.q;D.u(a);return b},Curve3:function(a,b,c){a=D.v();T(a,1*b,0,!1);V(a,1*b,Fd*c,Fd*b,1*c,0,1*c);b=a.q;D.u(a);return b},Curve4:function(a,b,c){a=D.v();T(a,1*b,0,!1);V(a,(1-Fd)*b,0,0,(1-Fd)*c,0,1*c);b=a.q;D.u(a);return b},Alternative:"Triangle",Merge:"Triangle",
Triangle:function(a,b,c){a=D.v();T(a,.5*b,0*c,!0);a.lineTo(0*b,1*c);a.lineTo(1*b,1*c,!0);b=a.q;b.C=new R(.25,.5);b.D=new R(.75,1);D.u(a);return b},Decision:"Diamond",Diamond:function(a,b,c){a=D.v();T(a,.5*b,0,!0);a.lineTo(0,.5*c);a.lineTo(.5*b,1*c);a.lineTo(1*b,.5*c,!0);b=a.q;b.C=new R(.25,.25);b.D=new R(.75,.75);D.u(a);return b},Pentagon:function(a,b,c){var d=ar(5);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);for(var e=1;5>e;e++)a.lineTo(d[e].x*b,d[e].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.2,.22);b.D=new R(.8,
.9);D.u(a);return b},DataTransmission:"Hexagon",Hexagon:function(a,b,c){var d=ar(6);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);for(var e=1;6>e;e++)a.lineTo(d[e].x*b,d[e].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.07,.25);b.D=new R(.93,.75);D.u(a);return b},Heptagon:function(a,b,c){var d=ar(7);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);for(var e=1;7>e;e++)a.lineTo(d[e].x*b,d[e].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.2,.15);b.D=new R(.8,.85);D.u(a);return b},Octagon:function(a,b,c){var d=ar(8);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);
for(var e=1;8>e;e++)a.lineTo(d[e].x*b,d[e].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.15,.15);b.D=new R(.85,.85);D.u(a);return b},Nonagon:function(a,b,c){var d=ar(9);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);for(var e=1;9>e;e++)a.lineTo(d[e].x*b,d[e].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.17,.13);b.D=new R(.82,.82);D.u(a);return b},Decagon:function(a,b,c){var d=ar(10);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);for(var e=1;10>e;e++)a.lineTo(d[e].x*b,d[e].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.16,.16);b.D=new R(.84,.84);D.u(a);return b},
Dodecagon:function(a,b,c){var d=ar(12);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);for(var e=1;12>e;e++)a.lineTo(d[e].x*b,d[e].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.16,.16);b.D=new R(.84,.84);D.u(a);return b},FivePointedStar:function(a,b,c){var d=$q(5);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);for(var e=1;10>e;e++)a.lineTo(d[e].x*b,d[e].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.312,.383);b.D=new R(.693,.765);D.u(a);return b},SixPointedStar:function(a,b,c){var d=$q(6);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);for(var e=1;12>e;e++)a.lineTo(d[e].x*
b,d[e].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.17,.251);b.D=new R(.833,.755);D.u(a);return b},SevenPointedStar:function(a,b,c){var d=$q(7);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);for(var e=1;14>e;e++)a.lineTo(d[e].x*b,d[e].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.363,.361);b.D=new R(.641,.709);D.u(a);return b},EightPointedStar:function(a,b,c){var d=$q(8);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);for(var e=1;16>e;e++)a.lineTo(d[e].x*b,d[e].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.252,.255);b.D=new R(.75,.75);D.u(a);return b},NinePointedStar:function(a,
b,c){var d=$q(9);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);for(var e=1;18>e;e++)a.lineTo(d[e].x*b,d[e].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.355,.361);b.D=new R(.645,.651);D.u(a);return b},TenPointedStar:function(a,b,c){var d=$q(10);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);for(var e=1;20>e;e++)a.lineTo(d[e].x*b,d[e].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.281,.261);b.D=new R(.723,.748);D.u(a);return b},FivePointedBurst:function(a,b,c){var d=Zq(5);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);for(var e=1;e<d.length;e+=3)V(a,d[e].x*
b,d[e].y*c,d[e+1].x*b,d[e+1].y*c,d[e+2].x*b,d[e+2].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.312,.383);b.D=new R(.693,.765);D.u(a);return b},SixPointedBurst:function(a,b,c){var d=Zq(6);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);for(var e=1;e<d.length;e+=3)V(a,d[e].x*b,d[e].y*c,d[e+1].x*b,d[e+1].y*c,d[e+2].x*b,d[e+2].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.17,.251);b.D=new R(.833,.755);D.u(a);return b},SevenPointedBurst:function(a,b,c){var d=Zq(7);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);for(var e=1;e<d.length;e+=3)V(a,d[e].x*
b,d[e].y*c,d[e+1].x*b,d[e+1].y*c,d[e+2].x*b,d[e+2].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.363,.361);b.D=new R(.641,.709);D.u(a);return b},EightPointedBurst:function(a,b,c){var d=Zq(8);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);for(var e=1;e<d.length;e+=3)V(a,d[e].x*b,d[e].y*c,d[e+1].x*b,d[e+1].y*c,d[e+2].x*b,d[e+2].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.252,.255);b.D=new R(.75,.75);D.u(a);return b},NinePointedBurst:function(a,b,c){var d=Zq(9);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);for(var e=1;e<d.length;e+=3)V(a,d[e].x*
b,d[e].y*c,d[e+1].x*b,d[e+1].y*c,d[e+2].x*b,d[e+2].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.355,.361);b.D=new R(.645,.651);D.u(a);return b},TenPointedBurst:function(a,b,c){var d=Zq(10);a=D.v();T(a,d[0].x*b,d[0].y*c,!0);for(var e=1;e<d.length;e+=3)V(a,d[e].x*b,d[e].y*c,d[e+1].x*b,d[e+1].y*c,d[e+2].x*b,d[e+2].y*c);D.Aa(d);X(a);b=a.q;b.C=new R(.281,.261);b.D=new R(.723,.748);D.u(a);return b},Cloud:function(a,b,c){a=D.v();T(a,.08034461*b,.1944299*c,!0);V(a,-.09239631*b,.07836421*c,.1406031*b,-.0542823*c,.2008615*
b,.05349299*c);V(a,.2450511*b,-.00697547*c,.3776197*b,-.01112067*c,.4338609*b,.074219*c);V(a,.4539471*b,0,.6066018*b,-.02526587*c,.6558228*b,.07004196*c);V(a,.6914277*b,-.01904177*c,.8921095*b,-.01220843*c,.8921095*b,.08370865*c);V(a,1.036446*b,.04105738*c,1.020377*b,.3022052*c,.9147671*b,.3194596*c);V(a,1.04448*b,.360238*c,.992256*b,.5219009*c,.9082935*b,.562044*c);V(a,1.032337*b,.5771781*c,1.018411*b,.8120651*c,.9212406*b,.8217117*c);V(a,1.028411*b,.9571472*c,.8556702*b,1.052487*c,.7592566*b,.9156953*
c);V(a,.7431877*b,1.009325*c,.5624123*b,1.021761*c,.5101666*b,.9310455*c);V(a,.4820677*b,1.031761*c,.3030112*b,1.002796*c,.2609328*b,.9344623*c);V(a,.2329994*b,1.01518*c,.03213784*b,1.01518*c,.08034461*b,.870098*c);V(a,-.02812061*b,.9032597*c,-.01205169*b,.6835638*c,.06829292*b,.6545475*c);V(a,-.01812061*b,.6089503*c,-.00606892*b,.4555777*c,.06427569*b,.4265613*c);V(a,-.01606892*b,.3892545*c,-.01205169*b,.1944299*c,.08034461*b,.1944299*c);X(a);b=a.q;b.C=new R(.1,.1);b.D=new R(.9,.9);D.u(a);return b},
Gate:"Crescent",Crescent:function(a,b,c){a=D.v();T(a,0,0,!0);V(a,1*b,0,1*b,1*c,0,1*c);V(a,.5*b,.75*c,.5*b,.25*c,0,0);X(a);b=a.q;b.C=new R(.511,.19);b.D=new R(.776,.76);D.u(a);return b},FramedRectangle:function(a,b,c){var d=D.v(),e=a?a.Oc:NaN;a=a?a.Qu:NaN;isNaN(e)&&(e=.1);isNaN(a)&&(a=.1);T(d,0,0,!0);d.lineTo(1*b,0);d.lineTo(1*b,1*c);d.lineTo(0,1*c,!0);T(d,e*b,a*c,!1,!0);d.lineTo(e*b,(1-a)*c);d.lineTo((1-e)*b,(1-a)*c);d.lineTo((1-e)*b,a*c,!0);b=d.q;b.C=new R(e,a);b.D=new R(1-e,1-a);D.u(d);return b},
Delay:"HalfEllipse",HalfEllipse:function(a,b,c){a=D.v();T(a,0,0,!0);V(a,Fd*b,0,1*b,(.5-Fd/2)*c,1*b,.5*c);V(a,1*b,(.5+Fd/2)*c,Fd*b,1*c,0,1*c);X(a);b=a.q;b.C=new R(0,.2);b.D=new R(.75,.8);D.u(a);return b},Heart:function(a,b,c){a=D.v();T(a,.5*b,1*c,!0);V(a,.1*b,.8*c,0,.5*c,0*b,.3*c);V(a,0*b,0,.45*b,0,.5*b,.3*c);V(a,.55*b,0,1*b,0,1*b,.3*c);V(a,b,.5*c,.9*b,.8*c,.5*b,1*c);X(a);b=a.q;b.C=new R(.15,.29);b.D=new R(.86,.68);D.u(a);return b},Spade:function(a,b,c){a=D.v();T(a,.5*b,0,!0);a.lineTo(.51*b,.01*c);
V(a,.6*b,.2*c,b,.25*c,b,.5*c);V(a,b,.8*c,.6*b,.8*c,.55*b,.7*c);V(a,.5*b,.75*c,.55*b,.95*c,.75*b,c);a.lineTo(.25*b,c);V(a,.45*b,.95*c,.5*b,.75*c,.45*b,.7*c);V(a,.4*b,.8*c,0,.8*c,0,.5*c);V(a,0,.25*c,.4*b,.2*c,.49*b,.01*c);X(a);b=a.q;b.C=new R(.19,.26);b.D=new R(.8,.68);D.u(a);return b},Club:function(a,b,c){a=D.v();T(a,.4*b,.6*c,!0);V(a,.5*b,.75*c,.45*b,.95*c,.15*b,1*c);a.lineTo(.85*b,c);V(a,.55*b,.95*c,.5*b,.75*c,.6*b,.6*c);var d=.2,e=.3,g=0,h=4*(Math.SQRT2-1)/3*d;V(a,(.5-d+e)*b,(.5+h+g)*c,(.5-h+e)*
b,(.5+d+g)*c,(.5+e)*b,(.5+d+g)*c);V(a,(.5+h+e)*b,(.5+d+g)*c,(.5+d+e)*b,(.5+h+g)*c,(.5+d+e)*b,(.5+g)*c);V(a,(.5+d+e)*b,(.5-h+g)*c,(.5+h+e)*b,(.5-d+g)*c,(.5+e)*b,(.5-d+g)*c);V(a,(.5-h+e)*b,(.5-d+g)*c,(.5-d+e+.05)*b,(.5-h+g-.02)*c,.65*b,.36771243*c);d=.2;e=0;g=-.3;h=4*(Math.SQRT2-1)/3*d;V(a,(.5+h+e)*b,(.5+d+g)*c,(.5+d+e)*b,(.5+h+g)*c,(.5+d+e)*b,(.5+g)*c);V(a,(.5+d+e)*b,(.5-h+g)*c,(.5+h+e)*b,(.5-d+g)*c,(.5+e)*b,(.5-d+g)*c);V(a,(.5-h+e)*b,(.5-d+g)*c,(.5-d+e)*b,(.5-h+g)*c,(.5-d+e)*b,(.5+g)*c);V(a,(.5-d+
e)*b,(.5+h+g)*c,(.5-h+e)*b,(.5+d+g)*c,.35*b,.36771243*c);d=.2;e=-.3;g=0;h=4*(Math.SQRT2-1)/3*d;V(a,(.5+d+e-.05)*b,(.5-h+g-.02)*c,(.5+h+e)*b,(.5-d+g)*c,(.5+e)*b,(.5-d+g)*c);V(a,(.5-h+e)*b,(.5-d+g)*c,(.5-d+e)*b,(.5-h+g)*c,(.5-d+e)*b,(.5+g)*c);V(a,(.5-d+e)*b,(.5+h+g)*c,(.5-h+e)*b,(.5+d+g)*c,(.5+e)*b,(.5+d+g)*c);V(a,(.5+h+e)*b,(.5+d+g)*c,(.5+d+e)*b,(.5+h+g)*c,.4*b,.6*c);X(a);b=a.q;b.C=new R(.06,.39);b.D=new R(.93,.58);D.u(a);return b},Ring:function(a,b,c){a=D.v();var d=4*(Math.SQRT2-1)/3*.5;T(a,b,.5*
c,!0);V(a,b,(.5-d)*c,(.5+d)*b,0,.5*b,0);V(a,(.5-d)*b,0,0,(.5-d)*c,0,.5*c);V(a,0,(.5+d)*c,(.5-d)*b,c,.5*b,c);V(a,(.5+d)*b,c,b,(.5+d)*c,b,.5*c);d=4*(Math.SQRT2-1)/3*.4;T(a,.5*b,.1*c,!0,!0);V(a,(.5+d)*b,.1*c,.9*b,(.5-d)*c,.9*b,.5*c);V(a,.9*b,(.5+d)*c,(.5+d)*b,.9*c,.5*b,.9*c);V(a,(.5-d)*b,.9*c,.1*b,(.5+d)*c,.1*b,.5*c);V(a,.1*b,(.5-d)*c,(.5-d)*b,.1*c,.5*b,.1*c);b=a.q;b.C=new R(.146,.146);b.D=new R(.853,.853);b.je=Uj;D.u(a);return b},YinYang:function(a,b,c){var d=.5;a=D.v();d=.5;T(a,.5*b,0,!0);a.arcTo(270,
180,.5*b,.5*b,.5*b);V(a,1*b,d*c,0,d*c,d*b,0,!0);var d=.1,e=.25;T(a,(.5+d)*b,e*c,!0,!0);a.arcTo(0,-360,.5*b,c*e,d*b);X(a);T(a,.5*b,0,!1);a.arcTo(270,-180,.5*b,.5*b,.5*b);a.ib(!1);e=.75;T(a,(.5+d)*b,e*c,!0);a.arcTo(0,360,.5*b,c*e,d*b);X(a);b=a.q;b.je=Uj;D.u(a);return b},Peace:function(a,b,c){a=D.v();var d=4*(Math.SQRT2-1)/3*.5;T(a,b,.5*c,!0);V(a,b,(.5-d)*c,(.5+d)*b,0,.5*b,0);V(a,(.5-d)*b,0,0,(.5-d)*c,0,.5*c);V(a,0,(.5+d)*c,(.5-d)*b,c,.5*b,c);V(a,(.5+d)*b,c,b,(.5+d)*c,b,.5*c);d=4*(Math.SQRT2-1)/3*.4;
T(a,.5*b,.1*c,!0,!0);V(a,(.5+d)*b,.1*c,.9*b,(.5-d)*c,.9*b,.5*c);V(a,.9*b,(.5+d)*c,(.5+d)*b,.9*c,.5*b,.9*c);V(a,(.5-d)*b,.9*c,.1*b,(.5+d)*c,.1*b,.5*c);V(a,.1*b,(.5-d)*c,(.5-d)*b,.1*c,.5*b,.1*c);var d=.07,e=0,g=-.707*.11,h=4*(Math.SQRT2-1)/3*d;T(a,(.5+d+e)*b,(.5+g)*c,!0);V(a,(.5+d+e)*b,(.5-h+g)*c,(.5+h+e)*b,(.5-d+g)*c,(.5+e)*b,(.5-d+g)*c);V(a,(.5-h+e)*b,(.5-d+g)*c,(.5-d+e)*b,(.5-h+g)*c,(.5-d+e)*b,(.5+g)*c);V(a,(.5-d+e)*b,(.5+h+g)*c,(.5-h+e)*b,(.5+d+g)*c,(.5+e)*b,(.5+d+g)*c);V(a,(.5+h+e)*b,(.5+d+g)*
c,(.5+d+e)*b,(.5+h+g)*c,(.5+d+e)*b,(.5+g)*c);d=.07;e=-.707*.11;g=.707*.11;h=4*(Math.SQRT2-1)/3*d;T(a,(.5+d+e)*b,(.5+g)*c,!0);V(a,(.5+d+e)*b,(.5-h+g)*c,(.5+h+e)*b,(.5-d+g)*c,(.5+e)*b,(.5-d+g)*c);V(a,(.5-h+e)*b,(.5-d+g)*c,(.5-d+e)*b,(.5-h+g)*c,(.5-d+e)*b,(.5+g)*c);V(a,(.5-d+e)*b,(.5+h+g)*c,(.5-h+e)*b,(.5+d+g)*c,(.5+e)*b,(.5+d+g)*c);V(a,(.5+h+e)*b,(.5+d+g)*c,(.5+d+e)*b,(.5+h+g)*c,(.5+d+e)*b,(.5+g)*c);d=.07;e=.707*.11;g=.707*.11;h=4*(Math.SQRT2-1)/3*d;T(a,(.5+d+e)*b,(.5+g)*c,!0);V(a,(.5+d+e)*b,(.5-h+
g)*c,(.5+h+e)*b,(.5-d+g)*c,(.5+e)*b,(.5-d+g)*c);V(a,(.5-h+e)*b,(.5-d+g)*c,(.5-d+e)*b,(.5-h+g)*c,(.5-d+e)*b,(.5+g)*c);V(a,(.5-d+e)*b,(.5+h+g)*c,(.5-h+e)*b,(.5+d+g)*c,(.5+e)*b,(.5+d+g)*c);V(a,(.5+h+e)*b,(.5+d+g)*c,(.5+d+e)*b,(.5+h+g)*c,(.5+d+e)*b,(.5+g)*c);b=a.q;b.C=new R(.146,.146);b.D=new R(.853,.853);b.je=Uj;D.u(a);return b},NotAllowed:function(a,b,c){var d=.5*Fd,e=.5;a=D.v();T(a,.5*b,(.5-e)*c,!0);V(a,(.5-d)*b,(.5-e)*c,(.5-e)*b,(.5-d)*c,(.5-e)*b,.5*c);V(a,(.5-e)*b,(.5+d)*c,(.5-d)*b,(.5+e)*c,.5*b,
(.5+e)*c);V(a,(.5+d)*b,(.5+e)*c,(.5+e)*b,(.5+d)*c,(.5+e)*b,.5*c);V(a,(.5+e)*b,(.5-d)*c,(.5+d)*b,(.5-e)*c,.5*b,(.5-e)*c);var e=.4,d=.4*Fd,g=D.P(),h=D.P(),k=D.P(),l=D.P();Ge(.5,.5-e,.5+d,.5-e,.5+e,.5-d,.5+e,.5,.42,g,h,k,l,l);var m=D.P(),n=D.P(),p=D.P();Ge(.5,.5-e,.5+d,.5-e,.5+e,.5-d,.5+e,.5,.58,l,l,p,m,n);var q=D.P(),r=D.P(),s=D.P();Ge(.5,.5+e,.5-d,.5+e,.5-e,.5+d,.5-e,.5,.42,q,r,s,l,l);var u=D.P(),t=D.P(),y=D.P();Ge(.5,.5+e,.5-d,.5+e,.5-e,.5+d,.5-e,.5,.58,l,l,y,u,t);T(a,y.x*b,y.y*c,!0,!0);V(a,u.x*b,
u.y*c,t.x*b,t.y*c,(.5-e)*b,.5*c);V(a,(.5-e)*b,(.5-d)*c,(.5-d)*b,(.5-e)*c,.5*b,(.5-e)*c);V(a,g.x*b,g.y*c,h.x*b,h.y*c,k.x*b,k.y*c);a.lineTo(y.x*b,y.y*c);X(a);T(a,s.x*b,s.y*c,!0,!0);a.lineTo(p.x*b,p.y*c);V(a,m.x*b,m.y*c,n.x*b,n.y*c,(.5+e)*b,.5*c);V(a,(.5+e)*b,(.5+d)*c,(.5+d)*b,(.5+e)*c,.5*b,(.5+e)*c);V(a,q.x*b,q.y*c,r.x*b,r.y*c,s.x*b,s.y*c);X(a);D.A(g);D.A(h);D.A(k);D.A(l);D.A(m);D.A(n);D.A(p);D.A(q);D.A(r);D.A(s);D.A(u);D.A(t);D.A(y);b=a.q;D.u(a);b.je=Uj;return b},Fragile:function(a,b,c){a=D.v();T(a,
0,0,!0);a.lineTo(.25*b,0);a.lineTo(.2*b,.15*c);a.lineTo(.3*b,.25*c);a.lineTo(.29*b,.33*c);a.lineTo(.35*b,.25*c);a.lineTo(.3*b,.15*c);a.lineTo(.4*b,0);a.lineTo(1*b,0);V(a,1*b,.25*c,.75*b,.5*c,.55*b,.5*c);a.lineTo(.55*b,.9*c);a.lineTo(.7*b,.9*c);a.lineTo(.7*b,1*c);a.lineTo(.3*b,1*c);a.lineTo(.3*b,.9*c);a.lineTo(.45*b,.9*c);a.lineTo(.45*b,.5*c);V(a,.25*b,.5*c,0,.25*c,0,0);X(a);b=a.q;b.C=new R(.25,0);b.D=new R(.75,.4);D.u(a);return b},HourGlass:function(a,b,c){a=D.v();T(a,.65*b,.5*c,!0);a.lineTo(1*b,
1*c);a.lineTo(0,1*c);a.lineTo(.35*b,.5*c);a.lineTo(0,0);a.lineTo(1*b,0);X(a);b=a.q;D.u(a);return b},Lightning:function(a,b,c){a=D.v();T(a,0*b,.55*c,!0);a.lineTo(.75*b,0);a.lineTo(.25*b,.45*c);a.lineTo(.9*b,.48*c);a.lineTo(.4*b,1*c);a.lineTo(.65*b,.55*c);X(a);b=a.q;D.u(a);return b},Parallelogram1:function(a,b,c){a=a?a.Oc:NaN;isNaN(a)&&(a=.1);var d=D.v();T(d,a*b,0,!0);d.lineTo(1*b,0);d.lineTo((1-a)*b,1*c);d.lineTo(0,1*c);X(d);b=d.q;b.C=new R(a,0);b.D=new R(1-a,1);D.u(d);return b},Input:"Output",Output:function(a,
b,c){a=D.v();T(a,0,1*c,!0);a.lineTo(.1*b,0);a.lineTo(1*b,0);a.lineTo(.9*b,1*c);X(a);b=a.q;b.C=new R(.1,0);b.D=new R(.9,1);D.u(a);return b},Parallelogram2:function(a,b,c){a=a?a.Oc:NaN;isNaN(a)&&(a=.25);var d=D.v();T(d,a*b,0,!0);d.lineTo(1*b,0);d.lineTo((1-a)*b,1*c);d.lineTo(0,1*c);X(d);b=d.q;b.C=new R(a,0);b.D=new R(1-a,1);D.u(d);return b},ThickCross:function(a,b,c){a=a?a.Oc:NaN;isNaN(a)&&(a=.25);var d=D.v();T(d,(.5-a/2)*b,0,!0);d.lineTo((.5+a/2)*b,0);d.lineTo((.5+a/2)*b,(.5-a/2)*c);d.lineTo(1*b,(.5-
a/2)*c);d.lineTo(1*b,(.5+a/2)*c);d.lineTo((.5+a/2)*b,(.5+a/2)*c);d.lineTo((.5+a/2)*b,1*c);d.lineTo((.5-a/2)*b,1*c);d.lineTo((.5-a/2)*b,(.5+a/2)*c);d.lineTo(0,(.5+a/2)*c);d.lineTo(0,(.5-a/2)*c);d.lineTo((.5-a/2)*b,(.5-a/2)*c);X(d);b=d.q;b.C=new R(.5-a/2,.5-a/2);b.D=new R(.5+a/2,.5+a/2);D.u(d);return b},ThickX:function(a,b,c){a=.25/Math.SQRT2;var d=D.v();T(d,.3*b,0,!0);d.lineTo(.5*b,.2*c);d.lineTo(.7*b,0);d.lineTo(1*b,.3*c);d.lineTo(.8*b,.5*c);d.lineTo(1*b,.7*c);d.lineTo(.7*b,1*c);d.lineTo(.5*b,.8*
c);d.lineTo(.3*b,1*c);d.lineTo(0,.7*c);d.lineTo(.2*b,.5*c);d.lineTo(0,.3*c);X(d);b=d.q;b.C=new R(.5-a,.5-a);b.D=new R(.5+a,.5+a);D.u(d);return b},ThinCross:function(a,b,c){var d=a?a.Oc:NaN;isNaN(d)&&(d=.1);a=D.v();T(a,(.5-d/2)*b,0,!0);a.lineTo((.5+d/2)*b,0);a.lineTo((.5+d/2)*b,(.5-d/2)*c);a.lineTo(1*b,(.5-d/2)*c);a.lineTo(1*b,(.5+d/2)*c);a.lineTo((.5+d/2)*b,(.5+d/2)*c);a.lineTo((.5+d/2)*b,1*c);a.lineTo((.5-d/2)*b,1*c);a.lineTo((.5-d/2)*b,(.5+d/2)*c);a.lineTo(0,(.5+d/2)*c);a.lineTo(0,(.5-d/2)*c);a.lineTo((.5-
d/2)*b,(.5-d/2)*c);X(a);b=a.q;D.u(a);return b},ThinX:function(a,b,c){a=D.v();T(a,.1*b,0,!0);a.lineTo(.5*b,.4*c);a.lineTo(.9*b,0);a.lineTo(1*b,.1*c);a.lineTo(.6*b,.5*c);a.lineTo(1*b,.9*c);a.lineTo(.9*b,1*c);a.lineTo(.5*b,.6*c);a.lineTo(.1*b,1*c);a.lineTo(0,.9*c);a.lineTo(.4*b,.5*c);a.lineTo(0,.1*c);X(a);b=a.q;D.u(a);return b},RightTriangle:function(a,b,c){a=D.v();T(a,0,0,!0);a.lineTo(1*b,1*c);a.lineTo(0,1*c);X(a);b=a.q;b.C=new R(0,.5);b.D=new R(.5,1);D.u(a);return b},RoundedIBeam:function(a,b,c){a=
D.v();T(a,0,0,!0);a.lineTo(1*b,0);V(a,.5*b,.25*c,.5*b,.75*c,1*b,1*c);a.lineTo(0,1*c);V(a,.5*b,.75*c,.5*b,.25*c,0,0);X(a);b=a.q;D.u(a);return b},RoundedRectangle:function(a,b,c){var d=a?a.Oc:NaN;isNaN(d)&&(d=5);d=Math.min(d,b/3);d=Math.min(d,c/3);a=d*Fd;var e=D.v();T(e,d,0,!0);e.lineTo(b-d,0);V(e,b-a,0,b,a,b,d);e.lineTo(b,c-d);V(e,b,c-a,b-a,c,b-d,c);e.lineTo(d,c);V(e,a,c,0,c-a,0,c-d);e.lineTo(0,d);V(e,0,a,a,0,d,0);X(e);b=e.q;1<a?(b.C=new R(0,0,a,a),b.D=new R(1,1,-a,-a)):(b.C=cc,b.D=rc);D.u(e);return b},
Border:function(a,b,c){var d=a?a.Oc:NaN;isNaN(d)&&(d=5);d=Math.min(d,b/3);d=Math.min(d,c/3);a=D.v();T(a,d,0,!0);a.lineTo(b-d,0);V(a,b-0,0,b,0,b,d);a.lineTo(b,c-d);V(a,b,c-0,b-0,c,b-d,c);a.lineTo(d,c);V(a,0,c,0,c-0,0,c-d);a.lineTo(0,d);V(a,0,0,0,0,d,0);X(a);b=a.q;b.C=cc;b.D=rc;D.u(a);return b},SquareIBeam:function(a,b,c){var d=a?a.Oc:NaN;isNaN(d)&&(d=.2);a=D.v();T(a,0,0,!0);a.lineTo(1*b,0);a.lineTo(1*b,d*c);a.lineTo((.5+d/2)*b,d*c);a.lineTo((.5+d/2)*b,(1-d)*c);a.lineTo(1*b,(1-d)*c);a.lineTo(1*b,1*
c);a.lineTo(0,1*c);a.lineTo(0,(1-d)*c);a.lineTo((.5-d/2)*b,(1-d)*c);a.lineTo((.5-d/2)*b,d*c);a.lineTo(0,d*c);X(a);b=a.q;D.u(a);return b},Trapezoid:function(a,b,c){a=a?a.Oc:NaN;isNaN(a)&&(a=.2);var d=D.v();T(d,a*b,0,!0);d.lineTo((1-a)*b,0);d.lineTo(1*b,1*c);d.lineTo(0,1*c);X(d);b=d.q;b.C=new R(a,0);b.D=new R(1-a,1);D.u(d);return b},ManualLoop:"ManualOperation",ManualOperation:function(a,b,c){var d=a?a.Oc:NaN;isNaN(d)&&(d=0);a=D.v();T(a,d,0,!0);a.lineTo(0,0);a.lineTo(1*b,0);a.lineTo(.9*b,1*c);a.lineTo(.1*
b,1*c);X(a);b=a.q;b.C=new R(.1,0);b.D=new R(.9,1);D.u(a);return b},GenderMale:function(a,b,c){a=D.v();var d=.4*Fd,e=.4,g=D.P(),h=D.P(),k=D.P(),l=D.P();T(a,(.5-e)*b,.5*c,!0);V(a,(.5-e)*b,(.5-d)*c,(.5-d)*b,(.5-e)*c,.5*b,(.5-e)*c);Ge(.5,.5-e,.5+d,.5-e,.5+e,.5-d,.5+e,.5,.44,k,l,h,g,g);V(a,k.x*b,k.y*c,l.x*b,l.y*c,h.x*b,h.y*c);var m=D.Fb(h.x,h.y);Ge(.5,.5-e,.5+d,.5-e,.5+e,.5-d,.5+e,.5,.56,g,g,h,k,l);var n=D.Fb(h.x,h.y);a.lineTo((.1*m.x+.855)*b,.1*m.y*c);a.lineTo(.85*b,.1*m.y*c);a.lineTo(.85*b,0);a.lineTo(1*
b,0);a.lineTo(1*b,.15*c);a.lineTo((.1*n.x+.9)*b,.15*c);a.lineTo((.1*n.x+.9)*b,(.1*n.y+.05*.9)*c);a.lineTo(n.x*b,n.y*c);V(a,k.x*b,k.y*c,l.x*b,l.y*c,(.5+e)*b,.5*c);V(a,(.5+e)*b,(.5+d)*c,(.5+d)*b,(.5+e)*c,.5*b,(.5+e)*c);V(a,(.5-d)*b,(.5+e)*c,(.5-e)*b,(.5+d)*c,(.5-e)*b,.5*c);e=.35;d=.35*Fd;T(a,.5*b,(.5-e)*c,!0,!0);V(a,(.5-d)*b,(.5-e)*c,(.5-e)*b,(.5-d)*c,(.5-e)*b,.5*c);V(a,(.5-e)*b,(.5+d)*c,(.5-d)*b,(.5+e)*c,.5*b,(.5+e)*c);V(a,(.5+d)*b,(.5+e)*c,(.5+e)*b,(.5+d)*c,(.5+e)*b,.5*c);V(a,(.5+e)*b,(.5-d)*c,(.5+
d)*b,(.5-e)*c,.5*b,(.5-e)*c);T(a,(.5-e)*b,.5*c,!0);D.A(g);D.A(h);D.A(k);D.A(l);D.A(m);D.A(n);b=a.q;b.C=new R(.202,.257);b.D=new R(.692,.839);b.je=Uj;D.u(a);return b},GenderFemale:function(a,b,c){a=D.v();var d=.375,e=0,g=-.125,h=4*(Math.SQRT2-1)/3*d;T(a,(.525+e)*b,(.5+d+g)*c,!0);V(a,(.5+h+e)*b,(.5+d+g)*c,(.5+d+e)*b,(.5+h+g)*c,(.5+d+e)*b,(.5+g)*c);V(a,(.5+d+e)*b,(.5-h+g)*c,(.5+h+e)*b,(.5-d+g)*c,(.5+e)*b,(.5-d+g)*c);V(a,(.5-h+e)*b,(.5-d+g)*c,(.5-d+e)*b,(.5-h+g)*c,(.5-d+e)*b,(.5+g)*c);V(a,(.5-d+e)*b,
(.5+h+g)*c,(.5-h+e)*b,(.5+d+g)*c,(.475+e)*b,(.5+d+g)*c);a.lineTo(.475*b,.85*c);a.lineTo(.425*b,.85*c);a.lineTo(.425*b,.9*c);a.lineTo(.475*b,.9*c);a.lineTo(.475*b,1*c);a.lineTo(.525*b,1*c);a.lineTo(.525*b,.9*c);a.lineTo(.575*b,.9*c);a.lineTo(.575*b,.85*c);a.lineTo(.525*b,.85*c);X(a);d=.325;e=0;g=-.125;h=4*(Math.SQRT2-1)/3*d;T(a,(.5+d+e)*b,(.5+g)*c,!0,!0);V(a,(.5+d+e)*b,(.5+h+g)*c,(.5+h+e)*b,(.5+d+g)*c,(.5+e)*b,(.5+d+g)*c);V(a,(.5-h+e)*b,(.5+d+g)*c,(.5-d+e)*b,(.5+h+g)*c,(.5-d+e)*b,(.5+g)*c);V(a,(.5-
d+e)*b,(.5-h+g)*c,(.5-h+e)*b,(.5-d+g)*c,(.5+e)*b,(.5-d+g)*c);V(a,(.5+h+e)*b,(.5-d+g)*c,(.5+d+e)*b,(.5-h+g)*c,(.5+d+e)*b,(.5+g)*c);T(a,(.525+e)*b,(.5+d+g)*c,!0);b=a.q;b.C=new R(.232,.136);b.D=new R(.782,.611);b.je=Uj;D.u(a);return b},PlusLine:function(a,b,c){a=D.v();T(a,0,.5*c,!1);a.lineTo(1*b,.5*c);a.moveTo(.5*b,0);a.lineTo(.5*b,1*c);b=a.q;D.u(a);return b},XLine:function(a,b,c){a=D.v();T(a,0,1*c,!1);a.lineTo(1*b,0);a.moveTo(0,0);a.lineTo(1*b,1*c);b=a.q;D.u(a);return b},AsteriskLine:function(a,b,c){a=
D.v();var d=.2/Math.SQRT2;T(a,d*b,(1-d)*c,!1);a.lineTo((1-d)*b,d*c);a.moveTo(d*b,d*c);a.lineTo((1-d)*b,(1-d)*c);a.moveTo(0*b,.5*c);a.lineTo(1*b,.5*c);a.moveTo(.5*b,0*c);a.lineTo(.5*b,1*c);b=a.q;D.u(a);return b},CircleLine:function(a,b,c){var d=.5*Fd;a=D.v();T(a,1*b,.5*c,!1);V(a,1*b,(.5+d)*c,(.5+d)*b,1*c,.5*b,1*c);V(a,(.5-d)*b,1*c,0,(.5+d)*c,0,.5*c);V(a,0,(.5-d)*c,(.5-d)*b,0,.5*b,0);V(a,(.5+d)*b,0,1*b,(.5-d)*c,1*b,.5*c);b=a.q;b.C=new R(.146,.146);b.D=new R(.853,.853);b.je=Uj;D.u(a);return b},Pie:function(a,
b,c){a=D.v();var d=4*(Math.SQRT2-1)/3*.5;T(a,(.5*Math.SQRT2/2+.5)*b,(.5-.5*Math.SQRT2/2)*c,!0);V(a,.7*b,0*c,.5*b,0*c,.5*b,0*c);V(a,(.5-d+0)*b,0*c,0*b,(.5-d+0)*c,0*b,.5*c);V(a,0*b,(.5+d+0)*c,(.5-d+0)*b,1*c,.5*b,1*c);V(a,(.5+d+0)*b,1*c,1*b,(.5+d+0)*c,1*b,.5*c);a.lineTo(.5*b,.5*c);X(a);b=a.q;D.u(a);return b},PiePiece:function(a,b,c){var d=Fd/Math.SQRT2*.5,e=Math.SQRT2/2,g=1-Math.SQRT2/2;a=D.v();T(a,b,c,!0);V(a,b,(1-d)*c,(e+d)*b,(g+d)*c,e*b,g*c);a.lineTo(0,c);X(a);b=a.q;D.u(a);return b},StopSign:function(a,
b,c){a=1/(Math.SQRT2+2);var d=D.v();T(d,a*b,0,!0);d.lineTo((1-a)*b,0);d.lineTo(1*b,a*c);d.lineTo(1*b,(1-a)*c);d.lineTo((1-a)*b,1*c);d.lineTo(a*b,1*c);d.lineTo(0,(1-a)*c);d.lineTo(0,a*c);X(d);b=d.q;b.C=new R(a/2,a/2);b.D=new R(1-a/2,1-a/2);D.u(d);return b},LogicImplies:function(a,b,c){var d=a?a.Oc:NaN;isNaN(d)&&(d=.2);a=D.v();T(a,(1-d)*b,0*c,!1);a.lineTo(1*b,.5*c);a.lineTo((1-d)*b,c);a.moveTo(0,.5*c);a.lineTo(b,.5*c);b=a.q;b.C=cc;b.D=new R(.8,.5);D.u(a);return b},LogicIff:function(a,b,c){var d=a?a.Oc:
NaN;isNaN(d)&&(d=.2);a=D.v();T(a,(1-d)*b,0*c,!1);a.lineTo(1*b,.5*c);a.lineTo((1-d)*b,c);a.moveTo(0,.5*c);a.lineTo(b,.5*c);a.moveTo(d*b,0);a.lineTo(0,.5*c);a.lineTo(d*b,c);b=a.q;b.C=new R(.2,0);b.D=new R(.8,.5);D.u(a);return b},LogicNot:function(a,b,c){a=D.v();T(a,0,0,!1);a.lineTo(1*b,0);a.lineTo(1*b,1*c);b=a.q;D.u(a);return b},LogicAnd:function(a,b,c){a=D.v();T(a,0,1*c,!1);a.lineTo(.5*b,0);a.lineTo(1*b,1*c);b=a.q;b.C=new R(.25,.5);b.D=new R(.75,1);D.u(a);return b},LogicOr:function(a,b,c){a=D.v();
T(a,0,0,!1);a.lineTo(.5*b,1*c);a.lineTo(1*b,0);b=a.q;b.C=new R(.219,0);b.D=new R(.78,.409);D.u(a);return b},LogicXor:function(a,b,c){a=D.v();T(a,.5*b,0,!1);a.lineTo(.5*b,1*c);a.moveTo(0,.5*c);a.lineTo(1*b,.5*c);var d=.5*Fd;V(a,1*b,(.5+d)*c,(.5+d)*b,1*c,.5*b,1*c);V(a,(.5-d)*b,1*c,0,(.5+d)*c,0,.5*c);V(a,0,(.5-d)*c,(.5-d)*b,0,.5*b,0);V(a,(.5+d)*b,0,1*b,(.5-d)*c,1*b,.5*c);b=a.q;b.je=Uj;D.u(a);return b},LogicTruth:function(a,b,c){a=D.v();T(a,0,0,!1);a.lineTo(1*b,0);a.moveTo(.5*b,0);a.lineTo(.5*b,1*c);
b=a.q;D.u(a);return b},LogicFalsity:function(a,b,c){a=D.v();T(a,0,1*c,!1);a.lineTo(1*b,1*c);a.moveTo(.5*b,1*c);a.lineTo(.5*b,0);b=a.q;D.u(a);return b},LogicThereExists:function(a,b,c){a=D.v();T(a,0,0,!1);a.lineTo(1*b,0);a.lineTo(1*b,.5*c);a.lineTo(0,.5*c);a.moveTo(1*b,.5*c);a.lineTo(1*b,1*c);a.lineTo(0,1*c);b=a.q;D.u(a);return b},LogicForAll:function(a,b,c){a=D.v();T(a,0,0,!1);a.lineTo(.5*b,1*c);a.lineTo(1*b,0);a.moveTo(.25*b,.5*c);a.lineTo(.75*b,.5*c);b=a.q;b.C=new R(.25,0);b.D=new R(.75,.5);D.u(a);
return b},LogicIsDefinedAs:function(a,b,c){a=D.v();T(a,0,0,!1);a.lineTo(b,0);a.moveTo(0,.5*c);a.lineTo(b,.5*c);a.moveTo(0,c);a.lineTo(b,c);b=a.q;b.C=new R(.01,.01);b.D=new R(.99,.49);D.u(a);return b},LogicIntersect:function(a,b,c){var d=.5*Fd;a=D.v();T(a,0,1*c,!1);a.lineTo(0,.5*c);V(a,0,(.5-d)*c,(.5-d)*b,0,.5*b,0);V(a,(.5+d)*b,0,1*b,(.5-d)*c,1*b,.5*c);a.lineTo(1*b,1*c);b=a.q;b.C=new R(0,.5);b.D=rc;D.u(a);return b},LogicUnion:function(a,b,c){var d=.5*Fd;a=D.v();T(a,1*b,0,!1);a.lineTo(1*b,.5*c);V(a,
1*b,(.5+d)*c,(.5+d)*b,1*c,.5*b,1*c);V(a,(.5-d)*b,1*c,0,(.5+d)*c,0,.5*c);a.lineTo(0,0);b=a.q;b.C=cc;b.D=new R(1,.5);D.u(a);return b},Arrow:function(a,b,c){var d=a?a.Oc:NaN,e=a?a.Qu:NaN;isNaN(d)&&(d=.3);isNaN(e)&&(e=.3);a=D.v();T(a,0,(.5-e/2)*c,!0);a.lineTo((1-d)*b,(.5-e/2)*c);a.lineTo((1-d)*b,0);a.lineTo(1*b,.5*c);a.lineTo((1-d)*b,1*c);a.lineTo((1-d)*b,(.5+e/2)*c);a.lineTo(0,(.5+e/2)*c);X(a);b=a.q;b.C=new R(0,.5-e/2);d=Ue(0,.5+e/2,1,.5+e/2,1-d,1,1,.5,D.P());b.D=new R(d.x,d.y);D.A(d);D.u(a);return b},
ISOProcess:"Chevron",Chevron:function(a,b,c){a=D.v();T(a,0,0,!0);a.lineTo(.5*b,0);a.lineTo(1*b,.5*c);a.lineTo(.5*b,1*c);a.lineTo(0,1*c);a.lineTo(.5*b,.5*c);X(a);b=a.q;D.u(a);return b},DoubleArrow:function(a,b,c){a=D.v();T(a,0,0,!0);a.lineTo(.3*b,.214*c);a.lineTo(.3*b,0);a.lineTo(1*b,.5*c);a.lineTo(.3*b,1*c);a.lineTo(.3*b,.786*c);a.lineTo(0,1*c);X(a);T(a,.3*b,.214*c,!1);a.lineTo(.3*b,.786*c);a.ib(!1);b=a.q;D.u(a);return b},DoubleEndArrow:function(a,b,c){a=D.v();T(a,1*b,.5*c,!0);a.lineTo(.7*b,1*c);
a.lineTo(.7*b,.7*c);a.lineTo(.3*b,.7*c);a.lineTo(.3*b,1*c);a.lineTo(0,.5*c);a.lineTo(.3*b,0);a.lineTo(.3*b,.3*c);a.lineTo(.7*b,.3*c);a.lineTo(.7*b,0);X(a);b=a.q;c=Ue(0,.5,.3,0,0,.3,.3,.3,D.P());b.C=new R(c.x,c.y);c=Ue(.7,1,1,.5,.7,.7,1,.7,c);b.D=new R(c.x,c.y);D.A(c);D.u(a);return b},IBeamArrow:function(a,b,c){a=D.v();T(a,1*b,.5*c,!0);a.lineTo(.7*b,1*c);a.lineTo(.7*b,.7*c);a.lineTo(.2*b,.7*c);a.lineTo(.2*b,1*c);a.lineTo(0,1*c);a.lineTo(0,0);a.lineTo(.2*b,0);a.lineTo(.2*b,.3*c);a.lineTo(.7*b,.3*c);
a.lineTo(.7*b,0);X(a);b=a.q;b.C=new R(0,.3);c=Ue(.7,1,1,.5,.7,.7,1,.7,D.P());b.D=new R(c.x,c.y);D.A(c);D.u(a);return b},Pointer:function(a,b,c){a=D.v();T(a,1*b,.5*c,!0);a.lineTo(0,1*c);a.lineTo(.2*b,.5*c);a.lineTo(0,0);X(a);b=a.q;b.C=new R(.2,.35);c=Ue(.2,.65,1,.65,0,1,1,.5,D.P());b.D=new R(c.x,c.y);D.A(c);D.u(a);return b},RoundedPointer:function(a,b,c){a=D.v();T(a,1*b,.5*c,!0);a.lineTo(0,1*c);V(a,.5*b,.75*c,.5*b,.25*c,0,0);X(a);b=a.q;b.C=new R(.4,.35);c=Ue(.2,.65,1,.65,0,1,1,.5,D.P());b.D=new R(c.x,
c.y);D.A(c);D.u(a);return b},SplitEndArrow:function(a,b,c){a=D.v();T(a,1*b,.5*c,!0);a.lineTo(.7*b,1*c);a.lineTo(.7*b,.7*c);a.lineTo(0,.7*c);a.lineTo(.2*b,.5*c);a.lineTo(0,.3*c);a.lineTo(.7*b,.3*c);a.lineTo(.7*b,0);X(a);b=a.q;b.C=new R(.2,.3);c=Ue(.7,1,1,.5,.7,.7,1,.7,D.P());b.D=new R(c.x,c.y);D.A(c);D.u(a);return b},MessageToUser:"SquareArrow",SquareArrow:function(a,b,c){a=D.v();T(a,1*b,.5*c,!0);a.lineTo(.7*b,1*c);a.lineTo(0,1*c);a.lineTo(0,0);a.lineTo(.7*b,0);X(a);b=a.q;b.C=cc;b.D=new R(.7,1);D.u(a);
return b},Cone1:function(a,b,c){var d=.5*Fd,e=.1*Fd;a=D.v();T(a,0,.9*c,!0);a.lineTo(.5*b,0);a.lineTo(1*b,.9*c);V(a,1*b,(.9+e)*c,(.5+d)*b,1*c,.5*b,1*c);V(a,(.5-d)*b,1*c,0,(.9+e)*c,0,.9*c);X(a);b=a.q;b.C=new R(.25,.5);b.D=new R(.75,.97);D.u(a);return b},Cone2:function(a,b,c){a=D.v();T(a,0,.9*c,!0);V(a,(1-.85/.9)*b,1*c,.85/.9*b,1*c,1*b,.9*c);a.lineTo(.5*b,0);a.lineTo(0,.9*c);X(a);T(a,0,.9*c,!1);V(a,(1-.85/.9)*b,.8*c,.85/.9*b,.8*c,1*b,.9*c);a.ib(!1);b=a.q;b.C=new R(.25,.5);b.D=new R(.75,.82);D.u(a);return b},
Cube1:function(a,b,c){a=D.v();T(a,.5*b,1*c,!0);a.lineTo(1*b,.85*c);a.lineTo(1*b,.15*c);a.lineTo(.5*b,0*c);a.lineTo(0*b,.15*c);a.lineTo(0*b,.85*c);X(a);T(a,.5*b,1*c,!1);a.lineTo(.5*b,.3*c);a.lineTo(0,.15*c);a.moveTo(.5*b,.3*c);a.lineTo(1*b,.15*c);a.ib(!1);b=a.q;b.C=new R(0,.3);b.D=new R(.5,.85);D.u(a);return b},Cube2:function(a,b,c){a=D.v();T(a,0,.3*c,!0);a.lineTo(0*b,1*c);a.lineTo(.7*b,c);a.lineTo(1*b,.7*c);a.lineTo(1*b,0*c);a.lineTo(.3*b,0*c);X(a);T(a,0,.3*c,!1);a.lineTo(.7*b,.3*c);a.lineTo(1*b,
0*c);a.moveTo(.7*b,.3*c);a.lineTo(.7*b,1*c);a.ib(!1);b=a.q;b.C=new R(0,.3);b.D=new R(.7,1);D.u(a);return b},MagneticData:"Cylinder1",Cylinder1:function(a,b,c){var d=.5*Fd,e=.1*Fd;a=D.v();T(a,0,.1*c,!0);V(a,0,(.1-e)*c,(.5-d)*b,0,.5*b,0);V(a,(.5+d)*b,0,1*b,(.1-e)*c,1*b,.1*c);a.lineTo(b,.9*c);V(a,1*b,(.9+e)*c,(.5+d)*b,1*c,.5*b,1*c);V(a,(.5-d)*b,1*c,0,(.9+e)*c,0,.9*c);a.lineTo(0,.1*c);T(a,0,.1*c,!1);V(a,0,(.1+e)*c,(.5-d)*b,.2*c,.5*b,.2*c);V(a,(.5+d)*b,.2*c,1*b,(.1+e)*c,1*b,.1*c);a.ib(!1);b=a.q;b.C=new R(0,
.2);b.D=new R(1,.9);D.u(a);return b},Cylinder2:function(a,b,c){var d=.5*Fd,e=.1*Fd;a=D.v();T(a,0,.9*c,!0);a.lineTo(0,.1*c);V(a,0,(.1-e)*c,(.5-d)*b,0,.5*b,0);V(a,(.5+d)*b,0,1*b,(.1-e)*c,1*b,.1*c);a.lineTo(1*b,.9*c);V(a,1*b,(.9+e)*c,(.5+d)*b,1*c,.5*b,1*c);V(a,(.5-d)*b,1*c,0,(.9+e)*c,0,.9*c);T(a,0,.9*c,!1);V(a,0,(.9-e)*c,(.5-d)*b,.8*c,.5*b,.8*c);V(a,(.5+d)*b,.8*c,1*b,(.9-e)*c,1*b,.9*c);a.ib(!1);b=a.q;b.C=new R(0,.1);b.D=new R(1,.8);D.u(a);return b},Cylinder3:function(a,b,c){var d=.1*Fd,e=.5*Fd;a=D.v();
T(a,.1*b,0,!0);a.lineTo(.9*b,0);V(a,(.9+d)*b,0,1*b,(.5-e)*c,1*b,.5*c);V(a,1*b,(.5+e)*c,(.9+d)*b,1*c,.9*b,1*c);a.lineTo(.1*b,1*c);V(a,(.1-d)*b,1*c,0,(.5+e)*c,0,.5*c);V(a,0,(.5-e)*c,(.1-d)*b,0,.1*b,0);T(a,.1*b,0,!1);V(a,(.1+d)*b,0,.2*b,(.5-e)*c,.2*b,.5*c);V(a,.2*b,(.5+e)*c,(.1+d)*b,1*c,.1*b,1*c);a.ib(!1);b=a.q;b.C=new R(.2,0);b.D=new R(.9,1);D.u(a);return b},DirectData:"Cylinder4",Cylinder4:function(a,b,c){var d=.1*Fd,e=.5*Fd;a=D.v();T(a,.9*b,0,!0);V(a,(.9+d)*b,0,1*b,(.5-e)*c,1*b,.5*c);V(a,1*b,(.5+
e)*c,(.9+d)*b,1*c,.9*b,1*c);a.lineTo(.1*b,1*c);V(a,(.1-d)*b,1*c,0,(.5+e)*c,0,.5*c);V(a,0,(.5-e)*c,(.1-d)*b,0,.1*b,0);a.lineTo(.9*b,0);T(a,.9*b,0,!1);V(a,(.9-d)*b,0,.8*b,(.5-e)*c,.8*b,.5*c);V(a,.8*b,(.5+e)*c,(.9-d)*b,1*c,.9*b,1*c);a.ib(!1);b=a.q;b.C=new R(.1,0);b.D=new R(.8,1);D.u(a);return b},Prism1:function(a,b,c){a=D.v();T(a,.25*b,.25*c,!0);a.lineTo(.75*b,0);a.lineTo(b,.5*c);a.lineTo(.5*b,c);a.lineTo(0,c);X(a);T(a,.25*b,.25*c,!1);a.lineTo(.5*b,c);a.ib(!1);b=a.q;b.C=new R(.408,.172);b.D=new R(.833,
.662);D.u(a);return b},Prism2:function(a,b,c){a=D.v();T(a,0,.25*c,!0);a.lineTo(.75*b,0);a.lineTo(1*b,.25*c);a.lineTo(.75*b,.75*c);a.lineTo(0,1*c);X(a);T(a,0,c,!1);a.lineTo(.25*b,.5*c);a.lineTo(b,.25*c);a.moveTo(0,.25*c);a.lineTo(.25*b,.5*c);a.ib(!1);b=a.q;b.C=new R(.25,.5);b.D=new R(.75,.75);D.u(a);return b},Pyramid1:function(a,b,c){a=D.v();T(a,.5*b,0,!0);a.lineTo(b,.75*c);a.lineTo(.5*b,1*c);a.lineTo(0,.75*c);X(a);T(a,.5*b,0,!1);a.lineTo(.5*b,1*c);a.ib(!1);b=a.q;b.C=new R(.25,.367);b.D=new R(.75,
.875);D.u(a);return b},Pyramid2:function(a,b,c){a=D.v();T(a,.5*b,0,!0);a.lineTo(b,.85*c);a.lineTo(.5*b,1*c);a.lineTo(0,.85*c);X(a);T(a,.5*b,0,!1);a.lineTo(.5*b,.7*c);a.lineTo(0,.85*c);a.moveTo(.5*b,.7*c);a.lineTo(1*b,.85*c);a.ib(!1);b=a.q;b.C=new R(.25,.367);b.D=new R(.75,.875);D.u(a);return b},Actor:function(a,b,c){var d=.2*Fd,e=.1*Fd,g=.5,h=.1;a=D.v();T(a,g*b,(h+.1)*c,!0);V(a,(g-d)*b,(h+.1)*c,(g-.2)*b,(h+e)*c,(g-.2)*b,h*c);V(a,(g-.2)*b,(h-e)*c,(g-d)*b,(h-.1)*c,g*b,(h-.1)*c);V(a,(g+d)*b,(h-.1)*c,
(g+.2)*b,(h-e)*c,(g+.2)*b,h*c);V(a,(g+.2)*b,(h+e)*c,(g+d)*b,(h+.1)*c,g*b,(h+.1)*c);d=.05;e=Fd*d;T(a,.5*b,.2*c,!0);a.lineTo(.95*b,.2*c);g=.95;h=.25;V(a,(g+e)*b,(h-d)*c,(g+d)*b,(h-e)*c,(g+d)*b,h*c);a.lineTo(1*b,.6*c);a.lineTo(.85*b,.6*c);a.lineTo(.85*b,.35*c);d=.025;e=Fd*d;g=.825;h=.35;V(a,(g+d)*b,(h-e)*c,(g+e)*b,(h-d)*c,g*b,(h-d)*c);V(a,(g-e)*b,(h-d)*c,(g-d)*b,(h-e)*c,(g-d)*b,h*c);a.lineTo(.8*b,1*c);a.lineTo(.55*b,1*c);a.lineTo(.55*b,.7*c);d=.05;e=Fd*d;g=.5;h=.7;V(a,(g+d)*b,(h-e)*c,(g+e)*b,(h-d)*c,
g*b,(h-d)*c);V(a,(g-e)*b,(h-d)*c,(g-d)*b,(h-e)*c,(g-d)*b,h*c);a.lineTo(.45*b,1*c);a.lineTo(.2*b,1*c);a.lineTo(.2*b,.35*c);d=.025;e=Fd*d;g=.175;h=.35;V(a,(g+d)*b,(h-e)*c,(g+e)*b,(h-d)*c,g*b,(h-d)*c);V(a,(g-e)*b,(h-d)*c,(g-d)*b,(h-e)*c,(g-d)*b,h*c);a.lineTo(.15*b,.6*c);a.lineTo(0*b,.6*c);a.lineTo(0*b,.25*c);d=.05;e=Fd*d;g=.05;h=.25;V(a,(g-d)*b,(h-e)*c,(g-e)*b,(h-d)*c,g*b,(h-d)*c);a.lineTo(.5*b,.2*c);b=a.q;b.C=new R(.2,.2);b.D=new R(.8,.65);D.u(a);return b},Card:function(a,b,c){a=D.v();T(a,1*b,0*c,!0);
a.lineTo(1*b,1*c);a.lineTo(0*b,1*c);a.lineTo(0*b,.2*c);a.lineTo(.2*b,0*c);X(a);b=a.q;b.C=new R(0,.2);b.D=rc;D.u(a);return b},Collate:function(a,b,c){a=D.v();T(a,.5*b,.5*c,!0);a.lineTo(0,0);a.lineTo(1*b,0);a.lineTo(.5*b,.5*c);T(a,.5*b,.5*c,!0);a.lineTo(1*b,1*c);a.lineTo(0,1*c);a.lineTo(.5*b,.5*c);b=a.q;b.C=new R(.25,0);b.D=new R(.75,.25);D.u(a);return b},CreateRequest:function(a,b,c){a=a?a.Oc:NaN;isNaN(a)&&(a=.1);var d=D.v();T(d,0,0,!0);d.lineTo(1*b,0);d.lineTo(1*b,1*c);d.lineTo(0,1*c);X(d);T(d,0,
a*c,!1);d.lineTo(1*b,a*c);d.moveTo(0,(1-a)*c);d.lineTo(1*b,(1-a)*c);d.ib(!1);b=d.q;b.C=new R(0,a);b.D=new R(1,1-a);D.u(d);return b},Database:function(a,b,c){a=D.v();var d=.5*Fd,e=.1*Fd;T(a,1*b,.1*c,!0);a.lineTo(1*b,.9*c);V(a,1*b,(.9+e)*c,(.5+d)*b,1*c,.5*b,1*c);V(a,(.5-d)*b,1*c,0,(.9+e)*c,0,.9*c);a.lineTo(0,.1*c);V(a,0,(.1-e)*c,(.5-d)*b,0,.5*b,0);V(a,(.5+d)*b,0,1*b,(.1-e)*c,1*b,.1*c);T(a,1*b,.1*c,!1);V(a,1*b,(.1+e)*c,(.5+d)*b,.2*c,.5*b,.2*c);V(a,(.5-d)*b,.2*c,0,(.1+e)*c,0,.1*c);a.moveTo(1*b,.2*c);
V(a,1*b,(.2+e)*c,(.5+d)*b,.3*c,.5*b,.3*c);V(a,(.5-d)*b,.3*c,0,(.2+e)*c,0,.2*c);a.moveTo(1*b,.3*c);V(a,1*b,(.3+e)*c,(.5+d)*b,.4*c,.5*b,.4*c);V(a,(.5-d)*b,.4*c,0,(.3+e)*c,0,.3*c);a.ib(!1);b=a.q;b.C=new R(0,.4);b.D=new R(1,.9);D.u(a);return b},StoredData:"DataStorage",DataStorage:function(a,b,c){a=D.v();T(a,0,0,!0);a.lineTo(.75*b,0);V(a,1*b,0,1*b,1*c,.75*b,1*c);a.lineTo(0,1*c);V(a,.25*b,.9*c,.25*b,.1*c,0,0);X(a);b=a.q;b.C=new R(.226,0);b.D=new R(.81,1);D.u(a);return b},DiskStorage:function(a,b,c){a=
D.v();var d=.5*Fd,e=.1*Fd;T(a,1*b,.1*c,!0);a.lineTo(1*b,.9*c);V(a,1*b,(.9+e)*c,(.5+d)*b,1*c,.5*b,1*c);V(a,(.5-d)*b,1*c,0,(.9+e)*c,0,.9*c);a.lineTo(0,.1*c);V(a,0,(.1-e)*c,(.5-d)*b,0,.5*b,0);V(a,(.5+d)*b,0,1*b,(.1-e)*c,1*b,.1*c);T(a,1*b,.1*c,!1);V(a,1*b,(.1+e)*c,(.5+d)*b,.2*c,.5*b,.2*c);V(a,(.5-d)*b,.2*c,0,(.1+e)*c,0,.1*c);a.moveTo(1*b,.2*c);V(a,1*b,(.2+e)*c,(.5+d)*b,.3*c,.5*b,.3*c);V(a,(.5-d)*b,.3*c,0,(.2+e)*c,0,.2*c);a.ib(!1);b=a.q;b.C=new R(0,.3);b.D=new R(1,.9);D.u(a);return b},Display:function(a,
b,c){a=D.v();T(a,.25*b,0,!0);a.lineTo(.75*b,0);V(a,1*b,0,1*b,1*c,.75*b,1*c);a.lineTo(.25*b,1*c);a.lineTo(0,.5*c);X(a);b=a.q;b.C=new R(.25,0);b.D=new R(.75,1);D.u(a);return b},DividedEvent:function(a,b,c){a=a?a.Oc:NaN;isNaN(a)?a=.2:.15>a&&(a=.15);var d=D.v(),e=.2*Fd;T(d,0,.2*c,!0);V(d,0,(.2-e)*c,(.2-e)*b,0,.2*b,0);d.lineTo(.8*b,0);V(d,(.8+e)*b,0,1*b,(.2-e)*c,1*b,.2*c);d.lineTo(1*b,.8*c);V(d,1*b,(.8+e)*c,(.8+e)*b,1*c,.8*b,1*c);d.lineTo(.2*b,1*c);V(d,(.2-e)*b,1*c,0,(.8+e)*c,0,.8*c);d.lineTo(0,.2*c);
T(d,0,a*c,!1);d.lineTo(1*b,a*c);d.ib(!1);b=d.q;b.C=new R(0,a);b.D=new R(1,1-a);D.u(d);return b},DividedProcess:function(a,b,c){a=a?a.Oc:NaN;if(isNaN(a)||.1>a)a=.1;var d=D.v();T(d,0,0,!0);d.lineTo(1*b,0);d.lineTo(1*b,1*c);d.lineTo(0,1*c);X(d);T(d,0,a*c,!1);d.lineTo(1*b,a*c);d.ib(!1);b=d.q;b.C=new R(0,a);b.D=rc;D.u(d);return b},Document:function(a,b,c){c/=.8;a=D.v();T(a,0,.7*c,!0);a.lineTo(0,0);a.lineTo(1*b,0);a.lineTo(1*b,.7*c);V(a,.5*b,.4*c,.5*b,1*c,0,.7*c);X(a);b=a.q;b.C=cc;b.D=new R(1,.6);D.u(a);
return b},ExternalOrganization:function(a,b,c){a=a?a.Oc:NaN;if(isNaN(a)||.2>a)a=.2;var d=D.v();T(d,0,0,!0);d.lineTo(1*b,0);d.lineTo(1*b,1*c);d.lineTo(0,1*c);X(d);T(d,a*b,0,!1);d.lineTo(0,a*c);d.moveTo(1*b,a*c);d.lineTo((1-a)*b,0);d.moveTo(0,(1-a)*c);d.lineTo(a*b,1*c);d.moveTo((1-a)*b,1*c);d.lineTo(1*b,(1-a)*c);d.ib(!1);b=d.q;b.C=new R(a/2,a/2);b.D=new R(1-a/2,1-a/2);D.u(d);return b},ExternalProcess:function(a,b,c){a=D.v();T(a,.5*b,0,!0);a.lineTo(1*b,.5*c);a.lineTo(.5*b,1*c);a.lineTo(0,.5*c);X(a);
T(a,.1*b,.4*c,!1);a.lineTo(.1*b,.6*c);a.moveTo(.9*b,.6*c);a.lineTo(.9*b,.4*c);a.moveTo(.6*b,.1*c);a.lineTo(.4*b,.1*c);a.moveTo(.4*b,.9*c);a.lineTo(.6*b,.9*c);a.ib(!1);b=a.q;b.C=new R(.25,.25);b.D=new R(.75,.75);D.u(a);return b},File:function(a,b,c){a=D.v();T(a,0,0,!0);a.lineTo(.75*b,0);a.lineTo(1*b,.25*c);a.lineTo(1*b,1*c);a.lineTo(0,1*c);X(a);T(a,.75*b,0,!1);a.lineTo(.75*b,.25*c);a.lineTo(1*b,.25*c);a.ib(!1);b=a.q;b.C=new R(0,.25);b.D=rc;D.u(a);return b},Interrupt:function(a,b,c){a=D.v();T(a,1*b,
.5*c,!0);a.lineTo(0,1*c);a.lineTo(0,0);a.lineTo(1*b,.5*c);T(a,1*b,.5*c,!1);a.lineTo(1*b,1*c);T(a,1*b,.5*c,!1);a.lineTo(1*b,0);b=a.q;b.C=new R(0,.25);b.D=new R(.5,.75);D.u(a);return b},InternalStorage:function(a,b,c){var d=a?a.Oc:NaN;a=a?a.Qu:NaN;isNaN(d)&&(d=.1);isNaN(a)&&(a=.1);var e=D.v();T(e,0,0,!0);e.lineTo(1*b,0);e.lineTo(1*b,1*c);e.lineTo(0,1*c);X(e);T(e,d*b,0,!1);e.lineTo(d*b,1*c);e.moveTo(0,a*c);e.lineTo(1*b,a*c);e.ib(!1);b=e.q;b.C=new R(d,a);b.D=rc;D.u(e);return b},Junction:function(a,b,
c){a=D.v();var d=1/Math.SQRT2,e=(1-1/Math.SQRT2)/2,g=.5*Fd;T(a,1*b,.5*c,!0);V(a,1*b,(.5+g)*c,(.5+g)*b,1*c,.5*b,1*c);V(a,(.5-g)*b,1*c,0,(.5+g)*c,0,.5*c);V(a,0,(.5-g)*c,(.5-g)*b,0,.5*b,0);V(a,(.5+g)*b,0,1*b,(.5-g)*c,1*b,.5*c);T(a,(e+d)*b,(e+d)*c,!1);a.lineTo(e*b,e*c);a.moveTo(e*b,(e+d)*c);a.lineTo((e+d)*b,e*c);a.ib(!1);b=a.q;b.je=Uj;D.u(a);return b},LinedDocument:function(a,b,c){c/=.8;a=D.v();T(a,0,.7*c,!0);a.lineTo(0,0);a.lineTo(1*b,0);a.lineTo(1*b,.7*c);V(a,.5*b,.4*c,.5*b,1*c,0,.7*c);X(a);T(a,.1*
b,0,!1);a.lineTo(.1*b,.75*c);a.ib(!1);b=a.q;b.C=new R(.1,0);b.D=new R(1,.6);D.u(a);return b},LoopLimit:function(a,b,c){a=D.v();T(a,0,1*c,!0);a.lineTo(0,.25*c);a.lineTo(.25*b,0);a.lineTo(.75*b,0);a.lineTo(1*b,.25*c);a.lineTo(1*b,1*c);X(a);b=a.q;b.C=new R(0,.25);b.D=rc;D.u(a);return b},SequentialData:"MagneticTape",MagneticTape:function(a,b,c){a=D.v();var d=.5*Fd;T(a,.5*b,1*c,!0);V(a,(.5-d)*b,1*c,0,(.5+d)*c,0,.5*c);V(a,0,(.5-d)*c,(.5-d)*b,0,.5*b,0);V(a,(.5+d)*b,0,1*b,(.5-d)*c,1*b,.5*c);V(a,1*b,(.5+
d)*c,(.5+d)*b,.9*c,.6*b,.9*c);a.lineTo(1*b,.9*c);a.lineTo(1*b,1*c);a.lineTo(.5*b,1*c);b=a.q;b.C=new R(.15,.15);b.D=new R(.85,.8);D.u(a);return b},ManualInput:function(a,b,c){a=D.v();T(a,1*b,0,!0);a.lineTo(1*b,1*c);a.lineTo(0,1*c);a.lineTo(0,.25*c);X(a);b=a.q;b.C=new R(0,.25);b.D=rc;D.u(a);return b},MessageFromUser:function(a,b,c){a=a?a.Oc:NaN;isNaN(a)&&(a=.7);var d=D.v();T(d,0,0,!0);d.lineTo(1*b,0);d.lineTo(a*b,.5*c);d.lineTo(1*b,1*c);d.lineTo(0,1*c);X(d);b=d.q;b.C=cc;b.D=new R(a,1);D.u(d);return b},
MicroformProcessing:function(a,b,c){a=a?a.Oc:NaN;isNaN(a)&&(a=.25);var d=D.v();T(d,0,0,!0);d.lineTo(.5*b,a*c);d.lineTo(1*b,0);d.lineTo(1*b,1*c);d.lineTo(.5*b,(1-a)*c);d.lineTo(0,1*c);X(d);b=d.q;b.C=new R(0,a);b.D=new R(1,1-a);D.u(d);return b},MicroformRecording:function(a,b,c){a=D.v();T(a,0,0,!0);a.lineTo(.75*b,.25*c);a.lineTo(1*b,.15*c);a.lineTo(1*b,.85*c);a.lineTo(.75*b,.75*c);a.lineTo(0,1*c);X(a);b=a.q;b.C=new R(0,.25);b.D=new R(1,.75);D.u(a);return b},MultiDocument:function(a,b,c){c/=.8;a=D.v();
T(a,b,0,!0);a.lineTo(b,.5*c);V(a,.96*b,.47*c,.93*b,.45*c,.9*b,.44*c);a.lineTo(.9*b,.6*c);V(a,.86*b,.57*c,.83*b,.55*c,.8*b,.54*c);a.lineTo(.8*b,.7*c);V(a,.4*b,.4*c,.4*b,1*c,0,.7*c);a.lineTo(0,.2*c);a.lineTo(.1*b,.2*c);a.lineTo(.1*b,.1*c);a.lineTo(.2*b,.1*c);a.lineTo(.2*b,0);X(a);T(a,.1*b,.2*c,!1);a.lineTo(.8*b,.2*c);a.lineTo(.8*b,.54*c);a.moveTo(.2*b,.1*c);a.lineTo(.9*b,.1*c);a.lineTo(.9*b,.44*c);a.ib(!1);b=a.q;b.C=new R(0,.25);b.D=new R(.8,.77);D.u(a);return b},MultiProcess:function(a,b,c){a=D.v();
T(a,.1*b,.1*c,!0);a.lineTo(.2*b,.1*c);a.lineTo(.2*b,0);a.lineTo(1*b,0);a.lineTo(1*b,.8*c);a.lineTo(.9*b,.8*c);a.lineTo(.9*b,.9*c);a.lineTo(.8*b,.9*c);a.lineTo(.8*b,1*c);a.lineTo(0,1*c);a.lineTo(0,.2*c);a.lineTo(.1*b,.2*c);X(a);T(a,.2*b,.1*c,!1);a.lineTo(.9*b,.1*c);a.lineTo(.9*b,.8*c);a.moveTo(.1*b,.2*c);a.lineTo(.8*b,.2*c);a.lineTo(.8*b,.9*c);a.ib(!1);b=a.q;b.C=new R(0,.2);b.D=new R(.8,1);D.u(a);return b},OfflineStorage:function(a,b,c){a=a?a.Oc:NaN;isNaN(a)&&(a=.1);var d=1-a,e=D.v();T(e,0,0,!0);e.lineTo(1*
b,0);e.lineTo(.5*b,1*c);X(e);T(e,.5*a*b,a*c,!1);e.lineTo((1-.5*a)*b,a*c);e.ib(!1);b=e.q;b.C=new R(d/4+.5*a,a);b.D=new R(3*d/4+.5*a,a+.5*d);D.u(e);return b},OffPageConnector:function(a,b,c){a=D.v();T(a,0,0,!0);a.lineTo(.75*b,0);a.lineTo(1*b,.5*c);a.lineTo(.75*b,1*c);a.lineTo(0,1*c);X(a);b=a.q;b.C=cc;b.D=new R(.75,1);D.u(a);return b},Or:function(a,b,c){a=D.v();var d=.5*Fd;T(a,1*b,.5*c,!0);V(a,1*b,(.5+d)*c,(.5+d)*b,1*c,.5*b,1*c);V(a,(.5-d)*b,1*c,0,(.5+d)*c,0,.5*c);V(a,0,(.5-d)*c,(.5-d)*b,0,.5*b,0);V(a,
(.5+d)*b,0,1*b,(.5-d)*c,1*b,.5*c);T(a,1*b,.5*c,!1);a.lineTo(0,.5*c);a.moveTo(.5*b,1*c);a.lineTo(.5*b,0);a.ib(!1);b=a.q;b.je=Uj;D.u(a);return b},PaperTape:function(a,b,c){c/=.8;a=D.v();T(a,0,.7*c,!0);a.lineTo(0,.3*c);V(a,.5*b,.6*c,.5*b,0,1*b,.3*c);a.lineTo(1*b,.7*c);V(a,.5*b,.4*c,.5*b,1*c,0,.7*c);X(a);b=a.q;b.C=new R(0,.49);b.D=new R(1,.75);D.u(a);return b},PrimitiveFromCall:function(a,b,c){var d=a?a.Oc:NaN;a=a?a.Qu:NaN;isNaN(d)&&(d=.1);isNaN(a)&&(a=.3);var e=D.v();T(e,0,0,!0);e.lineTo(1*b,0);e.lineTo((1-
a)*b,.5*c);e.lineTo(1*b,1*c);e.lineTo(0,1*c);X(e);b=e.q;b.C=new R(d,0);b.D=new R(1-a,1);D.u(e);return b},PrimitiveToCall:function(a,b,c){var d=a?a.Oc:NaN;a=a?a.Qu:NaN;isNaN(d)&&(d=.1);isNaN(a)&&(a=.3);var e=D.v();T(e,0,0,!0);e.lineTo((1-a)*b,0);e.lineTo(1*b,.5*c);e.lineTo((1-a)*b,1*c);e.lineTo(0,1*c);X(e);b=e.q;b.C=new R(d,0);b.D=new R(1-a,1);D.u(e);return b},Subroutine:"Procedure",Procedure:function(a,b,c){a=a?a.Oc:NaN;isNaN(a)&&(a=.1);var d=D.v();T(d,0,0,!0);d.lineTo(1*b,0);d.lineTo(1*b,1*c);d.lineTo(0,
1*c);X(d);T(d,(1-a)*b,0,!1);d.lineTo((1-a)*b,1*c);d.moveTo(a*b,0);d.lineTo(a*b,1*c);d.ib(!1);b=d.q;b.C=new R(a,0);b.D=new R(1-a,1);D.u(d);return b},Process:function(a,b,c){a=a?a.Oc:NaN;isNaN(a)&&(a=.1);var d=D.v();T(d,0,0,!0);d.lineTo(1*b,0);d.lineTo(1*b,1*c);d.lineTo(0,1*c);X(d);T(d,a*b,0,!1);d.lineTo(a*b,1*c);d.ib(!1);b=d.q;b.C=new R(a,0);b.D=rc;D.u(d);return b},Sort:function(a,b,c){a=D.v();T(a,.5*b,0,!0);a.lineTo(1*b,.5*c);a.lineTo(.5*b,1*c);a.lineTo(0,.5*c);X(a);T(a,0,.5*c,!1);a.lineTo(1*b,.5*
c);a.ib(!1);b=a.q;b.C=new R(.25,.25);b.D=new R(.75,.5);D.u(a);return b},Start:function(a,b,c){a=D.v();T(a,.25*b,0,!0);T(a,.25*b,0,!0);a.arcTo(270,180,.75*b,.5*c,.25*b,.5*c);a.arcTo(90,180,.25*b,.5*c,.25*b,.5*c);T(a,.25*b,0,!1);a.lineTo(.25*b,1*c);a.moveTo(.75*b,0);a.lineTo(.75*b,1*c);a.ib(!1);b=a.q;b.C=new R(.25,0);b.D=new R(.75,1);D.u(a);return b},Terminator:function(a,b,c){a=D.v();T(a,.25*b,0,!0);a.arcTo(270,180,.75*b,.5*c,.25*b,.5*c);a.arcTo(90,180,.25*b,.5*c,.25*b,.5*c);b=a.q;b.C=new R(.23,0);
b.D=new R(.77,1);D.u(a);return b},TransmittalTape:function(a,b,c){a=a?a.Oc:NaN;isNaN(a)&&(a=.1);var d=D.v();T(d,0,0,!0);d.lineTo(1*b,0);d.lineTo(1*b,1*c);d.lineTo(.75*b,(1-a)*c);d.lineTo(0,(1-a)*c);X(d);b=d.q;b.C=cc;b.D=new R(1,1-a);D.u(d);return b},AndGate:function(a,b,c){a=D.v();var d=.5*Fd;T(a,0,0,!0);a.lineTo(.5*b,0);V(a,(.5+d)*b,0,1*b,(.5-d)*c,1*b,.5*c);V(a,1*b,(.5+d)*c,(.5+d)*b,1*c,.5*b,1*c);a.lineTo(0,1*c);X(a);b=a.q;b.C=cc;b.D=new R(.55,1);D.u(a);return b},Buffer:function(a,b,c){a=D.v();T(a,
0,0,!0);a.lineTo(1*b,.5*c);a.lineTo(0,1*c);X(a);b=a.q;b.C=new R(0,.25);b.D=new R(.5,.75);D.u(a);return b},Clock:function(a,b,c){a=D.v();var d=.5*Fd;T(a,1*b,.5*c,!0);V(a,1*b,(.5+d)*c,(.5+d)*b,1*c,.5*b,1*c);V(a,(.5-d)*b,1*c,0,(.5+d)*c,0,.5*c);V(a,0,(.5-d)*c,(.5-d)*b,0,.5*b,0);V(a,(.5+d)*b,0,1*b,(.5-d)*c,1*b,.5*c);T(a,1*b,.5*c,!1);a.lineTo(1*b,.5*c);T(a,.8*b,.75*c,!1);a.lineTo(.8*b,.25*c);a.lineTo(.6*b,.25*c);a.lineTo(.6*b,.75*c);a.lineTo(.4*b,.75*c);a.lineTo(.4*b,.25*c);a.lineTo(.2*b,.25*c);a.lineTo(.2*
b,.75*c);a.ib(!1);b=a.q;b.je=Uj;D.u(a);return b},Ground:function(a,b,c){a=D.v();T(a,.5*b,0,!1);a.lineTo(.5*b,.4*c);a.moveTo(.2*b,.6*c);a.lineTo(.8*b,.6*c);a.moveTo(.3*b,.8*c);a.lineTo(.7*b,.8*c);a.moveTo(.4*b,1*c);a.lineTo(.6*b,1*c);b=a.q;D.u(a);return b},Inverter:function(a,b,c){a=D.v();var d=.1*Fd;T(a,.8*b,.5*c,!0);a.lineTo(0,1*c);a.lineTo(0,0);a.lineTo(.8*b,.5*c);T(a,1*b,.5*c,!0);V(a,1*b,(.5+d)*c,(.9+d)*b,.6*c,.9*b,.6*c);V(a,(.9-d)*b,.6*c,.8*b,(.5+d)*c,.8*b,.5*c);V(a,.8*b,(.5-d)*c,(.9-d)*b,.4*
c,.9*b,.4*c);V(a,(.9+d)*b,.4*c,1*b,(.5-d)*c,1*b,.5*c);b=a.q;b.C=new R(0,.25);b.D=new R(.4,.75);D.u(a);return b},NandGate:function(a,b,c){a=D.v();var d=.5*Fd,e=.4*Fd,g=.1*Fd;T(a,.8*b,.5*c,!0);V(a,.8*b,(.5+e)*c,(.4+d)*b,1*c,.4*b,1*c);a.lineTo(0,1*c);a.lineTo(0,0);a.lineTo(.4*b,0);V(a,(.4+d)*b,0,.8*b,(.5-e)*c,.8*b,.5*c);T(a,1*b,.5*c,!0);V(a,1*b,(.5+g)*c,(.9+g)*b,.6*c,.9*b,.6*c);V(a,(.9-g)*b,.6*c,.8*b,(.5+g)*c,.8*b,.5*c);V(a,.8*b,(.5-g)*c,(.9-g)*b,.4*c,.9*b,.4*c);V(a,(.9+g)*b,.4*c,1*b,(.5-g)*c,1*b,.5*
c);b=a.q;b.C=new R(0,.05);b.D=new R(.55,.95);D.u(a);return b},NorGate:function(a,b,c){a=D.v();var d=.5,e=Fd*d,g=0,h=.5;T(a,.8*b,.5*c,!0);V(a,.7*b,(h+e)*c,(g+e)*b,(h+d)*c,0,1*c);V(a,.25*b,.75*c,.25*b,.25*c,0,0);V(a,(g+e)*b,(h-d)*c,.7*b,(h-e)*c,.8*b,.5*c);d=.1;e=.1*Fd;g=.9;h=.5;T(a,(g-d)*b,h*c,!0);V(a,(g-d)*b,(h-e)*c,(g-e)*b,(h-d)*c,g*b,(h-d)*c);V(a,(g+e)*b,(h-d)*c,(g+d)*b,(h-e)*c,(g+d)*b,h*c);V(a,(g+d)*b,(h+e)*c,(g+e)*b,(h+d)*c,g*b,(h+d)*c);V(a,(g-e)*b,(h+d)*c,(g-d)*b,(h+e)*c,(g-d)*b,h*c);b=a.q;b.C=
new R(.2,.25);b.D=new R(.6,.75);D.u(a);return b},OrGate:function(a,b,c){a=D.v();var d=.5*Fd;T(a,0,0,!0);V(a,(0+d+d)*b,0*c,.8*b,(.5-d)*c,1*b,.5*c);V(a,.8*b,(.5+d)*c,(0+d+d)*b,1*c,0,1*c);V(a,.25*b,.75*c,.25*b,.25*c,0,0);X(a);b=a.q;b.C=new R(.2,.25);b.D=new R(.75,.75);D.u(a);return b},XnorGate:function(a,b,c){a=D.v();var d=.5,e=Fd*d,g=.2,h=.5;T(a,.1*b,0,!1);V(a,.35*b,.25*c,.35*b,.75*c,.1*b,1*c);T(a,.8*b,.5*c,!0);V(a,.7*b,(h+e)*c,(g+e)*b,(h+d)*c,.2*b,1*c);V(a,.45*b,.75*c,.45*b,.25*c,.2*b,0);V(a,(g+e)*
b,(h-d)*c,.7*b,(h-e)*c,.8*b,.5*c);d=.1;e=.1*Fd;g=.9;h=.5;T(a,(g-d)*b,h*c,!0);V(a,(g-d)*b,(h-e)*c,(g-e)*b,(h-d)*c,g*b,(h-d)*c);V(a,(g+e)*b,(h-d)*c,(g+d)*b,(h-e)*c,(g+d)*b,h*c);V(a,(g+d)*b,(h+e)*c,(g+e)*b,(h+d)*c,g*b,(h+d)*c);V(a,(g-e)*b,(h+d)*c,(g-d)*b,(h+e)*c,(g-d)*b,h*c);b=a.q;b.C=new R(.4,.25);b.D=new R(.65,.75);D.u(a);return b},XorGate:function(a,b,c){a=D.v();var d=.5*Fd;T(a,.1*b,0,!1);V(a,.35*b,.25*c,.35*b,.75*c,.1*b,1*c);T(a,.2*b,0,!0);V(a,(.2+d)*b,0*c,.9*b,(.5-d)*c,1*b,.5*c);V(a,.9*b,(.5+d)*
c,(.2+d)*b,1*c,.2*b,1*c);V(a,.45*b,.75*c,.45*b,.25*c,.2*b,0);X(a);b=a.q;b.C=new R(.4,.25);b.D=new R(.8,.75);D.u(a);return b},Capacitor:function(a,b,c){a=D.v();T(a,0,0,!1);a.lineTo(0,1*c);a.moveTo(1*b,0);a.lineTo(1*b,1*c);b=a.q;D.u(a);return b},Resistor:function(a,b,c){a=D.v();T(a,0,.5*c,!1);a.lineTo(.1*b,0);a.lineTo(.2*b,1*c);a.lineTo(.3*b,0);a.lineTo(.4*b,1*c);a.lineTo(.5*b,0);a.lineTo(.6*b,1*c);a.lineTo(.7*b,.5*c);b=a.q;D.u(a);return b},Inductor:function(a,b,c){a=D.v();var d=.1*Fd,e=.1;T(a,(e-.5*
d)*b,c,!1);V(a,(e-d)*b,c,(e-.1)*b,0,(e+.1)*b,0);e=.3;V(a,(e+.1)*b,0,(e+d)*b,c,e*b,c);V(a,(e-d)*b,c,(e-.1)*b,0,(e+.1)*b,0);e=.5;V(a,(e+.1)*b,0,(e+d)*b,c,e*b,c);V(a,(e-d)*b,c,(e-.1)*b,0,(e+.1)*b,0);e=.7;V(a,(e+.1)*b,0,(e+d)*b,c,e*b,c);V(a,(e-d)*b,c,(e-.1)*b,0,(e+.1)*b,0);e=.9;V(a,(e+.1)*b,0,(e+d)*b,c,(e+.5*d)*b,c);b=a.q;D.u(a);return b},ACvoltageSource:function(a,b,c){a=D.v();var d=.5*Fd;T(a,0*b,.5*c,!1);V(a,0*b,(.5-d)*c,(.5-d)*b,0*c,.5*b,0*c);V(a,(.5+d)*b,0*c,1*b,(.5-d)*c,1*b,.5*c);V(a,1*b,(.5+d)*
c,(.5+d)*b,1*c,.5*b,1*c);V(a,(.5-d)*b,1*c,0*b,(.5+d)*c,0*b,.5*c);a.moveTo(.1*b,.5*c);V(a,.5*b,0*c,.5*b,1*c,.9*b,.5*c);b=a.q;b.je=Uj;D.u(a);return b},DCvoltageSource:function(a,b,c){a=D.v();T(a,0,.75*c,!1);a.lineTo(0,.25*c);a.moveTo(1*b,0);a.lineTo(1*b,1*c);b=a.q;D.u(a);return b},Diode:function(a,b,c){a=D.v();T(a,1*b,0,!1);a.lineTo(1*b,.5*c);a.lineTo(0,1*c);a.lineTo(0,0);a.lineTo(1*b,.5*c);a.lineTo(1*b,1*c);b=a.q;b.C=new R(0,.25);b.D=new R(.5,.75);D.u(a);return b},Wifi:function(a,b,c){var d=b,e=c;
b*=.38;c*=.6;a=D.v();var g=.8*Fd,h=.8,k=0,l=.5,d=(d-b)/2,e=(e-c)/2;T(a,k*b+d,(l+h)*c+e,!0);V(a,(k-g)*b+d,(l+h)*c+e,(k-h)*b+d,(l+g)*c+e,(k-h)*b+d,l*c+e);V(a,(k-h)*b+d,(l-g)*c+e,(k-g)*b+d,(l-h)*c+e,k*b+d,(l-h)*c+e);V(a,k*b+d,(l-h)*c+e,(k-h+.5*g)*b+d,(l-g)*c+e,(k-h+.5*g)*b+d,l*c+e);V(a,(k-h+.5*g)*b+d,(l+g)*c+e,k*b+d,(l+h)*c+e,k*b+d,(l+h)*c+e);X(a);g=.4*Fd;h=.4;k=.2;l=.5;T(a,k*b+d,(l+h)*c+e,!0);V(a,(k-g)*b+d,(l+h)*c+e,(k-h)*b+d,(l+g)*c+e,(k-h)*b+d,l*c+e);V(a,(k-h)*b+d,(l-g)*c+e,(k-g)*b+d,(l-h)*c+e,k*
b+d,(l-h)*c+e);V(a,k*b+d,(l-h)*c+e,(k-h+.5*g)*b+d,(l-g)*c+e,(k-h+.5*g)*b+d,l*c+e);V(a,(k-h+.5*g)*b+d,(l+g)*c+e,k*b+d,(l+h)*c+e,k*b+d,(l+h)*c+e);X(a);g=.2*Fd;h=.2;l=k=.5;T(a,(k-h)*b+d,l*c+e,!0);V(a,(k-h)*b+d,(l-g)*c+e,(k-g)*b+d,(l-h)*c+e,k*b+d,(l-h)*c+e);V(a,(k+g)*b+d,(l-h)*c+e,(k+h)*b+d,(l-g)*c+e,(k+h)*b+d,l*c+e);V(a,(k+h)*b+d,(l+g)*c+e,(k+g)*b+d,(l+h)*c+e,k*b+d,(l+h)*c+e);V(a,(k-g)*b+d,(l+h)*c+e,(k-h)*b+d,(l+g)*c+e,(k-h)*b+d,l*c+e);g=.4*Fd;h=.4;k=.8;l=.5;T(a,k*b+d,(l-h)*c+e,!0);V(a,(k+g)*b+d,(l-
h)*c+e,(k+h)*b+d,(l-g)*c+e,(k+h)*b+d,l*c+e);V(a,(k+h)*b+d,(l+g)*c+e,(k+g)*b+d,(l+h)*c+e,k*b+d,(l+h)*c+e);V(a,k*b+d,(l+h)*c+e,(k+h-.5*g)*b+d,(l+g)*c+e,(k+h-.5*g)*b+d,l*c+e);V(a,(k+h-.5*g)*b+d,(l-g)*c+e,k*b+d,(l-h)*c+e,k*b+d,(l-h)*c+e);X(a);g=.8*Fd;h=.8;k=1;l=.5;T(a,k*b+d,(l-h)*c+e,!0);V(a,(k+g)*b+d,(l-h)*c+e,(k+h)*b+d,(l-g)*c+e,(k+h)*b+d,l*c+e);V(a,(k+h)*b+d,(l+g)*c+e,(k+g)*b+d,(l+h)*c+e,k*b+d,(l+h)*c+e);V(a,k*b+d,(l+h)*c+e,(k+h-.5*g)*b+d,(l+g)*c+e,(k+h-.5*g)*b+d,l*c+e);V(a,(k+h-.5*g)*b+d,(l-g)*c+
e,k*b+d,(l-h)*c+e,k*b+d,(l-h)*c+e);X(a);b=a.q;D.u(a);return b},Email:function(a,b,c){a=D.v();T(a,0,0,!0);a.lineTo(1*b,0);a.lineTo(1*b,1*c);a.lineTo(0,1*c);a.lineTo(0,0);X(a);T(a,0,0,!1);a.lineTo(.5*b,.6*c);a.lineTo(1*b,0);a.moveTo(0,1*c);a.lineTo(.45*b,.54*c);a.moveTo(1*b,1*c);a.lineTo(.55*b,.54*c);a.ib(!1);b=a.q;D.u(a);return b},Ethernet:function(a,b,c){a=D.v();T(a,.35*b,0,!0);a.lineTo(.65*b,0);a.lineTo(.65*b,.4*c);a.lineTo(.35*b,.4*c);a.lineTo(.35*b,0);X(a);T(a,.1*b,1*c,!0,!0);a.lineTo(.4*b,1*c);
a.lineTo(.4*b,.6*c);a.lineTo(.1*b,.6*c);a.lineTo(.1*b,1*c);X(a);T(a,.6*b,1*c,!0,!0);a.lineTo(.9*b,1*c);a.lineTo(.9*b,.6*c);a.lineTo(.6*b,.6*c);a.lineTo(.6*b,1*c);X(a);T(a,0,.5*c,!1);a.lineTo(1*b,.5*c);a.moveTo(.5*b,.5*c);a.lineTo(.5*b,.4*c);a.moveTo(.75*b,.5*c);a.lineTo(.75*b,.6*c);a.moveTo(.25*b,.5*c);a.lineTo(.25*b,.6*c);a.ib(!1);b=a.q;D.u(a);return b},Power:function(a,b,c){a=D.v();var d=.4*Fd,e=.4,g=D.P(),h=D.P(),k=D.P(),l=D.P();Ge(.5,.5-e,.5+d,.5-e,.5+e,.5-d,.5+e,.5,.5,g,g,h,k,l);var m=D.Fb(h.x,
h.y);T(a,h.x*b,h.y*c,!0);V(a,k.x*b,k.y*c,l.x*b,l.y*c,(.5+e)*b,.5*c);V(a,(.5+e)*b,(.5+d)*c,(.5+d)*b,(.5+e)*c,.5*b,(.5+e)*c);V(a,(.5-d)*b,(.5+e)*c,(.5-e)*b,(.5+d)*c,(.5-e)*b,.5*c);Ge(.5-e,.5,.5-e,.5-d,.5-d,.5-e,.5,.5-e,.5,k,l,h,g,g);V(a,k.x*b,k.y*c,l.x*b,l.y*c,h.x*b,h.y*c);d=.3*Fd;e=.3;Ge(.5-e,.5,.5-e,.5-d,.5-d,.5-e,.5,.5-e,.5,k,l,h,g,g);a.lineTo(h.x*b,h.y*c);V(a,l.x*b,l.y*c,k.x*b,k.y*c,(.5-e)*b,.5*c);V(a,(.5-e)*b,(.5+d)*c,(.5-d)*b,(.5+e)*c,.5*b,(.5+e)*c);V(a,(.5+d)*b,(.5+e)*c,(.5+e)*b,(.5+d)*c,(.5+
e)*b,.5*c);Ge(.5,.5-e,.5+d,.5-e,.5+e,.5-d,.5+e,.5,.5,g,g,h,k,l);V(a,l.x*b,l.y*c,k.x*b,k.y*c,h.x*b,h.y*c);X(a);T(a,.45*b,0,!0);a.lineTo(.45*b,.5*c);a.lineTo(.55*b,.5*c);a.lineTo(.55*b,0);X(a);D.A(g);D.A(h);D.A(k);D.A(l);D.A(m);b=a.q;b.C=new R(.25,.55);b.D=new R(.75,.8);D.u(a);return b},Fallout:function(a,b,c){a=D.v();var d=.5*Fd;T(a,0*b,.5*c,!0);V(a,0*b,(.5-d)*c,(.5-d)*b,0*c,.5*b,0*c);V(a,(.5+d)*b,0*c,1*b,(.5-d)*c,1*b,.5*c);V(a,1*b,(.5+d)*c,(.5+d)*b,1*c,.5*b,1*c);V(a,(.5-d)*b,1*c,0*b,(.5+d)*c,0*b,
.5*c);var e=d=0;T(a,(.3+d)*b,(.8+e)*c,!0,!0);a.lineTo((.5+d)*b,(.5+e)*c);a.lineTo((.1+d)*b,(.5+e)*c);a.lineTo((.3+d)*b,(.8+e)*c);d=.4;e=0;X(a);T(a,(.3+d)*b,(.8+e)*c,!0,!0);a.lineTo((.5+d)*b,(.5+e)*c);a.lineTo((.1+d)*b,(.5+e)*c);a.lineTo((.3+d)*b,(.8+e)*c);d=.2;e=-.3;X(a);T(a,(.3+d)*b,(.8+e)*c,!0,!0);a.lineTo((.5+d)*b,(.5+e)*c);a.lineTo((.1+d)*b,(.5+e)*c);a.lineTo((.3+d)*b,(.8+e)*c);X(a);b=a.q;b.je=Uj;D.u(a);return b},IrritationHazard:function(a,b,c){a=D.v();T(a,.2*b,0*c,!0);a.lineTo(.5*b,.3*c);a.lineTo(.8*
b,0*c);a.lineTo(1*b,.2*c);a.lineTo(.7*b,.5*c);a.lineTo(1*b,.8*c);a.lineTo(.8*b,1*c);a.lineTo(.5*b,.7*c);a.lineTo(.2*b,1*c);a.lineTo(0*b,.8*c);a.lineTo(.3*b,.5*c);a.lineTo(0*b,.2*c);X(a);b=a.q;b.C=new R(.3,.3);b.D=new R(.7,.7);D.u(a);return b},ElectricalHazard:function(a,b,c){a=D.v();T(a,.37*b,0*c,!0);a.lineTo(.5*b,.11*c);a.lineTo(.77*b,.04*c);a.lineTo(.33*b,.49*c);a.lineTo(1*b,.37*c);a.lineTo(.63*b,.86*c);a.lineTo(.77*b,.91*c);a.lineTo(.34*b,1*c);a.lineTo(.34*b,.78*c);a.lineTo(.44*b,.8*c);a.lineTo(.65*
b,.56*c);a.lineTo(0*b,.68*c);X(a);b=a.q;D.u(a);return b},FireHazard:function(a,b,c){a=D.v();T(a,.1*b,1*c,!0);V(a,-.25*b,.63*c,.45*b,.44*c,.29*b,0*c);V(a,.48*b,.17*c,.54*b,.35*c,.51*b,.42*c);V(a,.59*b,.29*c,.58*b,.28*c,.59*b,.18*c);V(a,.8*b,.34*c,.88*b,.43*c,.75*b,.6*c);V(a,.87*b,.48*c,.88*b,.43*c,.88*b,.31*c);V(a,1.17*b,.76*c,.82*b,.8*c,.9*b,1*c);X(a);b=a.q;b.C=new R(.05,.645);b.D=new R(.884,.908);D.u(a);return b},BpmnActivityLoop:function(a,b,c){a=D.v();var d=4*(Math.SQRT2-1)/3*.5;T(a,.65*b,1*c,
!1);V(a,(1-d+0)*b,1*c,1*b,(.5+d+0)*c,1*b,.5*c);V(a,1*b,(.5-d+0)*c,(.5+d+0)*b,0*c,.5*b,0*c);V(a,(.5-d+0)*b,0*c,0*b,(.5-d+0)*c,0*b,.5*c);V(a,0*b,(.5+d+0)*c,(.5-d+0)*b,1*c,.35*b,.98*c);a.moveTo(.25*b,.8*c);a.lineTo(.35*b,1*c);a.lineTo(.1*b,1*c);b=a.q;D.u(a);return b},BpmnActivityParallel:function(a,b,c){a=D.v();T(a,0,0,!1);a.lineTo(0,1*c);a.moveTo(.5*b,0);a.lineTo(.5*b,1*c);a.moveTo(1*b,0);a.lineTo(1*b,1*c);b=a.q;D.u(a);return b},BpmnActivitySequential:function(a,b,c){a=D.v();T(a,0,0,!1);a.lineTo(1*
b,0);a.moveTo(0,.5*c);a.lineTo(1*b,.5*c);a.moveTo(0,1*c);a.lineTo(1*b,1*c);b=a.q;D.u(a);return b},BpmnActivityAdHoc:function(a,b,c){a=D.v();T(a,0,0,!1);T(a,1*b,1*c,!1);T(a,0,.5*c,!1);V(a,.2*b,.35*c,.3*b,.35*c,.5*b,.5*c);V(a,.7*b,.65*c,.8*b,.65*c,1*b,.5*c);b=a.q;D.u(a);return b},BpmnActivityCompensation:function(a,b,c){a=D.v();T(a,0,.5*c,!0);a.lineTo(.5*b,0);a.lineTo(.5*b,.5*c);a.lineTo(1*b,1*c);a.lineTo(1*b,0);a.lineTo(.5*b,.5*c);a.lineTo(.5*b,1*c);X(a);b=a.q;D.u(a);return b},BpmnTaskMessage:function(a,
b,c){a=D.v();T(a,0,.2*c,!0);a.lineTo(1*b,.2*c);a.lineTo(1*b,.8*c);a.lineTo(0,.8*c);a.lineTo(0,.8*c);X(a);T(a,0,.2*c,!1);a.lineTo(.5*b,.5*c);a.lineTo(1*b,.2*c);a.ib(!1);b=a.q;D.u(a);return b},BpmnTaskScript:function(a,b,c){a=D.v();T(a,.7*b,1*c,!0);a.lineTo(.3*b,1*c);V(a,.6*b,.5*c,0,.5*c,.3*b,0);a.lineTo(.7*b,0);V(a,.4*b,.5*c,1*b,.5*c,.7*b,1*c);X(a);T(a,.45*b,.73*c,!1);a.lineTo(.7*b,.73*c);a.moveTo(.38*b,.5*c);a.lineTo(.63*b,.5*c);a.moveTo(.31*b,.27*c);a.lineTo(.56*b,.27*c);a.ib(!1);b=a.q;D.u(a);return b},
BpmnTaskUser:function(a,b,c){a=D.v();T(a,0,0,!1);T(a,.335*b,(1-.555)*c,!0);a.lineTo(.335*b,.595*c);a.lineTo(.665*b,.595*c);a.lineTo(.665*b,(1-.555)*c);V(a,.88*b,.46*c,.98*b,.54*c,1*b,.68*c);a.lineTo(1*b,1*c);a.lineTo(0,1*c);a.lineTo(0,.68*c);V(a,.02*b,.54*c,.12*b,.46*c,.335*b,(1-.555)*c);a.lineTo(.365*b,.405*c);var d=.5-.285,e=Math.PI/4,g=4*(1-Math.cos(e))/(3*Math.sin(e)),e=g*d,g=g*d;V(a,(.5-(e+d)/2)*b,(d+(d+g)/2)*c,(.5-d)*b,(d+g)*c,(.5-d)*b,d*c);V(a,(.5-d)*b,(d-g)*c,(.5-e)*b,(d-d)*c,.5*b,(d-d)*c);
V(a,(.5+e)*b,(d-d)*c,(.5+d)*b,(d-g)*c,(.5+d)*b,d*c);V(a,(.5+d)*b,(d+g)*c,(.5+(e+d)/2)*b,(d+(d+g)/2)*c,.635*b,.405*c);a.lineTo(.635*b,.405*c);a.lineTo(.665*b,(1-.555)*c);a.lineTo(.665*b,.595*c);a.lineTo(.335*b,.595*c);T(a,.2*b,1*c,!1);a.lineTo(.2*b,.8*c);T(a,.8*b,1*c,!1);a.lineTo(.8*b,.8*c);b=a.q;D.u(a);return b},BpmnEventConditional:function(a,b,c){a=D.v();T(a,.1*b,0,!0);a.lineTo(.9*b,0);a.lineTo(.9*b,1*c);a.lineTo(.1*b,1*c);X(a);T(a,.2*b,.2*c,!1);a.lineTo(.8*b,.2*c);a.moveTo(.2*b,.4*c);a.lineTo(.8*
b,.4*c);a.moveTo(.2*b,.6*c);a.lineTo(.8*b,.6*c);a.moveTo(.2*b,.8*c);a.lineTo(.8*b,.8*c);a.ib(!1);b=a.q;D.u(a);return b},BpmnEventError:function(a,b,c){a=D.v();T(a,0,1*c,!0);a.lineTo(.33*b,0);a.lineTo(.66*b,.5*c);a.lineTo(1*b,0);a.lineTo(.66*b,1*c);a.lineTo(.33*b,.5*c);X(a);b=a.q;D.u(a);return b},BpmnEventEscalation:function(a,b,c){a=D.v();T(a,0,0,!1);T(a,1*b,1*c,!1);T(a,.1*b,1*c,!0);a.lineTo(.5*b,0);a.lineTo(.9*b,1*c);a.lineTo(.5*b,.5*c);X(a);b=a.q;D.u(a);return b},BpmnEventTimer:function(a,b,c){a=
D.v();var d=.5*Fd;T(a,1*b,.5*c,!0);V(a,1*b,(.5+d)*c,(.5+d)*b,1*c,.5*b,1*c);V(a,(.5-d)*b,1*c,0,(.5+d)*c,0,.5*c);V(a,0,(.5-d)*c,(.5-d)*b,0,.5*b,0);V(a,(.5+d)*b,0,1*b,(.5-d)*c,1*b,.5*c);T(a,.5*b,0,!1);a.lineTo(.5*b,.15*c);a.moveTo(.5*b,1*c);a.lineTo(.5*b,.85*c);a.moveTo(0,.5*c);a.lineTo(.15*b,.5*c);a.moveTo(1*b,.5*c);a.lineTo(.85*b,.5*c);a.moveTo(.5*b,.5*c);a.lineTo(.58*b,.1*c);a.moveTo(.5*b,.5*c);a.lineTo(.78*b,.54*c);a.ib(!1);b=a.q;b.je=Uj;D.u(a);return b}},br;for(br in mq)mq[br.toLowerCase()]=br;
var tq={"":"",Standard:"F1 m 0,0 l 8,4 -8,4 2,-4 z",Backward:"F1 m 8,0 l -2,4 2,4 -8,-4 z",Triangle:"F1 m 0,0 l 8,4.62 -8,4.62 z",BackwardTriangle:"F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z",Boomerang:"F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z",BackwardBoomerang:"F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z",SidewaysV:"m 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z",BackwardV:"m 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z",OpenTriangle:"m 0,0 l 8,4 -8,4",BackwardOpenTriangle:"m 8,0 l -8,4 8,4",OpenTriangleLine:"m 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8",
BackwardOpenTriangleLine:"m 8,0 l  -8,4 8,4 m -8.5,0 l 0,-8",OpenTriangleTop:"m 0,0 l 8,4 m 0,4",BackwardOpenTriangleTop:"m 8,0 l -8,4 m 0,4",OpenTriangleBottom:"m 0,8 l 8,-4",BackwardOpenTriangleBottom:"m 0,4 l 8,4",HalfTriangleTop:"F1 m 0,0 l 0,4 8,0 z m 0,8",BackwardHalfTriangleTop:"F1 m 8,0 l 0,4 -8,0 z m 0,8",HalfTriangleBottom:"F1 m 0,4 l 0,4 8,-4 z",BackwardHalfTriangleBottom:"F1 m 8,4 l 0,4 -8,-4 z",ForwardSemiCircle:"m 4,0 b 270 180 0 4 4",BackwardSemiCircle:"m 4,8 b 90 180 0 -4 4",Feather:"m 0,0 l 3,4 -3,4",
BackwardFeather:"m 3,0 l -3,4 3,4",DoubleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardDoubleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4",TripleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardTripleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4",ForwardSlash:"m 0,8 l 5,-8",BackSlash:"m 0,0 l 5,8",DoubleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8",DoubleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8",TripleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8",
TripleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8",Fork:"m 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4",LineFork:"m 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardLineFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8",CircleFork:"F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3",CircleLineFork:"F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",
BackwardCircleLineFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3",Circle:"F1 m 8,4 b 0 360 -4 0 4 z",Block:"F1 m 0,0 l 0,8 8,0 0,-8 z",StretchedDiamond:"F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z",Diamond:"F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z",Chevron:"F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z",StretchedChevron:"F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z",NormalArrow:"F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z",X:"m 0,0 l 8,8 m 0,-8 l -8,8",TailedNormalArrow:"F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z",
DoubleTriangle:"F1 m 0,0 l 4,4 -4,4 0,-8 z  m 4,0 l 4,4 -4,4 0,-8 z",BigEndArrow:"F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z",ConcaveTailArrow:"F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z",RoundedTriangle:"F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z",SimpleArrow:"F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z",AccelerationArrow:"F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z",BoxArrow:"F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z",
TriangleLine:"F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8",CircleEndedArrow:"F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z",DynamicWidthArrow:"F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z",EquilibriumArrow:"m 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3",FastForward:"F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z",Kite:"F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z",HalfArrowTop:"F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8",HalfArrowBottom:"F1 m 0,8 l 4,-4 4,0 -8,4 z",
OpposingDirectionDoubleArrow:"F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z",PartialDoubleTriangle:"F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z",LineCircle:"F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z",DoubleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",TripleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",CircleLine:"F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8",DiamondCircle:"F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z",PlusCircle:"F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8",
OpenRightTriangleTop:"m 8,0 l 0,4 -8,0 m 0,4",OpenRightTriangleBottom:"m 8,8 l 0,-4 -8,0",Line:"m 0,0 l 0,8",DoubleLine:"m 0,0 l 0,8 m 2,0 l 0,-8",TripleLine:"m 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8",PentagonArrow:"F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z"};
function qq(a){var b=re[a];if(void 0===b){var c=a.toLowerCase();if("none"===c)return"None";b=re[c];if(void 0===b){var d=null,e;for(e in tq)if(e.toLowerCase()===c){d=e;break}if(null!==d)return a=yf(tq[d],!1),re[d]=a,c!==d&&(re[c]=d),d}}return"string"===typeof b?b:b instanceof bf?a:null}
function F(a){x.call(this,a);this.S=2408959;this.El=this.Ni="";this.et=this.bt=this.nt=this.ps=null;this.pt="";this.mh=this.cs=this.ot=this.rn=null;this.dt="";this.Gp=null;this.ct=me;this.ft="";this.Ip=null;this.Sd="";this.kw=this.rr=this.ql=null;this.hj=(new O(NaN,NaN)).freeze();this.us="";this.Hl=null;this.vs=cc;this.Ds=Xd;this.ws=Yd;this.Lr=null;this.qs=cr;this.tn=Wd;this.sn="gray";this.Lg=4;this.uD=-1;this.Ot=NaN;this.qH=new B;this.Jl=null;this.tk=NaN}D.Sa(F,x);D.ja("Part",F);
F.prototype.cloneProtected=function(a){x.prototype.cloneProtected.call(this,a);a.S=this.S&-4097|49152;a.Ni=this.Ni;a.El=this.El;a.ps=this.ps;a.nt=this.nt;a.bt=this.bt;a.et=this.et;a.pt=this.pt;a.ot=this.ot;a.cs=this.cs;a.mh=null;a.dt=this.dt;a.ct=this.ct.V();a.ft=this.ft;a.Sd=this.Sd;a.rr=this.rr;a.hj.assign(this.hj);a.us=this.us;a.vs=this.vs.V();a.Ds=this.Ds.V();a.ws=this.ws.V();a.Lr=this.Lr;a.qs=this.qs;a.tn=this.tn.V();a.sn=this.sn;a.Lg=this.Lg;a.Ot=this.Ot};
F.prototype.Bi=function(a){x.prototype.Bi.call(this,a);a.rm();a.rn=null;a.Gp=null;a.Ip=null;a.Hl=null;a.Jl=null};F.prototype.toString=function(){var a=D.qf(Object.getPrototypeOf(this))+"#"+D.Fd(this);null!==this.data&&(a+="("+ja(this.data)+")");return a};F.LayoutNone=0;var Qm;F.LayoutAdded=Qm=1;var Zm;F.LayoutRemoved=Zm=2;F.LayoutShown=4;F.LayoutHidden=8;F.LayoutNodeSized=16;var Fn;F.LayoutGroupLayout=Fn=32;F.LayoutNodeReplaced=64;var cr;F.LayoutStandard=cr=Qm|Zm|28|Fn|64;F.LayoutAll=16777215;
F.prototype.po=function(a,b,c,d,e,g,h){var k=this.g;null!==k&&(a===mg&&"elements"===b?e instanceof x?Rm(e,function(a){Tm(k,a);Sm(k,a)}):e instanceof Cl&&rn(k,e):a===ng&&"elements"===b&&(e instanceof x?Rm(e,function(a){Xm(k,a);Wm(k,a)}):e instanceof Cl&&sn(k,e)),k.hd(a,b,c,d,e,g,h))};F.prototype.updateTargetBindings=F.prototype.Nb=function(a){x.prototype.Nb.call(this,a);if(null!==this.data){a=this.xa.o;for(var b=a.length,c=0;c<b;c++){var d=a[c];d instanceof x&&Rm(d,function(a){null!==a.data&&a.Nb()})}}};
F.prototype.updateRelationshipsFromData=function(){var a=this.data;if(null!==a){var b=this.g;if(null!==b){var c=b.ga;c instanceof Y&&(a=c.Sn(a),b=b.EI(a),null===b||b instanceof I)&&(this.Pa=b)}}};D.w(F,{jx:"adornments"},function(){return null===this.mh?Ka:this.mh.YF});F.prototype.findAdornment=F.prototype.nq=function(a){v&&D.h(a,"string",F,"findAdornment:category");var b=this.mh;return null===b?null:b.oa(a)};
F.prototype.addAdornment=F.prototype.Ul=function(a,b){if(null!==b){v&&(D.h(a,"string",F,"addAdornment:category"),D.l(b,da,F,"addAdornment:ad"));var c=null,d=this.mh;null!==d&&(c=d.oa(a));if(c!==b){if(null!==c){var e=c.g;null!==e&&e.remove(c)}null===d&&(this.mh=d=new ma("string",da));b.Ni!==a&&(b.Dd=a);d.add(a,b);c=this.g;null!==c&&(c.add(b),b.data=this.data)}}};
F.prototype.removeAdornment=F.prototype.Tj=function(a){v&&D.h(a,"string",F,"removeAdornment:category");var b=this.mh;if(null!==b){var c=b.oa(a);if(null!==c){var d=c.g;null!==d&&d.remove(c)}b.remove(a);0===b.count&&(this.mh=null)}};F.prototype.clearAdornments=F.prototype.Zt=function(){var a=this.mh;if(null!==a){for(var b=D.tb(),a=a.j;a.next();)b.push(a.key);for(var a=b.length,c=0;c<a;c++)this.Tj(b[c]);D.Aa(b)}};
F.prototype.updateAdornments=function(){var a=this.g;if(null!==a){a:{if(this.hb&&this.MG){var b=this.ro;if(!(null!==b&&this.$.F()&&this.isVisible()&&b.Nj()&&b.$.F()))break a;var c=this.nq("Selection");if(null===c){c=this.eK;null===c&&(c=this instanceof J?a.vJ:this instanceof I?a.TI:a.MJ);if(!(c instanceof da))break a;Kh(c);c=c.copy();null!==c&&(c.zb=b)}if(null!==c){var d=c.placeholder;if(null!==d){var e=b.Fj(),g=0;b instanceof z&&(g=b.jb);var h=D.Cm();h.m((b.Ga.width+g)*e,(b.Ga.height+g)*e);d.Ea=
h;D.Rk(h)}c.angle=b.Rn();c.type!==kj&&(d=D.P(),c.location=b.eb(cc,d),D.A(d));this.Ul("Selection",c);break a}}this.Tj("Selection")}dr(this,a);for(a=this.jx;a.next();)b=a.value,b.Nb(),b.K()}};function dr(a,b){b.kb.lf.each(function(b){b.isEnabled&&b.updateAdornments(a)});b.kb.updateAdornments(a)}D.w(F,{layer:"layer"},function(){return this.kw});D.w(F,{g:"diagram"},function(){var a=this.kw;return null!==a?a.g:null});
D.defineProperty(F,{Jf:"layerName"},function(){return this.El},function(a){var b=this.El;if(b!==a){D.h(a,"string",F,"layerName");var c=this.g;if(null===c||null!==c.jm(a)&&!c.br)if(this.El=a,null!==c&&c.yc(),this.i("layerName",b,a),b=this.layer,null!==b&&b.name!==a&&(c=b.g,null!==c&&(a=c.jm(a),null!==a&&a!==b))){var d=b.rf(-1,this,!0);0<=d&&c.hd(ng,"parts",b,this,null,d,!0);b.visible!==a.visible&&this.Hd(a.visible);d=a.uq(99999999,this,!0);0<=d&&c.hd(mg,"parts",a,null,this,!0,d);d=this.by;if(null!==
d){var e=c.ab;c.ab=!0;d(this,b,a);c.ab=e}}}});D.defineProperty(F,{by:"layerChanged"},function(){return this.ps},function(a){var b=this.ps;b!==a&&(null!==a&&D.h(a,"function",F,"layerChanged"),this.ps=a,this.i("layerChanged",b,a))});D.defineProperty(F,{Bo:"zOrder"},function(){return this.Ot},function(a){var b=this.Ot;if(b!==a){D.h(a,"number",F,"zOrder");this.Ot=a;var c=this.layer;null!==c&&tl(c,-1,this);this.i("zOrder",b,a);a=this.g;null!==a&&a.qa()}});
F.prototype.invalidateAdornments=F.prototype.ne=function(){var a=this.g;null!==a&&(Rl(a),0!==(this.S&16384)!==!0&&(this.S|=16384,a.Se()))};function pl(a){0!==(a.S&16384)!==!1&&(a.updateAdornments(),a.S&=-16385)}function er(a){if(!1===Jm(a)){var b=a.g;null!==b&&(b.Cg.add(a),b.Se());fr(a,!0);a.$i()}}function gr(a){a.S|=2097152;if(!1!==Jm(a)){var b=a.position,c=a.location;c.F()&&b.F()||hr(a,b,c);var c=a.ac,d=c.copy();c.Ya();c.x=b.x;c.y=b.y;c.freeze();a.my(d,c);fr(a,!1)}}
D.w(F,{uf:"locationObject"},function(){if(null===this.Hl){var a=this.iy;""!==a?(a=this.Ed(a),this.Hl=null!==a?a:this):this.Hl=this instanceof da?this.type!==kj&&null!==this.placeholder?this.placeholder:this:this}return this.Hl.visible?this.Hl:this});D.defineProperty(F,{GJ:"minLocation"},function(){return this.Ds},function(a){var b=this.Ds;b.O(a)||(v&&D.l(a,O,F,"minLocation"),this.Ds=a=a.V(),this.i("minLocation",b,a))});
D.defineProperty(F,{AJ:"maxLocation"},function(){return this.ws},function(a){var b=this.ws;b.O(a)||(v&&D.l(a,O,F,"maxLocation"),this.ws=a=a.V(),this.i("maxLocation",b,a))});D.defineProperty(F,{iy:"locationObjectName"},function(){return this.us},function(a){var b=this.us;b!==a&&(v&&D.h(a,"string",F,"locationObjectName"),this.us=a,this.Hl=null,Wo(this),this.i("locationObjectName",b,a))});
D.defineProperty(F,{Kf:"locationSpot"},function(){return this.vs},function(a){var b=this.vs;b.O(a)||(v&&(D.l(a,R,F,"locationSpot"),a.fd()||D.k("Part.locationSpot must be a specific Spot value, not: "+a)),this.vs=a=a.V(),Wo(this),this.i("locationSpot",b,a))});F.prototype.move=function(a){this.position=a};F.prototype.moveTo=F.prototype.moveTo=function(a,b){var c=D.Fb(a,b);this.move(c);D.A(c)};
F.prototype.isVisible=function(){if(!this.visible)return!1;var a=this.layer;if(null!==a&&!a.visible)return!1;a=this.g;if(null!==a&&(a=a.Xa,a.sf&&(a=a.gn.oa(this),null!==a&&a.vy)))return!0;a=this.Pa;return null===a||a.Je&&a.isVisible()?!0:!1};F.prototype.Hd=function(a){var b=this.g;a?(this.N(4),this.ne(),null!==b&&b.Cg.add(this)):(this.N(8),this.Zt());this.rm();null!==b&&(b.yc(),b.qa())};
F.prototype.findObject=F.prototype.Ed=function(a){if(this.name===a)return this;var b=this.Jl;null===b&&(this.Jl=b=new la);if(void 0!==b[a])return b[a];for(var c=this.xa.o,d=c.length,e=0;e<d;e++){var g=c[e];if(g.name===a)return b[a]=g;if(g instanceof x)if(null===g.cj&&null===g.Eg){if(g=g.Ed(a),null!==g)return b[a]=g}else if(pn(g)&&(g=g.xa.first(),null!==g&&g.name===a))return b[a]=g}return b[a]=null};
function ir(a,b,c,d){void 0===d&&(d=new O);c=c.Zd()?gc:c;var e=b.Ga;d.m(e.width*c.x+c.offsetX,e.height*c.y+c.offsetY);if(null===b||b===a)return d;b.transform.vb(d);for(b=b.Q;null!==b&&b!==a;)b.transform.vb(d),b=b.Q;a.gj.vb(d);d.offset(-a.Ad.x,-a.Ad.y);return d}F.prototype.ensureBounds=F.prototype.hf=function(){Ak(this,Infinity,Infinity);this.oc()};
function sl(a,b){var c=a.qH,d;isNaN(a.tk)&&(a.tk=bq(a));d=a.tk;var e=2*d;if(!a.Wk)return c.m(b.x-1-d,b.y-1-d,b.width+2+e,b.height+2+e),c;d=b.x;var e=b.y,g=b.width,h=b.height,k=a.shadowBlur,l=a.iK,g=g+k,h=h+k;d-=k/2;e-=k/2;0<l.x?g+=l.x:(d+=l.x,g-=l.x);0<l.y?h+=l.y:(e+=l.y,h-=l.y);c.m(d-1,e-1,g+2,h+2);return c}
F.prototype.oc=function(){this.$i();if(!1===Im(this))gr(this);else{var a=this.ac,b=D.Nf();b.assign(a);a.Ya();var c=ol(this);this.yj(0,0,this.Ad.width,this.Ad.height);var d=this.position;hr(this,d,this.location);a.x=d.x;a.y=d.y;a.freeze();this.my(b,a);Ko(this,!1);b.O(a)?this.Lf(c):!this.oe()||Q(b.width,a.width)&&Q(b.height,a.height)||0<=this.uD&&this.N(16);D.Mb(b);fr(this,!1)}};
F.prototype.my=function(a,b){var c=this.g;if(null!==c){var d=!1;if(!1===c.mk&&a.F()){var e=c.cd,g=c.padding,h=e.x+g.left,k=e.y+g.top,l=e.width-2*g.right,e=e.height-2*g.bottom;a.x>h&&a.y>k&&a.right<l&&a.bottom<e&&b.x>h&&b.y>k&&b.right<l&&b.bottom<e&&(d=!0)}0!==(this.S&65536)!==!0&&a.O(b)||Um(this,d,c);c.qa();xb(a,b)||(this instanceof G&&!c.ra.nb&&this.fg(),this.rm())}};
D.defineProperty(F,{location:"location"},function(){return this.hj},function(a){v&&D.l(a,O,F,"location");var b=a.x,c=a.y,d=this.hj,e=d.x,g=d.y;(e===b||isNaN(e)&&isNaN(b))&&(g===c||isNaN(g)&&isNaN(c))||(a=a.V(),b=a,this instanceof J?b=!1:(this.hj=b,this.S|=2097152,!1===Im(this)&&(er(this),c=this.qb,c.F()&&(e=c.copy(),c.m(c.x+(b.x-d.x),c.y+(b.y-d.y)),jr(this,this.g,c,e),this.i("position",e,c))),b=!0),b&&this.i("location",d,a))});f=F.prototype;
f.FB=function(a,b){if(this instanceof J||!a.F())return!1;var c=this.g;if(null!==c&&(jr(this,c,a,b),!0===c.ra.nb))return!0;this.qb=a;this.S&=-2097153;c=this.hj;if(c.F()){var d=c.copy();c.m(c.x+(a.x-b.x),c.y+(a.y-b.y));this.i("location",d,c)}!1===Jm(this)&&!1===Im(this)&&(er(this),gr(this));return!0};function jr(a,b,c,d){null===b||a instanceof da||(b=b.Xa,b.vc&&cl(b,a,"position",d.copy(),c.copy(),!1))}
f.Hy=function(a,b){var c=this.hj,d=this.qb;Jm(this)||Im(this)?c.m(NaN,NaN):c.m(c.x+a-d.x,c.y+b-d.y);d.m(a,b);er(this)};f.GB=function(){this.S&=-2097153;er(this)};
function hr(a,b,c){var d=D.P(),e=a.Kf,g=a.uf;e.Zd()&&D.k("determineOffset: Part's locationSpot must be real: "+e.toString());var h=g.Ga,k=g instanceof z?g.jb:0;d.av(0,0,h.width+k,h.height+k,e);if(g!==a)for(d.offset(-k/2,-k/2),g.transform.vb(d),e=g.Q;null!==e&&e!==a;)e.transform.vb(d),e=e.Q;a.gj.vb(d);d.offset(-a.Ad.x,-a.Ad.y);e=a.g;g=c.F();h=b.F();g&&h?0!==(a.S&2097152)?kr(a,b,c,e,d):lr(a,b,c,e,d):g?kr(a,b,c,e,d):h&&lr(a,b,c,e,d);a.S|=2097152;D.A(d);a.$i()}
function kr(a,b,c,d,e){var g=b.x,h=b.y;b.m(c.x-e.x,c.y-e.y);null!==d&&(c=d.Xa,(e=c.nk)||!c.vc||a instanceof da||cl(c,a,"position",new O(g,h),b,!1),e||b.x===g&&b.y===h||(c=d.Eb,d.Eb=!0,a.i("position",new O(g,h),b),d.Eb=c))}function lr(a,b,c,d,e){var g=c.copy();c.m(b.x+e.x,b.y+e.y);c.O(g)||null===d||(b=d.Eb,d.Eb=!0,a.i("location",g,c),d.Eb=b)}
function Um(a,b,c){Mo(a,!1);a instanceof G&&Mn(c,a);a.layer.Tc||b||c.yc();b=a.ac;var d=c.xb;d.F()?(ol(a)?Lb(b,d)||a.Lf(!1):b.Wg(d)&&a.Lf(!0),a.updateAdornments()):c.zl=!0}f.um=function(){return!0};
function ql(a,b){var c=a.ac;if(0!==c.width&&0!==c.height&&!isNaN(c.x)&&!isNaN(c.y)&&a.isVisible()){var d=a.transform;null!==a.hc&&(So(a,b,a.hc,!0,!0),b.fillRect(c.x,c.y,c.width,c.height));null===a.hc&&null===a.Kb&&(So(a,b,"rgba(0,0,0,0.4)",!0,!1),b.fillRect(c.x,c.y,c.width,c.height));null!==a.Kb&&(d.xu()||b.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy),c=a.Ga,So(a,b,a.Kb,!0,!1),b.fillRect(0,0,c.width,c.height),d.xu()||(c=1/(d.m11*d.m22-d.m12*d.m21),b.transform(d.m22*c,-d.m12*c,-d.m21*c,d.m11*c,c*(d.m21*
d.dy-d.m22*d.dx),c*(d.m12*d.dx-d.m11*d.dy))))}}f.oe=function(){return!0};f.Jj=function(){return!0};
D.defineProperty(F,{Dd:"category"},function(){return this.Ni},function(a){var b=this.Ni;if(b!==a){D.h(a,"string",F,"category");var c=this.g,d=this.data,e=null;if(null!==c&&null!==d&&!(this instanceof da)){var g=c.ga.ra;g.isEnabled&&!g.nb&&(e=this.clone(),e.xa.Rc(this.xa))}this.Ni=a;this.i("category",b,a);null===c||null===d||this instanceof da?(e=this.Zf,null!==e&&(a=e.mh,null!==a&&a.remove(b),e.Ul(this.Dd,this))):(g=c.ga,g.ra.nb||(this instanceof J?(g instanceof Y?g.OG(d,a):g instanceof wg&&g.gK(d,
a),c=zn(c,a),null!==c&&(Kh(c),c=c.copy(),null!==c&&mr(this,c,b,a))):(null!==g&&g.Ey(d,a),c=wn(c,d,a),null!==c&&(Kh(c),c=c.copy(),null===c||c instanceof J||(c.location=this.location,mr(this,c,b,a)))),null!==e&&(b=this.clone(),b.xa.Rc(this.xa),this.i("self",e,b))))}});D.defineProperty(F,{self:"self"},function(){return this},function(a){mr(this,a,this.Dd,a.Dd)});var nr=!1;
function mr(a,b,c,d){b.constructor===a.constructor||nr||(nr=!0,D.trace('Should not change the class of the Part when changing category from "'+c+'" to "'+d+'"'),D.trace("  Old class: "+D.qf(a)+", new class: "+D.qf(b)+", part: "+a.toString()));a.Zt();var e=a.data;c=a.Jf;var g=a.hb,h=a.Xg,k=!0,l=!0,m=!1;if(a instanceof G)var n=a,k=n.Mj,l=n.rd,m=n.iv;b.Bi(a);b.cloneProtected(a);a.Ni=d;a.K();a.qa();b=a.g;d=!0;null!==b&&(d=b.Eb,b.Eb=!0);a.Nd=e;null!==e&&a.Nb();null!==b&&(b.Eb=d);e=a.Jf;e!==c&&(a.El=c,
a.Jf=e);a instanceof G&&(n=a,n.Mj=k,n.rd=l,n.iv=m,n.oe()&&n.N(64));a.hb=g;a.Xg=h}F.prototype.canCopy=function(){if(!this.UE)return!1;var a=this.layer;if(null===a)return!0;if(!a.Kk)return!1;a=a.g;return null===a?!0:a.Kk?!0:!1};F.prototype.canDelete=function(){if(!this.YE)return!1;var a=this.layer;if(null===a)return!0;if(!a.Bn)return!1;a=a.g;return null===a?!0:a.Bn?!0:!1};
F.prototype.canEdit=function(){if(!this.XG)return!1;var a=this.layer;if(null===a)return!0;if(!a.nx)return!1;a=a.g;return null===a?!0:a.nx?!0:!1};F.prototype.canGroup=function(){if(!this.DF)return!1;var a=this.layer;if(null===a)return!0;if(!a.kx)return!1;a=a.g;return null===a?!0:a.kx?!0:!1};F.prototype.canMove=function(){if(!this.gG)return!1;var a=this.layer;if(null===a)return!0;if(!a.Yl)return!1;a=a.g;return null===a?!0:a.Yl?!0:!1};
F.prototype.canReshape=function(){if(!this.zG)return!1;var a=this.layer;if(null===a)return!0;if(!a.lx)return!1;a=a.g;return null===a?!0:a.lx?!0:!1};F.prototype.canResize=function(){if(!this.AG)return!1;var a=this.layer;if(null===a)return!0;if(!a.Wt)return!1;a=a.g;return null===a?!0:a.Wt?!0:!1};F.prototype.canRotate=function(){if(!this.FG)return!1;var a=this.layer;if(null===a)return!0;if(!a.mx)return!1;a=a.g;return null===a?!0:a.mx?!0:!1};
F.prototype.canSelect=function(){if(!this.$k)return!1;var a=this.layer;if(null===a)return!0;if(!a.Bf)return!1;a=a.g;return null===a?!0:a.Bf?!0:!1};D.defineProperty(F,{UE:"copyable"},function(){return 0!==(this.S&1)},function(a){var b=0!==(this.S&1);b!==a&&(v&&D.h(a,"boolean",F,"copyable"),this.S^=1,this.i("copyable",b,a))});
D.defineProperty(F,{YE:"deletable"},function(){return 0!==(this.S&2)},function(a){var b=0!==(this.S&2);b!==a&&(v&&D.h(a,"boolean",F,"deletable"),this.S^=2,this.i("deletable",b,a))});D.defineProperty(F,{XG:"textEditable"},function(){return 0!==(this.S&4)},function(a){var b=0!==(this.S&4);b!==a&&(v&&D.h(a,"boolean",F,"textEditable"),this.S^=4,this.i("textEditable",b,a),this.ne())});
D.defineProperty(F,{DF:"groupable"},function(){return 0!==(this.S&8)},function(a){var b=0!==(this.S&8);b!==a&&(v&&D.h(a,"boolean",F,"groupable"),this.S^=8,this.i("groupable",b,a))});D.defineProperty(F,{gG:"movable"},function(){return 0!==(this.S&16)},function(a){var b=0!==(this.S&16);b!==a&&(v&&D.h(a,"boolean",F,"movable"),this.S^=16,this.i("movable",b,a))});
D.defineProperty(F,{MG:"selectionAdorned"},function(){return 0!==(this.S&32)},function(a){var b=0!==(this.S&32);b!==a&&(v&&D.h(a,"boolean",F,"selectionAdorned"),this.S^=32,this.i("selectionAdorned",b,a),this.ne())});D.defineProperty(F,{Ux:"isInDocumentBounds"},function(){return 0!==(this.S&64)},function(a){var b=0!==(this.S&64);if(b!==a){v&&D.h(a,"boolean",F,"isInDocumentBounds");this.S^=64;var c=this.g;null!==c&&c.yc();this.i("isInDocumentBounds",b,a)}});
D.defineProperty(F,{$A:"isLayoutPositioned"},function(){return 0!==(this.S&128)},function(a){var b=0!==(this.S&128);b!==a&&(v&&D.h(a,"boolean",F,"isLayoutPositioned"),this.S^=128,this.i("isLayoutPositioned",b,a),this.N(a?4:8))});D.defineProperty(F,{$k:"selectable"},function(){return 0!==(this.S&256)},function(a){var b=0!==(this.S&256);b!==a&&(v&&D.h(a,"boolean",F,"selectable"),this.S^=256,this.i("selectable",b,a),this.ne())});
D.defineProperty(F,{zG:"reshapable"},function(){return 0!==(this.S&512)},function(a){var b=0!==(this.S&512);b!==a&&(v&&D.h(a,"boolean",F,"reshapable"),this.S^=512,this.i("reshapable",b,a),this.ne())});D.defineProperty(F,{AG:"resizable"},function(){return 0!==(this.S&1024)},function(a){var b=0!==(this.S&1024);b!==a&&(v&&D.h(a,"boolean",F,"resizable"),this.S^=1024,this.i("resizable",b,a),this.ne())});
D.defineProperty(F,{FG:"rotatable"},function(){return 0!==(this.S&2048)},function(a){var b=0!==(this.S&2048);b!==a&&(v&&D.h(a,"boolean",F,"rotatable"),this.S^=2048,this.i("rotatable",b,a),this.ne())});
D.defineProperty(F,{hb:"isSelected"},function(){return 0!==(this.S&4096)},function(a){var b=0!==(this.S&4096);if(b!==a){v&&D.h(a,"boolean",F,"isSelected");var c=this.g;if(!a||this.canSelect()&&!(null!==c&&c.selection.count>=c.BJ)){this.S^=4096;var d=!1;if(null!==c){d=c.Eb;c.Eb=!0;var e=c.selection;e.Ya();a?e.add(this):e.remove(this);e.freeze()}this.i("isSelected",b,a);this.ne();a=this.fK;null!==a&&a(this);null!==c&&(c.Se(),c.Eb=d)}}});
D.defineProperty(F,{Xg:"isHighlighted"},function(){return 0!==(this.S&524288)},function(a){var b=0!==(this.S&524288);if(b!==a){v&&D.h(a,"boolean",F,"isHighlighted");this.S^=524288;var c=this.g;null!==c&&(c=c.qm,c.Ya(),a?c.add(this):c.remove(this),c.freeze());this.i("isHighlighted",b,a);this.qa();a=this.WI;null!==a&&a(this)}});
D.defineProperty(F,{Wk:"isShadowed"},function(){return 0!==(this.S&8192)},function(a){var b=0!==(this.S&8192);b!==a&&(v&&D.h(a,"boolean",F,"isShadowed"),this.S^=8192,this.i("isShadowed",b,a),this.qa())});function Jm(a){return 0!==(a.S&32768)}function fr(a,b){a.S=b?a.S|32768:a.S&-32769}function Mo(a,b){a.S=b?a.S|65536:a.S&-65537}function ol(a){return 0!==(a.S&131072)}F.prototype.Lf=function(a){this.S=a?this.S|131072:this.S&-131073};function or(a,b){a.S=b?a.S|1048576:a.S&-1048577}
D.defineProperty(F,{KF:"isAnimated"},function(){return 0!==(this.S&262144)},function(a){var b=0!==(this.S&262144);b!==a&&(v&&D.h(a,"boolean",F,"isAnimated"),this.S^=262144,this.i("isAnimated",b,a))});D.defineProperty(F,{WI:"highlightedChanged"},function(){return this.cs},function(a){var b=this.cs;b!==a&&(null!==a&&D.h(a,"function",F,"highlightedChanged"),this.cs=a,this.i("highlightedChanged",b,a))});
D.defineProperty(F,{Cy:"selectionObjectName"},function(){return this.pt},function(a){var b=this.pt;b!==a&&(v&&D.h(a,"string",F,"selectionObjectName"),this.pt=a,this.rn=null,this.i("selectionObjectName",b,a))});D.defineProperty(F,{eK:"selectionAdornmentTemplate"},function(){return this.nt},function(a){var b=this.nt;b!==a&&(v&&D.l(a,da,F,"selectionAdornmentTemplate"),this instanceof J&&(a.type=kj),this.nt=a,this.i("selectionAdornmentTemplate",b,a))});
D.w(F,{ro:"selectionObject"},function(){if(null===this.rn){var a=this.Cy;null!==a&&""!==a?(a=this.Ed(a),this.rn=null!==a?a:this):this instanceof J?(a=this.path,this.rn=null!==a?a:this):this.rn=this}return this.rn});D.defineProperty(F,{fK:"selectionChanged"},function(){return this.ot},function(a){var b=this.ot;b!==a&&(null!==a&&D.h(a,"function",F,"selectionChanged"),this.ot=a,this.i("selectionChanged",b,a))});
D.defineProperty(F,{BG:"resizeAdornmentTemplate"},function(){return this.bt},function(a){var b=this.bt;b!==a&&(v&&D.l(a,da,F,"resizeAdornmentTemplate"),this.bt=a,this.i("resizeAdornmentTemplate",b,a))});D.defineProperty(F,{DG:"resizeObjectName"},function(){return this.dt},function(a){var b=this.dt;b!==a&&(v&&D.h(a,"string",F,"resizeObjectName"),this.dt=a,this.Gp=null,this.i("resizeObjectName",b,a))});
D.w(F,{CG:"resizeObject"},function(){if(null===this.Gp){var a=this.DG;null!==a&&""!==a?(a=this.Ed(a),this.Gp=null!==a?a:this):this.Gp=this}return this.Gp});D.defineProperty(F,{XJ:"resizeCellSize"},function(){return this.ct},function(a){var b=this.ct;b.O(a)||(v&&D.l(a,Ca,F,"resizeCellSize"),this.ct=a=a.V(),this.i("resizeCellSize",b,a))});
D.defineProperty(F,{ZJ:"rotateAdornmentTemplate"},function(){return this.et},function(a){var b=this.et;b!==a&&(v&&D.l(a,da,F,"rotateAdornmentTemplate"),this.et=a,this.i("rotateAdornmentTemplate",b,a))});D.defineProperty(F,{$J:"rotateObjectName"},function(){return this.ft},function(a){var b=this.ft;b!==a&&(v&&D.h(a,"string",F,"rotateObjectName"),this.ft=a,this.Ip=null,this.i("rotateObjectName",b,a))});
D.w(F,{GG:"rotateObject"},function(){if(null===this.Ip){var a=this.$J;null!==a&&""!==a?(a=this.Ed(a),this.Ip=null!==a?a:this):this.Ip=this}return this.Ip});D.defineProperty(F,{text:"text"},function(){return this.Sd},function(a){var b=this.Sd;b!==a&&(v&&D.h(a,"string",F,"text"),this.Sd=a,this.i("text",b,a))});
D.defineProperty(F,{Pa:"containingGroup"},function(){return this.ql},function(a){if(this.oe()){var b=this.ql;if(b!==a){v&&null!==a&&D.l(a,I,F,"containingGroup");null===a||this!==a&&!a.Ei(this)||(this===a&&D.k("Cannot make a Group a member of itself: "+this.toString()),D.k("Cannot make a Group indirectly contain itself: "+this.toString()+" already contains "+a.toString()));this.N(Zm);var c=this.g;null!==b?pr(b,this):this instanceof I&&null!==c&&c.Rl.remove(this);this.ql=a;null!==a?qr(a,this):this instanceof
I&&null!==c&&c.Rl.add(this);this.N(Qm);if(null!==c){var d=this.data,e=c.ga;null!==d&&e instanceof Y&&e.DB(d,e.Cb(null!==a?a.data:null))}d=this.QE;null!==d&&(e=!0,null!==c&&(e=c.ab,c.ab=!0),d(this,b,a),null!==c&&(c.ab=e));if(this instanceof I)for(c=new L(F),Ih(c,this,!0,0,!0),c=c.j;c.next();)if(d=c.value,d instanceof G)for(d=d.Gd;d.next();)un(d.value);if(this instanceof G)for(d=this.Gd;d.next();)un(d.value);this.i("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&tl(b,-1,a))}}else D.k("cannot set the Part.containingGroup of a Link or Adornment")});
f=F.prototype;f.rm=function(){var a=this.Pa;null!==a&&(a.K(),null!==a.Qb&&a.Qb.K(),a.fg())};f.qa=function(){var a=this.g;null!==a&&!Im(this)&&!Jm(this)&&this.isVisible()&&this.ac.F()&&a.qa(sl(this,this.ac))};f.K=function(){x.prototype.K.call(this);var a=this.g;null!==a&&(a.Cg.add(this),this instanceof G&&null!==this.zc&&Wo(this.zc),a.Se(!0))};f.ru=function(a){a||(a=this.ql,null!==a&&qr(a,this))};f.su=function(a){a||(a=this.ql,null!==a&&pr(a,this))};
f.Mn=function(){var a=this.data;if(null!==a){var b=this.g;null!==b&&(b=b.ga,null!==b&&b.yy(a))}};D.defineProperty(F,{QE:"containingGroupChanged"},function(){return this.rr},function(a){var b=this.rr;b!==a&&(null!==a&&D.h(a,"function",F,"containingGroupChanged"),this.rr=a,this.i("containingGroupChanged",b,a))});F.prototype.findSubGraphLevel=function(){return rr(this,this)};function rr(a,b){var c=b.Pa;return null!==c?1+rr(a,c):b instanceof G&&(c=b.zc,null!==c)?rr(a,c):0}
F.prototype.findTopLevelPart=function(){return sr(this,this)};function sr(a,b){var c=b.Pa;return null!==c?sr(a,c):b instanceof G&&(c=b.zc,null!==c)?sr(a,c):b}D.w(F,{zq:"isTopLevel"},function(){return null!==this.Pa||this instanceof G&&this.tf?!1:!0});F.prototype.isMemberOf=F.prototype.Ei=function(a){return a instanceof I?tr(this,this,a):!1};function tr(a,b,c){if(b===c||null===c)return!1;var d=b.Pa;return null===d||d!==c&&!tr(a,d,c)?b instanceof G&&(b=b.zc,null!==b)?tr(a,b,c):!1:!0}
F.prototype.findCommonContainingGroup=F.prototype.CI=function(a){if(null===a)return null;v&&D.l(a,F,F,"findCommonContainingGroup:other");if(this===a)return this.Pa;for(var b=this;null!==b;)b instanceof I&&or(b,!0),b=b.Pa;for(var c=null,b=a;null!==b;){if(0!==(b.S&1048576)){c=b;break}b=b.Pa}for(b=this;null!==b;)b instanceof I&&or(b,!1),b=b.Pa;return c};
D.defineProperty(F,{qJ:"layoutConditions"},function(){return this.qs},function(a){var b=this.qs;b!==a&&(v&&D.h(a,"number",F,"layoutConditions"),this.qs=a,this.i("layoutConditions",b,a))});F.prototype.canLayout=function(){if(!this.$A||!this.isVisible())return!1;var a=this.layer;return null!==a&&a.Tc||this instanceof G&&this.tf?!1:!0};
F.prototype.invalidateLayout=F.prototype.N=function(a){void 0===a&&(a=16777215);var b;this.$A&&0!==(a&this.qJ)?(b=this.layer,null!==b&&b.Tc||this instanceof G&&this.tf?b=!1:(b=this.g,b=null!==b&&b.ra.nb?!1:!0)):b=!1;if(b)if(b=this.ql,null!==b){var c=b.Vb;null!==c?c.N():b.N(a)}else a=this.g,null!==a&&(c=a.Vb,null!==c&&c.N())};function Vm(a){if(!a.isVisible())return!1;a=a.layer;return null!==a&&a.Tc?!1:!0}
D.defineProperty(F,{cF:"dragComputation"},function(){return this.Lr},function(a){var b=this.Lr;b!==a&&(null!==a&&D.h(a,"function",F,"dragComputation"),this.Lr=a,this.i("dragComputation",b,a))});D.defineProperty(F,{iK:"shadowOffset"},function(){return this.tn},function(a){var b=this.tn;b.O(a)||(v&&D.l(a,O,F,"shadowOffset"),this.tn=a=a.V(),this.qa(),this.i("shadowOffset",b,a))});
D.defineProperty(F,{shadowColor:"shadowColor"},function(){return this.sn},function(a){var b=this.sn;b!==a&&(v&&D.h(a,"string",F,"shadowColor"),this.sn=a,this.qa(),this.i("shadowColor",b,a))});D.defineProperty(F,{shadowBlur:"shadowBlur"},function(){return this.Lg},function(a){var b=this.Lg;b!==a&&(v&&D.h(a,"number",F,"shadowBlur"),this.Lg=a,this.qa(),this.i("shadowBlur",b,a))});
function da(a){0===arguments.length?F.call(this,Xj):F.call(this,a);this.S&=-257;this.El="Adornment";this.Pc=null;this.FD=0;this.vE=!1;this.Qb=this.ph=null}D.Sa(da,F);D.ja("Adornment",da);da.prototype.toString=function(){var a=this.Zf;return"Adornment("+this.Dd+")"+(null!==a?a.toString():"")};da.prototype.updateRelationshipsFromData=function(){};
da.prototype.Gu=function(a){var b=this.zb.Y,c=this.zb;if(b instanceof J&&c instanceof z){var d=b.path,c=d.Df;b.Gu(a);c=d.Df;a=this.xa.o;b=a.length;for(d=0;d<b;d++){var e=a[d];e.Gf&&e instanceof z&&(e.ob=c)}}};D.w(da,{placeholder:"placeholder"},function(){return this.Qb});
D.defineProperty(da,{zb:"adornedObject"},function(){return this.Pc},function(a){v&&null!==a&&D.l(a,P,F,"adornedObject:value");var b=this.Zf,c=null;null!==a&&(c=a.Y);null===b||null!==a&&b===c||b.Tj(this.Dd);this.Pc=a;null!==c&&c.Ul(this.Dd,this)});D.w(da,{Zf:"adornedPart"},function(){var a=this.Pc;return null!==a?a.Y:null});da.prototype.um=function(){var a=this.Pc;if(null===a)return!0;a=a.Y;return null===a||!Im(a)};da.prototype.oe=function(){return!1};D.w(da,{Pa:"containingGroup"},function(){return null});
da.prototype.po=function(a,b,c,d,e,g,h){if(a===mg&&"elements"===b)if(e instanceof Rj){var k=e;null===this.Qb?this.Qb=k:this.Qb!==k&&D.k("Cannot insert a second Placeholder into the visual tree of an Adornment.")}else e instanceof x&&(k=e.gu(function(a){return a instanceof Rj}),k instanceof Rj&&(null===this.Qb?this.Qb=k:this.Qb!==k&&D.k("Cannot insert a second Placeholder into the visual tree of an Adornment.")));else a===ng&&"elements"===b&&null!==this.Qb&&(d===this.Qb?this.Qb=null:d instanceof x&&
this.Qb.tm(d)&&(this.Qb=null));F.prototype.po.call(this,a,b,c,d,e,g,h)};da.prototype.updateAdornments=function(){};da.prototype.Mn=function(){};function G(a){F.call(this,a);this.Ba=13;this.uc=new K(J);this.Kt=this.rp=this.Gl=this.ss=this.rs=null;this.kr=Vd;this.xe=this.Xh=null;this.Ys=ur;this.Hk=!1}D.Sa(G,F);D.ja("Node",G);
G.prototype.cloneProtected=function(a){F.prototype.cloneProtected.call(this,a);a.Ba=this.Ba;a.Ba=this.Ba&-17;a.rs=this.rs;a.ss=this.ss;a.Gl=this.Gl;a.Kt=this.Kt;a.kr=this.kr.V();a.Ys=this.Ys};G.prototype.Bi=function(a){F.prototype.Bi.call(this,a);a.fg();a.Xh=this.Xh;a.xe=null};var vr;G.DirectionDefault=vr=D.s(G,"DirectionDefault",0);G.DirectionAbsolute=D.s(G,"DirectionAbsolute",1);var wr;G.DirectionRotatedNode=wr=D.s(G,"DirectionRotatedNode",2);var Co;
G.DirectionRotatedNodeOrthogonal=Co=D.s(G,"DirectionRotatedNodeOrthogonal",3);G.SpreadingNone=D.s(G,"SpreadingNone",10);var ur;G.SpreadingEvenly=ur=D.s(G,"SpreadingEvenly",11);var xr;G.SpreadingPacked=xr=D.s(G,"SpreadingPacked",12);function yr(a,b){null!==b&&(null===a.Xh&&(a.Xh=new L(Dl)),a.Xh.add(b))}
function zr(a,b,c,d){if(null===b||null===a.Xh)return null;for(var e=a.Xh.j;e.next();){var g=e.value;if(g.Eq===a&&g.Lu===b&&g.py===c&&g.qy===d||g.Eq===b&&g.Lu===a&&g.py===d&&g.qy===c)return g}return null}G.prototype.invalidateLinkBundle=function(a,b,c){if(void 0===b||null===b)b="";if(void 0===c||null===c)c="";a=zr(this,a,b,c);null!==a&&a.wq()};
G.prototype.po=function(a,b,c,d,e,g,h){a===mg&&"elements"===b?this.xe=null:a===ng&&"elements"===b&&(null===this.g?this.xe=null:d instanceof P&&dp(this,d,function(a,b){ap(a,b,!0)}));F.prototype.po.call(this,a,b,c,d,e,g,h)};G.prototype.invalidateConnectedLinks=G.prototype.fg=function(a){void 0===a&&(a=null);for(var b=this.Gd;b.next();){var c=b.value;null!==a&&a.contains(c)||(Ar(this,c.dd),Ar(this,c.Ld),c.fc())}};
function No(a,b){for(var c=a.Gd;c.next();){var d=c.value;if(d.dd===b||d.Ld===b)Ar(a,d.dd),Ar(a,d.Ld),d.fc()}}function Ar(a,b){if(null!==b){var c=b.Xs;null!==c&&c.wq();c=a.Pa;null===c||c.Je||Ar(c,c.km(""))}}G.prototype.um=function(){return!0};D.defineProperty(G,{QJ:"portSpreading"},function(){return this.Ys},function(a){var b=this.Ys;b!==a&&(v&&D.Ca(a,G,G,"portSpreading"),this.Ys=a,this.i("portSpreading",b,a),a=this.g,null!==a&&a.ra.nb||this.fg())});
D.defineProperty(G,{qA:"avoidable"},function(){return 0!==(this.Ba&8)},function(a){var b=0!==(this.Ba&8);if(b!==a){v&&D.h(a,"boolean",G,"avoidable");this.Ba^=8;var c=this.g;null!==c&&Mn(c,this);this.i("avoidable",b,a)}});D.defineProperty(G,{TH:"avoidableMargin"},function(){return this.kr},function(a){"number"===typeof a?a=new Hb(a):D.l(a,Hb,G,"avoidableMargin");var b=this.kr;if(!b.O(a)){this.kr=a=a.V();var c=this.g;null!==c&&Mn(c,this);this.i("avoidableMargin",b,a)}});
G.prototype.getAvoidableRect=function(a){a.set(this.$);a.ix(this.TH);return a};G.prototype.findVisibleNode=function(){for(var a=this;null!==a&&!a.isVisible();)a=a.Pa;return a};
G.prototype.isVisible=function(){if(!F.prototype.isVisible.call(this))return!1;var a=!0,b=zl,c=this.g;if(null!==c){a=c.Xa;if(a.sf&&(a=a.gn.oa(this),null!==a&&a.vy))return!0;a=c.$d;b=c.VB}if(b===zl){if(c=this.mm(),null!==c&&!c.rd)return!1}else if(b===cn){if(c=a?this.nF():this.oF(),0<c.count&&c.all(function(a){return!a.rd}))return!1}else if(b===dn&&(c=a?this.nF():this.oF(),0<c.count&&c.any(function(a){return!a.rd})))return!1;c=this.zc;return null!==c?c.isVisible():!0};
G.prototype.Hd=function(a){F.prototype.Hd.call(this,a);for(var b=this.Gd;b.next();)b.value.Hd(a)};D.w(G,{Gd:"linksConnected"},function(){return this.uc.j});G.prototype.findLinksConnected=G.prototype.lF=function(a){void 0===a&&(a=null);if(null===a)return this.uc.j;v&&D.h(a,"string",G,"findLinksConnected:pid");var b=new Na(this.uc),c=this;b.Fq=function(b){return b.aa===c&&b.cg===a||b.da===c&&b.jh===a};return b};
G.prototype.findLinksOutOf=G.prototype.Hx=function(a){void 0===a&&(a=null);v&&null!==a&&D.h(a,"string",G,"findLinksOutOf:pid");var b=new Na(this.uc),c=this;b.Fq=function(b){return b.aa!==c?!1:null===a?!0:b.cg===a};return b};G.prototype.findLinksInto=G.prototype.Vg=function(a){void 0===a&&(a=null);v&&null!==a&&D.h(a,"string",G,"findLinksInto:pid");var b=new Na(this.uc),c=this;b.Fq=function(b){return b.da!==c?!1:null===a?!0:b.jh===a};return b};
G.prototype.findNodesConnected=G.prototype.mF=function(a){void 0===a&&(a=null);v&&null!==a&&D.h(a,"string",G,"findNodesConnected:pid");for(var b=null,c=null,d=this.uc.j;d.next();){var e=d.value;if(e.aa===this){if(null===a||e.cg===a)e=e.da,null!==b?b.add(e):null!==c&&c!==e?(b=new L(G),b.add(c),b.add(e)):c=e}else e.da!==this||null!==a&&e.jh!==a||(e=e.aa,null!==b?b.add(e):null!==c&&c!==e?(b=new L(G),b.add(c),b.add(e)):c=e)}return null!==b?b.j:null!==c?new La(c):Ka};
G.prototype.findNodesOutOf=G.prototype.oF=function(a){void 0===a&&(a=null);v&&null!==a&&D.h(a,"string",G,"findNodesOutOf:pid");for(var b=null,c=null,d=this.uc.j;d.next();){var e=d.value;e.aa!==this||null!==a&&e.cg!==a||(e=e.da,null!==b?b.add(e):null!==c&&c!==e?(b=new L(G),b.add(c),b.add(e)):c=e)}return null!==b?b.j:null!==c?new La(c):Ka};
G.prototype.findNodesInto=G.prototype.nF=function(a){void 0===a&&(a=null);v&&null!==a&&D.h(a,"string",G,"findNodesInto:pid");for(var b=null,c=null,d=this.uc.j;d.next();){var e=d.value;e.da!==this||null!==a&&e.jh!==a||(e=e.aa,null!==b?b.add(e):null!==c&&c!==e?(b=new L(G),b.add(c),b.add(e)):c=e)}return null!==b?b.j:null!==c?new La(c):Ka};
G.prototype.findLinksBetween=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);v&&(D.l(a,G,G,"findLinksBetween:othernode"),null!==b&&D.h(b,"string",G,"findLinksBetween:pid"),null!==c&&D.h(c,"string",G,"findLinksBetween:otherpid"));var d=new Na(this.uc),e=this;d.Fq=function(d){return(d.aa!==e||d.da!==a||null!==b&&d.cg!==b||null!==c&&d.jh!==c)&&(d.aa!==a||d.da!==e||null!==c&&d.cg!==c||null!==b&&d.jh!==b)?!1:!0};return d};
G.prototype.findLinksTo=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);v&&(D.l(a,G,G,"findLinksTo:othernode"),null!==b&&D.h(b,"string",G,"findLinksTo:pid"),null!==c&&D.h(c,"string",G,"findLinksTo:otherpid"));var d=new Na(this.uc),e=this;d.Fq=function(d){return d.aa!==e||d.da!==a||null!==b&&d.cg!==b||null!==c&&d.jh===c?!1:!0};return d};
D.defineProperty(G,{sJ:"linkConnected"},function(){return this.rs},function(a){var b=this.rs;b!==a&&(null!==a&&D.h(a,"function",G,"linkConnected"),this.rs=a,this.i("linkConnected",b,a))});D.defineProperty(G,{tJ:"linkDisconnected"},function(){return this.ss},function(a){var b=this.ss;b!==a&&(null!==a&&D.h(a,"function",G,"linkDisconnected"),this.ss=a,this.i("linkDisconnected",b,a))});
D.defineProperty(G,{gy:"linkValidation"},function(){return this.Gl},function(a){var b=this.Gl;b!==a&&(null!==a&&D.h(a,"function",G,"linkValidation"),this.Gl=a,this.i("linkValidation",b,a))});
function Br(a,b,c){Ar(a,c);if(!a.uc.contains(b)){a.uc.add(b);var d=a.sJ;if(null!==d){var e=!0,g=a.g;null!==g&&(e=g.ab,g.ab=!0);d(a,b,c);null!==g&&(g.ab=e)}b.Uc&&(c=b.aa,b=b.da,null!==c&&null!==b&&c!==b&&(d=!0,g=a.g,null!==g&&(d=g.$d),a=d?b:c,e=d?c:b,a.Hk||(a.Hk=e),!e.Mj||null!==g&&g.ra.nb||(d?c===e&&(e.Mj=!1):b===e&&(e.Mj=!1))))}}
function Cr(a,b,c){Ar(a,c);if(a.uc.remove(b)){var d=a.tJ,e=a.g;if(null!==d){var g=!0;null!==e&&(g=e.ab,e.ab=!0);d(a,b,c);null!==e&&(e.ab=g)}b.Uc&&(c=!0,null!==e&&(c=e.$d),a=c?b.da:b.aa,b=c?b.aa:b.da,null!==a&&(a.Hk=!1),null===b||b.Mj||(0===b.uc.count?(b.Hk=null,null!==e&&e.ra.nb||(b.Mj=!0)):Gn(b)))}}
function Gn(a){a.Hk=!1;if(0!==a.uc.count){var b=!0,c=a.g;if(null===c||!c.ra.nb){null!==c&&(b=c.$d);for(c=a.uc.j;c.next();){var d=c.value;if(d.Uc)if(b){if(d.aa===a){a.Mj=!1;return}}else if(d.da===a){a.Mj=!1;return}}a.Mj=!0}}}
G.prototype.updateRelationshipsFromData=function(){F.prototype.updateRelationshipsFromData.call(this);var a=this.data;if(null!==a){var b=this.g;if(null!==b){var c=b.ga;c instanceof wg&&(a=c.Un(a),a=b.Qe(a),c=this.mm(),a!==c&&(c=this.Pn(),null!==a?null!==c?b.$d?c.aa=a:c.da=a:jn(b,a,this):null!==c&&Ym(b,c,!1)))}}};G.prototype.ru=function(a){F.prototype.ru.call(this,a);a||(Gn(this),a=this.rp,null!==a&&Dr(a,this))};
G.prototype.su=function(a){F.prototype.su.call(this,a);a||(a=this.rp,null!==a&&null!==a.zf&&(a.zf.remove(this),a.K()))};G.prototype.Mn=function(){if(0<this.uc.count){var a=this.g;if(null!==a)for(var b=a.wb.bF,c=this.uc.copy().j;c.next();){var d=c.value;b?a.remove(d):(d.aa===this&&(d.aa=null),d.da===this&&(d.da=null))}}this.zc=null;F.prototype.Mn.call(this)};D.w(G,{tf:"isLinkLabel"},function(){return null!==this.rp});
D.defineProperty(G,{zc:"labeledLink"},function(){return this.rp},function(a){var b=this.rp;if(b!==a){v&&null!==a&&D.l(a,J,G,"labeledLink");var c=this.g,d=this.data;if(null!==b&&(null!==b.zf&&(b.zf.remove(this),b.K()),null!==c&&null!==d&&!c.ra.nb)){var e=b.data,g=c.ga;if(null!==e&&g instanceof Y){var h=g.Cb(d);void 0!==h&&g.VJ(e,h)}}this.rp=a;null!==a&&(Dr(a,this),null===c||null===d||c.ra.nb||(e=a.data,g=c.ga,null!==e&&g instanceof Y&&(h=g.Cb(d),void 0!==h&&g.CE(e,h))));Wo(this);this.i("labeledLink",
b,a)}});G.prototype.findPort=G.prototype.km=function(a){v&&D.h(a,"string",G,"findPort:pid");if(null===this.xe){if(""===a&&!1===this.Uk)return this;bp(this)}var b=this.xe.oa(a);return null!==b||""!==a&&(b=this.xe.oa(""),null!==b)?b:this};D.w(G,{port:"port"},function(){return this.km("")});D.w(G,{ports:"ports"},function(){null===this.xe&&bp(this);return this.xe.YF});
function bp(a){null===a.xe?a.xe=new ma("string",P):a.xe.clear();dp(a,a,function(a,c){var d=c.sd;null!==d&&a.xe.add(d,c)});0===a.xe.count&&a.xe.add("",a)}function ap(a,b,c){var d=b.sd;if(null!==d&&(null!==a.xe&&a.xe.remove(d),b=a.g,null!==b&&c)){c=null;for(d=a.lF(d);d.next();)a=d.value,null===c&&(c=D.tb()),c.push(a);if(null!==c){for(d=0;d<c.length;d++)a=c[d],b.remove(a);D.Aa(c)}}}
G.prototype.isInTreeOf=function(a){if(null===a||a===this)return!1;var b=!0,c=this.g;null!==c&&(b=c.$d);c=this;if(b)for(;c!==a;){for(var b=null,d=c.uc.j;d.next();){var e=d.value;if(e.Uc&&(b=e.aa,b!==c&&b!==this))break}if(b===this||null===b||b===c)return!1;c=b}else for(;c!==a;){b=null;for(d=c.uc.j;d.next()&&(e=d.value,!e.Uc||(b=e.da,b===c||b===this)););if(b===this||null===b||b===c)return!1;c=b}return!0};
G.prototype.findTreeRoot=function(){var a=!0,b=this.g;null!==b&&(a=b.$d);b=this;if(a)for(;;){for(var a=null,c=b.uc.j;c.next();){var d=c.value;if(d.Uc&&(a=d.aa,a!==b&&a!==this))break}if(a===this)return this;if(null===a||a===b)return b;b=a}else for(;;){a=null;for(c=b.uc.j;c.next()&&(d=c.value,!d.Uc||(a=d.da,a===b||a===this)););if(a===this)return this;if(null===a||a===b)return b;b=a}};
G.prototype.findCommonTreeParent=function(a){if(null===a)return null;v&&D.l(a,G,G,"findCommonTreeParent:other");if(this===a)return this;for(var b=this;null!==b;)or(b,!0),b=b.mm();for(var c=null,b=a;null!==b;){if(0!==(b.S&1048576)){c=b;break}b=b.mm()}for(b=this;null!==b;)or(b,!1),b=b.mm();return c};
G.prototype.findTreeParentLink=G.prototype.Pn=function(){var a=!0,b=this.g;null!==b&&(a=b.$d);b=this.uc.j;if(a)for(;b.next();){if(a=b.value,a.Uc&&a.aa!==this)return a}else for(;b.next();)if(a=b.value,a.Uc&&a.da!==this)return a;return null};
G.prototype.findTreeParentNode=G.prototype.mm=function(){var a=this.Hk;if(null===a)return null;if(a instanceof G)return a;var b=!0,a=this.g;null!==a&&(b=a.$d);a=this.uc.j;if(b)for(;a.next();){if(b=a.value,b.Uc&&(b=b.aa,b!==this))return this.Hk=b}else for(;a.next();)if(b=a.value,b.Uc&&(b=b.da,b!==this))return this.Hk=b;return this.Hk=null};G.prototype.findTreeParentChain=function(){function a(b,d){if(null!==b){d.add(b);var e=b.Pn();null!==e&&(d.add(e),a(b.mm(),d))}}var b=new L(F);a(this,b);return b};
G.prototype.findTreeLevel=function(){return Er(this,this)};function Er(a,b){var c=b.mm();return null===c?0:1+Er(a,c)}G.prototype.findTreeChildrenLinks=G.prototype.Jx=function(){var a=!0,b=this.g;null!==b&&(a=b.$d);var b=new Na(this.uc),c=this;b.Fq=a?function(a){return a.Uc&&a.aa===c?!0:!1}:function(a){return a.Uc&&a.da===c?!0:!1};return b};
G.prototype.findTreeChildrenNodes=G.prototype.qF=function(){var a=!0,b=this.g;null!==b&&(a=b.$d);var c=b=null,d=this.uc.j;if(a)for(;d.next();)a=d.value,a.Uc&&a.aa===this&&(a=a.da,null!==b?b.add(a):null!==c&&c!==a?(b=new K(G),b.add(c),b.add(a)):c=a);else for(;d.next();)a=d.value,a.Uc&&a.da===this&&(a=a.aa,null!==b?b.add(a):null!==c&&c!==a?(b=new K(G),b.add(c),b.add(a)):c=a);return null!==b?b.j:null!==c?new La(c):Ka};
G.prototype.findTreeParts=function(a){void 0===a&&(a=Infinity);D.h(a,"number",G,"findTreeParts:level");var b=new L(F);Ih(b,this,!1,a,!0);return b};G.prototype.collapseTree=G.prototype.collapseTree=function(a){void 0===a&&(a=1);D.p(a,G,"collapseTree:level");1>a&&(a=1);var b=this.g;if(null!==b&&!b.Oh){b.Oh=!0;var c=new L(G);c.add(this);Fr(this,c,b.$d,a,b.Xa,this,b.VB===zl);b.Oh=!1}};
function Fr(a,b,c,d,e,g,h){if(1<d)for(var k=c?a.Hx():a.Vg();k.next();){var l=k.value;l.Uc&&(l=l.PA(a),null===l||l===a||b.contains(l)||(b.add(l),Fr(l,b,c,d-1,e,g,h)))}else Gr(a,b,c,e,g,h)}function Gr(a,b,c,d,e,g){for(var h=e===a?!0:a.rd,k=c?a.Hx():a.Vg();k.next();){var l=k.value;l.Uc&&(l=l.PA(a),null===l||l===a||b.contains(l)||(b.add(l),h&&(g&&ll(d,l,e),l.rm(),l.Hd(!1)),l.rd&&(l.iv=l.rd,Gr(l,b,c,d,e,g))))}a.rd=!1}
G.prototype.expandTree=G.prototype.expandTree=function(a){void 0===a&&(a=2);D.p(a,G,"expandTree:level");2>a&&(a=2);var b=this.g;if(null!==b&&!b.Oh){b.Oh=!0;var c=new L(G);c.add(this);Hr(this,c,b.$d,a,b.Xa,this,b.VB===zl);b.Oh=!1}};function Hr(a,b,c,d,e,g,h){for(var k=g===a?!1:a.rd,l=c?a.Hx():a.Vg();l.next();){var m=l.value;m.Uc&&(k||m.lh||m.fc(),m=m.PA(a),null!==m&&m!==a&&!b.contains(m)&&(b.add(m),k||(m.Hd(!0),m.rm(),h&&kl(e,m,g)),2<d||m.iv))&&(m.iv=!1,Hr(m,b,c,d-1,e,g,h))}a.rd=!0}
D.defineProperty(G,{rd:"isTreeExpanded"},function(){return 0!==(this.Ba&1)},function(a){var b=0!==(this.Ba&1);if(b!==a){v&&D.h(a,"boolean",G,"isTreeExpanded");this.Ba^=1;var c=this.g;this.i("isTreeExpanded",b,a);b=this.vK;if(null!==b){var d=!0;null!==c&&(d=c.ab,c.ab=!0);b(this);null!==c&&(c.ab=d)}null!==c&&c.ra.nb?this.Hd(a):a?this.expandTree():this.collapseTree()}});
D.defineProperty(G,{iv:"wasTreeExpanded"},function(){return 0!==(this.Ba&2)},function(a){var b=0!==(this.Ba&2);b!==a&&(v&&D.h(a,"boolean",G,"wasTreeExpanded"),this.Ba^=2,this.i("wasTreeExpanded",b,a))});D.defineProperty(G,{vK:"treeExpandedChanged"},function(){return this.Kt},function(a){var b=this.Kt;b!==a&&(null!==a&&D.h(a,"function",G,"treeExpandedChanged"),this.Kt=a,this.i("treeExpandedChanged",b,a))});
D.defineProperty(G,{Mj:"isTreeLeaf"},function(){return 0!==(this.Ba&4)},function(a){var b=0!==(this.Ba&4);b!==a&&(v&&D.h(a,"boolean",G,"isTreeLeaf"),this.Ba^=4,this.i("isTreeLeaf",b,a))});
function J(){F.call(this,kj);this.dc=8;this.yg=null;this.ci="";this.Pg=this.Vr=null;this.xi="";this.Jt=null;this.cr=nj;this.xr=0;this.Ar=nj;this.Br=NaN;this.mn=Ir;this.wt=.5;this.zf=null;this.ad=(new K(O)).freeze();this.ph=this.NC=this.HC=this.Mi=this.Yi=this.ob=this.Iw=this.Jp=this.cf=null;this.dA=new O;this.Z=this.gE=this.fE=null}D.Sa(J,F);D.ja("Link",J);
J.prototype.cloneProtected=function(a){F.prototype.cloneProtected.call(this,a);a.dc=this.dc&-113;a.ci=this.ci;a.Vr=this.Vr;a.xi=this.xi;a.Jt=this.Jt;a.cr=this.cr;a.xr=this.xr;a.Ar=this.Ar;a.Br=this.Br;a.mn=this.mn;a.wt=this.wt;null!==this.Z&&(a.Z=this.Z.copy())};J.prototype.Bi=function(a){F.prototype.Bi.call(this,a);this.ci=a.ci;this.xi=a.xi;a.cf=null;a.fc();a.Mi=this.Mi};
J.prototype.nc=function(a){a.Ne===J?2===(a.value&2)?this.Ay=a:a===Nj||a===mj||a===lj?this.gf=a:a===Jr||a===Kr||a===Lr?this.St=a:a!==Ir&&a!==nj&&D.k("Unknown Link enum value for a Link property: "+a):F.prototype.nc.call(this,a)};var Ir;J.Normal=Ir=D.s(J,"Normal",1);J.Orthogonal=D.s(J,"Orthogonal",2);J.AvoidsNodes=D.s(J,"AvoidsNodes",6);var Mr;J.AvoidsNodesStraight=Mr=D.s(J,"AvoidsNodesStraight",7);var nj;J.None=nj=D.s(J,"None",0);var Nj;J.Bezier=Nj=D.s(J,"Bezier",9);var mj;
J.JumpGap=mj=D.s(J,"JumpGap",10);var lj;J.JumpOver=lj=D.s(J,"JumpOver",11);var Jr;J.End=Jr=D.s(J,"End",17);var Kr;J.Scale=Kr=D.s(J,"Scale",18);var Lr;J.Stretch=Lr=D.s(J,"Stretch",19);var sq;J.OrientAlong=sq=D.s(J,"OrientAlong",21);var Tp;J.OrientPlus90=Tp=D.s(J,"OrientPlus90",22);var Vp;J.OrientMinus90=Vp=D.s(J,"OrientMinus90",23);var Lq;J.OrientOpposite=Lq=D.s(J,"OrientOpposite",24);var Mq;J.OrientUpright=Mq=D.s(J,"OrientUpright",25);var Up;J.OrientPlus90Upright=Up=D.s(J,"OrientPlus90Upright",26);
var Wp;J.OrientMinus90Upright=Wp=D.s(J,"OrientMinus90Upright",27);var Xp;J.OrientUpright45=Xp=D.s(J,"OrientUpright45",28);f=J.prototype;f.Wd=function(){null===this.Z&&(this.Z=new Bo)};f.um=function(){var a=this.aa;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(Im(a)||Jm(a))return!1}a=this.da;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),Im(a)||Jm(a))?!1:!0};f.FB=function(){return!1};f.GB=function(){};f.oe=function(){return!1};
J.prototype.computeAngle=function(a,b,c){a=0;switch(b){default:case nj:a=0;break;case sq:a=c;break;case Tp:a=c+90;break;case Vp:a=c-90;break;case Lq:a=c+180;break;case Mq:a=Ye(c);90<a&&270>a&&(a-=180);break;case Up:a=Ye(c+90);90<a&&270>a&&(a-=180);break;case Wp:a=Ye(c-90);90<a&&270>a&&(a-=180);break;case Xp:a=Ye(c);if(45<a&&135>a||225<a&&315>a)return 0;90<a&&270>a&&(a-=180)}return Ye(a)};
D.defineProperty(J,{aa:"fromNode"},function(){return this.yg},function(a){var b=this.yg;if(b!==a){v&&null!==a&&D.l(a,G,J,"fromNode");var c=this.dd;null!==b&&(this.Pg!==b&&Cr(b,this,c),Nr(this),this.N(Zm));this.yg=a;null!==a&&this.Hd(a.isVisible());this.Yi=null;this.fc();var d=this.g;if(null!==d){var e=this.data,g=d.ga;if(null!==e)if(g instanceof Y){var h=null!==a?a.data:null;g.BB(e,g.Cb(h))}else g instanceof wg&&(h=null!==a?a.data:null,d.$d?g.Hi(e,g.Cb(h)):(null!==b&&g.Hi(b.data,void 0),g.Hi(h,g.Cb(null!==
this.Pg?this.Pg.data:null))))}e=this.dd;g=this.tF;null!==g&&(h=!0,null!==d&&(h=d.ab,d.ab=!0),g(this,c,e),null!==d&&(d.ab=h));null!==a&&(this.Pg!==a&&Br(a,this,e),Or(this),this.N(Qm));this.i("fromNode",b,a);un(this)}});
D.defineProperty(J,{cg:"fromPortId"},function(){return this.ci},function(a){var b=this.ci;if(b!==a){v&&D.h(a,"string",J,"fromPortId");var c=this.dd;null!==c&&Ar(this.aa,c);Nr(this);this.ci=a;var d=this.dd;null!==d&&Ar(this.aa,d);var e=this.g;if(null!==e){var g=this.data,h=e.ga;null!==g&&h instanceof Y&&h.CB(g,a)}c!==d&&(this.Yi=null,this.fc(),g=this.tF,null!==g&&(h=!0,null!==e&&(h=e.ab,e.ab=!0),g(this,c,d),null!==e&&(e.ab=h)));Or(this);this.i("fromPortId",b,a)}});
D.w(J,{dd:"fromPort"},function(){var a=this.yg;return null===a?null:a.km(this.ci)});D.defineProperty(J,{tF:"fromPortChanged"},function(){return this.Vr},function(a){var b=this.Vr;b!==a&&(null!==a&&D.h(a,"function",J,"fromPortChanged"),this.Vr=a,this.i("fromPortChanged",b,a))});
D.defineProperty(J,{da:"toNode"},function(){return this.Pg},function(a){var b=this.Pg;if(b!==a){v&&null!==a&&D.l(a,G,J,"toNode");var c=this.Ld;null!==b&&(this.yg!==b&&Cr(b,this,c),Nr(this),this.N(Zm));this.Pg=a;null!==a&&this.Hd(a.isVisible());this.Yi=null;this.fc();var d=this.g;if(null!==d){var e=this.data,g=d.ga;if(null!==e)if(g instanceof Y){var h=null!==a?a.data:null;g.HB(e,g.Cb(h))}else g instanceof wg&&(h=null!==a?a.data:null,d.$d?(null!==b&&g.Hi(b.data,void 0),g.Hi(h,g.Cb(null!==this.yg?this.yg.data:
null))):g.Hi(e,g.Cb(h)))}e=this.Ld;g=this.aH;null!==g&&(h=!0,null!==d&&(h=d.ab,d.ab=!0),g(this,c,e),null!==d&&(d.ab=h));null!==a&&(this.yg!==a&&Br(a,this,e),Or(this),this.N(Qm));this.i("toNode",b,a);un(this)}});
D.defineProperty(J,{jh:"toPortId"},function(){return this.xi},function(a){var b=this.xi;if(b!==a){v&&D.h(a,"string",J,"toPortId");var c=this.Ld;null!==c&&Ar(this.da,c);Nr(this);this.xi=a;var d=this.Ld;null!==d&&Ar(this.da,d);var e=this.g;if(null!==e){var g=this.data,h=e.ga;null!==g&&h instanceof Y&&h.IB(g,a)}c!==d&&(this.Yi=null,this.fc(),g=this.aH,null!==g&&(h=!0,null!==e&&(h=e.ab,e.ab=!0),g(this,c,d),null!==e&&(e.ab=h)));Or(this);this.i("toPortId",b,a)}});
D.w(J,{Ld:"toPort"},function(){var a=this.Pg;return null===a?null:a.km(this.xi)});D.defineProperty(J,{aH:"toPortChanged"},function(){return this.Jt},function(a){var b=this.Jt;b!==a&&(null!==a&&D.h(a,"function",J,"toPortChanged"),this.Jt=a,this.i("toPortChanged",b,a))});D.defineProperty(J,{Gb:"fromSpot"},function(){return null!==this.Z?this.Z.jk:Tc},function(a){this.Wd();var b=this.Z.jk;b.O(a)||(v&&D.l(a,R,J,"fromSpot"),a=a.V(),this.Z.jk=a,this.i("fromSpot",b,a),this.fc())});
D.defineProperty(J,{nm:"fromEndSegmentLength"},function(){return null!==this.Z?this.Z.hk:NaN},function(a){this.Wd();var b=this.Z.hk;b!==a&&(v&&D.h(a,"number",J,"fromEndSegmentLength"),0>a&&D.ua(a,">= 0",J,"fromEndSegmentLength"),this.Z.hk=a,this.i("fromEndSegmentLength",b,a),this.fc())});
D.defineProperty(J,{nu:"fromEndSegmentDirection"},function(){return null!==this.Z?this.Z.gk:vr},function(a){this.Wd();var b=this.Z.gk;b!==a&&(D.Nn("Link.fromEndSegmentDirection","2.0"),v&&D.Ca(a,G,J,"fromEndSegmentDirection"),this.Z.gk=a,this.i("fromEndSegmentDirection",b,a),this.fc())});
D.defineProperty(J,{ou:"fromShortLength"},function(){return null!==this.Z?this.Z.ik:NaN},function(a){this.Wd();var b=this.Z.ik;b!==a&&(v&&D.h(a,"number",J,"fromShortLength"),this.Z.ik=a,this.i("fromShortLength",b,a),this.fc())});D.defineProperty(J,{Hb:"toSpot"},function(){return null!==this.Z?this.Z.Gk:Tc},function(a){this.Wd();var b=this.Z.Gk;b.O(a)||(v&&D.l(a,R,J,"toSpot"),a=a.V(),this.Z.Gk=a,this.i("toSpot",b,a),this.fc())});
D.defineProperty(J,{Dm:"toEndSegmentLength"},function(){return null!==this.Z?this.Z.Ek:NaN},function(a){this.Wd();var b=this.Z.Ek;b!==a&&(v&&D.h(a,"number",J,"toEndSegmentLength"),0>a&&D.ua(a,">= 0",J,"toEndSegmentLength"),this.Z.Ek=a,this.i("toEndSegmentLength",b,a),this.fc())});
D.defineProperty(J,{fv:"toEndSegmentDirection"},function(){return null!==this.Z?this.Z.Dk:vr},function(a){this.Wd();var b=this.Z.Dk;b!==a&&(D.Nn("Link.toEndSegmentDirection","2.0"),v&&D.Ca(a,G,J,"toEndSegmentDirection"),this.Z.Dk=a,this.i("toEndSegmentDirection",b,a),this.fc())});D.defineProperty(J,{gv:"toShortLength"},function(){return null!==this.Z?this.Z.Fk:NaN},function(a){this.Wd();var b=this.Z.Fk;b!==a&&(v&&D.h(a,"number",J,"toShortLength"),this.Z.Fk=a,this.i("toShortLength",b,a),this.fc())});
function un(a){var b=a.aa,c=a.da;null!==b?null!==c?Pr(a,b.CI(c)):Pr(a,null):Pr(a,null)}function Pr(a,b){var c=a.ql;if(c!==b){null!==c&&pr(c,a);a.ql=b;null!==b&&qr(b,a);var d=a.QE;if(null!==d){var e=!0,g=a.g;null!==g&&(e=g.ab,g.ab=!0);d(a,c,b);null!==g&&(g.ab=e)}!a.lh||a.fE!==c&&a.gE!==c||a.fc()}}J.prototype.rm=function(){var a=this.Pa;null!==a&&this.aa!==a&&this.da!==a&&a.ux&&F.prototype.rm.call(this)};
J.prototype.getOtherNode=J.prototype.PA=function(a){v&&D.l(a,G,J,"getOtherNode:node");var b=this.aa;return a===b?this.da:b};J.prototype.getOtherPort=function(a){v&&D.l(a,P,J,"getOtherPort:port");var b=this.dd;return a===b?this.Ld:b};D.w(J,{IL:"isLabeledLink"},function(){return null===this.zf?!1:0<this.zf.count});D.w(J,{If:"labelNodes"},function(){return null===this.zf?Ka:this.zf.j});function Dr(a,b){null===a.zf&&(a.zf=new L(G));a.zf.add(b);a.K()}
J.prototype.ru=function(a){F.prototype.ru.call(this,a);Qr(this)&&oj(this,this.$);a||(a=this.yg,null!==a&&Br(a,this,this.dd),a=this.Pg,null!==a&&Br(a,this,this.Ld),Or(this))};J.prototype.su=function(a){F.prototype.su.call(this,a);Qr(this)&&oj(this,this.$);a||(a=this.yg,null!==a&&Cr(a,this,this.dd),a=this.Pg,null!==a&&Cr(a,this,this.Ld),Nr(this))};
J.prototype.Mn=function(){this.lh=!0;if(null!==this.zf){var a=this.g;if(null!==a)for(var b=this.zf.copy().j;b.next();)a.remove(b.value)}b=this.data;null!==b&&(a=this.g,null!==a&&(a=a.ga,a instanceof Y?a.xy(b):a instanceof wg&&a.Hi(b,void 0)))};
J.prototype.updateRelationshipsFromData=function(){var a=this.data;if(null!==a){var b=this.g;if(null!==b){var c=b.ga;if(c instanceof Y){var d=c.om(a);this.aa=d=b.Qe(d);d=c.pm(a);this.da=d=b.Qe(d);a=c.Sk(a);if(0<a.length||0<this.If.count){if(1===a.length&&1===this.If.count){var d=a[0],e=this.If.first();if(c.Cb(e.data)===d)return}var d=(new L).Rc(a),g=new L;this.If.each(function(a){null!==a.data&&(a=c.Cb(a.data),void 0!==a&&g.add(a))});a=g.copy();a.wy(d);d=d.copy();d.wy(g);if(0<a.count||0<d.count){var h=
this;a.each(function(a){a=b.Qe(a);null!==a&&a.zc===h&&(a.zc=null)});d.each(function(a){a=b.Qe(a);null!==a&&a.zc!==h&&(a.zc=h)})}}}}}};J.prototype.move=function(a){var b=this.position,c=b.x;isNaN(c)&&(c=0);b=b.y;isNaN(b)&&(b=0);c=a.x-c;b=a.y-b;F.prototype.move.call(this,a);this.wm(c,b);for(a=this.If;a.next();){var d=a.value,e=d.position;d.moveTo(e.x+c,e.y+b)}};
D.defineProperty(J,{TJ:"relinkableFrom"},function(){return 0!==(this.dc&1)},function(a){var b=0!==(this.dc&1);b!==a&&(v&&D.h(a,"boolean",J,"relinkableFrom"),this.dc^=1,this.i("relinkableFrom",b,a),this.ne())});D.defineProperty(J,{UJ:"relinkableTo"},function(){return 0!==(this.dc&2)},function(a){var b=0!==(this.dc&2);b!==a&&(v&&D.h(a,"boolean",J,"relinkableTo"),this.dc^=2,this.i("relinkableTo",b,a),this.ne())});
J.prototype.canRelinkFrom=function(){if(!this.TJ)return!1;var a=this.layer;if(null===a)return!0;if(!a.Cn)return!1;a=a.g;return null===a||a.Cn?!0:!1};J.prototype.canRelinkTo=function(){if(!this.UJ)return!1;var a=this.layer;if(null===a)return!0;if(!a.Cn)return!1;a=a.g;return null===a||a.Cn?!0:!1};D.defineProperty(J,{Vu:"resegmentable"},function(){return 0!==(this.dc&4)},function(a){var b=0!==(this.dc&4);b!==a&&(v&&D.h(a,"boolean",J,"resegmentable"),this.dc^=4,this.i("resegmentable",b,a),this.ne())});
D.defineProperty(J,{Uc:"isTreeLink"},function(){return 0!==(this.dc&8)},function(a){var b=0!==(this.dc&8);b!==a&&(v&&D.h(a,"boolean",J,"isTreeLink"),this.dc^=8,this.i("isTreeLink",b,a),null!==this.aa&&Gn(this.aa),null!==this.da&&Gn(this.da))});D.w(J,{path:"path"},function(){var a=this.Vd();return a instanceof z?a:null});
D.w(J,{qo:"routeBounds"},function(){this.yo();var a=new B;var b=Infinity,c=Infinity,d=this.ta;if(0===d)a.m(NaN,NaN,0,0);else{if(1===d)d=this.n(0),b=Math.min(d.x,b),c=Math.min(d.y,c),a.m(d.x,d.y,0,0);else if(2===d){var e=this.n(0),g=this.n(1),b=Math.min(e.x,g.x),c=Math.min(e.y,g.y);a.m(e.x,e.y,0,0);a.Ki(g)}else if(this.computeCurve()===Nj&&3<=d&&!this.qc)if(e=this.n(0),b=e.x,c=e.y,a.m(b,c,0,0),3===d)d=this.n(1),b=Math.min(d.x,b),c=Math.min(d.y,c),g=this.n(2),b=Math.min(g.x,b),c=Math.min(g.y,c),Ee(e.x,
e.y,d.x,d.y,d.x,d.y,g.x,g.y,.5,a);else for(var h=3;h<d;h+=3){var k=this.n(h-2);h+3>=d&&(h=d-1);var l=this.n(h-1),g=this.n(h);Ee(e.x,e.y,k.x,k.y,l.x,l.y,g.x,g.y,.5,a);b=Math.min(g.x,b);c=Math.min(g.y,c);e=g}else for(e=this.n(0),g=this.n(1),b=Math.min(e.x,g.x),c=Math.min(e.y,g.y),a.m(e.x,e.y,0,0),a.Ki(g),h=2;h<d;h++)e=this.n(h),b=Math.min(e.x,b),c=Math.min(e.y,c),a.Ki(e);this.dA.m(b-a.x,c-a.y)}return this.Iw=a});D.w(J,{eG:"midPoint"},function(){this.yo();return this.computeMidPoint(new O)});
J.prototype.computeMidPoint=function(a){var b=this.ta;if(0===b)return a.assign(le),a;if(1===b)return a.assign(this.n(0)),a;if(2===b){var c=this.n(0),d=this.n(1);a.m((c.x+d.x)/2,(c.y+d.y)/2);return a}if(this.computeCurve()===Nj&&3<=b&&!this.qc){if(3===b)return this.n(1);var c=(b-1)/3|0,e=3*(c/2|0);if(1===c%2){var c=this.n(e),d=this.n(e+1),g=this.n(e+2),e=this.n(e+3),b=d.x,h=d.y,d=g.x,k=g.y,g=(b+d)/2,l=(h+k)/2,h=((c.y+h)/2+l)/2,k=(l+(k+e.y)/2)/2;a.x=(((c.x+b)/2+g)/2+(g+(d+e.x)/2)/2)/2;a.y=(h+k)/2}else a.assign(this.n(e));
return a}e=0;g=D.tb();for(h=0;h<b-1;h++)c=0,c=this.n(h),d=this.n(h+1),yb(c.x,d.x)?(c=d.y-c.y,0>c&&(c=-c)):yb(c.y,d.y)?(c=d.x-c.x,0>c&&(c=-c)):c=Math.sqrt(c.Cf(d)),g.push(c),e+=c;for(d=h=c=0;c<e/2&&h<b;){d=g[h];if(c+d>e/2)break;c+=d;h++}D.Aa(g);b=this.n(h);g=this.n(h+1);b.x===g.x?b.y>g.y?a.m(b.x,b.y-(e/2-c)):a.m(b.x,b.y+(e/2-c)):b.y===g.y?b.x>g.x?a.m(b.x-(e/2-c),b.y):a.m(b.x+(e/2-c),b.y):(c=(e/2-c)/d,a.m(b.x+c*(g.x-b.x),b.y+c*(g.y-b.y)));return a};D.w(J,{dG:"midAngle"},function(){this.yo();return this.computeMidAngle()});
J.prototype.computeMidAngle=function(){var a=this.ta;if(2>a)return NaN;if(this.computeCurve()===Nj&&4<=a&&!this.qc){var b=(a-1)/3|0,c=3*(b/2|0);if(1===b%2){var c=Math.floor(c),b=this.n(c),d=this.n(c+1),a=this.n(c+2),c=this.n(c+3),e=d.x,d=d.y,g=a.x,a=a.y,h=(e+g)/2,k=(d+a)/2;return sb(((b.x+e)/2+h)/2,((b.y+d)/2+k)/2,(h+(g+c.x)/2)/2,(k+(a+c.y)/2)/2)}if(0<c&&c+1<a)return b=this.n(c-1),d=this.n(c+1),b.Jc(d)}c=a/2|0;if(0===a%2)return b=this.n(c-1),d=this.n(c),4<=a&&b.Sc(d)&&(b=this.n(c-2),a=this.n(c+1),
c=b.Cf(d),e=d.Cf(a),!(c>e+10))?e>c+10?d.Jc(a):b.Jc(a):b.Jc(d);b=this.n(c-1);d=this.n(c);a=this.n(c+1);c=b.Cf(d);e=d.Cf(a);return c>e+10?b.Jc(d):e>c+10?d.Jc(a):b.Jc(a)};
D.defineProperty(J,{points:"points"},function(){return this.ad},function(a){var b=this.ad;if(b!==a){var c=null;if(Array.isArray(a)){var d=0===a.length%2;if(d)for(var e=0;e<a.length;e++)if("number"!==typeof a[e]||isNaN(a[e])){d=!1;break}if(d)for(c=new K(O),d=0;d<a.length/2;d++){var g=(new O(a[2*d],a[2*d+1])).freeze();c.add(g)}else{e=!0;for(d=0;d<a.length;d++){var h=a[d];if(!D.Ta(g)||"number"!==typeof h.x||isNaN(h.x)||"number"!==typeof h.y||isNaN(h.y)){e=!1;break}}if(e)for(c=new K(O),d=0;d<a.length;d++)g=
a[d],c.add((new O(g.x,g.y)).freeze());else D.k("Link.points array must contain only an even number of numbers or objects with x and y properties, not: "+a)}}else if(a instanceof K)for(c=a.copy(),a=c.j;a.next();)a.value.freeze();else D.k("Link.points value is not an instance of List or Array: "+a);c.freeze();this.ad=c;this.Re();this.K();Rr(this);a=this.g;null!==a&&(a.Zn||a.ra.nb||a.hy.add(this),a.Xa.vc&&(this.Jp=c));this.i("points",b,c)}});D.w(J,{ta:"pointsCount"},function(){return this.ad.count});
J.prototype.getPoint=J.prototype.n=function(a){return this.ad.o[a]};J.prototype.setPoint=J.prototype.eh=function(a,b){v&&(D.l(b,O,J,"setPoint"),b.F()||D.k("Link.setPoint called with a Point that does not have real numbers: "+b.toString()));null===this.cf&&D.k("Call Link.startRoute before modifying the points of the route.");this.ad.qg(a,b)};
J.prototype.setPointAt=J.prototype.ia=function(a,b,c){v&&(D.p(b,J,"setPointAt:x"),D.p(c,J,"setPointAt:y"));null===this.cf&&D.k("Call Link.startRoute before modifying the points of the route.");this.ad.qg(a,new O(b,c))};J.prototype.insertPoint=function(a,b){v&&(D.l(b,O,J,"insertPoint"),b.F()||D.k("Link.insertPoint called with a Point that does not have real numbers: "+b.toString()));null===this.cf&&D.k("Call Link.startRoute before modifying the points of the route.");this.ad.Xd(a,b)};
J.prototype.insertPointAt=J.prototype.B=function(a,b,c){v&&(D.p(b,J,"insertPointAt:x"),D.p(c,J,"insertPointAt:y"));null===this.cf&&D.k("Call Link.startRoute before modifying the points of the route.");this.ad.Xd(a,new O(b,c))};J.prototype.addPoint=J.prototype.zi=function(a){v&&(D.l(a,O,J,"addPoint"),a.F()||D.k("Link.addPoint called with a Point that does not have real numbers: "+a.toString()));null===this.cf&&D.k("Call Link.startRoute before modifying the points of the route.");this.ad.add(a)};
J.prototype.addPointAt=J.prototype.Wl=function(a,b){v&&(D.p(a,J,"insertPointAt:x"),D.p(b,J,"insertPointAt:y"));null===this.cf&&D.k("Call Link.startRoute before modifying the points of the route.");this.ad.add(new O(a,b))};J.prototype.removePoint=J.prototype.vG=function(a){null===this.cf&&D.k("Call Link.startRoute before modifying the points of the route.");this.ad.jd(a)};
J.prototype.clearPoints=J.prototype.dq=function(){null===this.cf&&D.k("Call Link.startRoute before modifying the points of the route.");this.ad.clear()};J.prototype.movePoints=J.prototype.wm=function(a,b){for(var c=new K(O),d=this.ad.j;d.next();){var e=d.value;c.add((new O(e.x+a,e.y+b)).freeze())}c.freeze();d=this.ad;this.ad=c;this.K();Rr(this);e=this.g;null!==e&&e.Xa.vc&&(this.Jp=c);this.i("points",d,c)};J.prototype.startRoute=J.prototype.zm=function(){null===this.cf&&(this.cf=this.ad,this.ad=this.ad.copy())};
J.prototype.commitRoute=J.prototype.Aj=function(){if(null!==this.cf){for(var a=this.cf,b=this.ad,c=Infinity,d=Infinity,e=a.o,g=e.length,h=0;h<g;h++)var k=e[h],c=Math.min(k.x,c),d=Math.min(k.y,d);for(var l=Infinity,m=Infinity,n=b.o,p=n.length,h=0;h<p;h++)k=n[h],l=Math.min(k.x,l),m=Math.min(k.y,m),k.freeze();b.freeze();if(p===g)for(h=0;h<p;h++){if(g=e[h],k=n[h],g.x-c!==k.x-l||g.y-d!==k.y-m){this.K();this.Re();break}}else this.K(),this.Re();this.cf=null;c=this.g;null!==c&&c.Xa.vc&&(this.Jp=b);Rr(this);
this.i("points",a,b)}};J.prototype.rollbackRoute=J.prototype.YJ=function(){null!==this.cf&&(this.ad=this.cf,this.cf=null)};function Rr(a){0===a.ad.count?a.lh=!1:(a.lh=!0,a.iq=a.n(0),a.jq=a.n(a.ta-1),Sr(a,!1))}J.prototype.invalidateRoute=J.prototype.fc=function(){if(!this.Wj){var a=this.g;a&&(a.hy.contains(this)||a.ra.nb||a.Xa.lJ&&!a.Xa.sf)||(a=this.path,null!==a&&(this.lh=!1,this.K(),a.K()))}};
D.defineProperty(J,{lh:null},function(){return 0!==(this.dc&16)},function(a){0!==(this.dc&16)!==a&&(this.dc^=16)});D.defineProperty(J,{Wj:"suspendsRouting"},function(){return 0!==(this.dc&32)},function(a){0!==(this.dc&32)!==a&&(this.dc^=32)});D.defineProperty(J,{tA:null},function(){return 0!==(this.dc&64)},function(a){0!==(this.dc&64)!==a&&(this.dc^=64)});D.defineProperty(J,{iq:"defaultFromPoint"},function(){return this.HC},function(a){this.HC=a.copy()});
D.defineProperty(J,{jq:"defaultToPoint"},function(){return this.NC},function(a){this.NC=a.copy()});J.prototype.updateRoute=J.prototype.yo=function(){if(!this.lh&&!this.tA){var a=!0;try{this.tA=!0,this.zm(),a=this.computePoints()}finally{this.tA=!1,a?this.Aj():this.YJ()}}};
J.prototype.computePoints=function(){var a=this.g;if(null===a)return!1;var b=this.aa,c=null;null===b?(a.Nl||(a.gt=new z,a.gt.Ea=Zd,a.gt.jb=0,a.Nl=new G,a.Nl.add(a.gt),a.Nl.hf()),this.iq&&(a.Nl.position=a.Nl.location=this.iq,a.Nl.hf(),b=a.Nl,c=a.gt)):c=this.dd;if(null!==c&&!b.isVisible()){var d=b.findVisibleNode();null!==d&&d!==b?(b=d,c=d.km("")):b=d}this.fE=b;if(null===b||!b.location.F())return!1;for(;!(null===c||c.$.F()&&c.Nj());)c=c.Q;if(null===c)return!1;var e=this.da,g=null;null===e?(a.Ol||(a.ht=
new z,a.ht.Ea=Zd,a.ht.jb=0,a.Ol=new G,a.Ol.add(a.ht),a.Ol.hf()),this.jq&&(a.Ol.position=a.Ol.location=this.jq,a.Ol.hf(),e=a.Ol,g=a.ht)):g=this.Ld;null===g||e.isVisible()||(a=e.findVisibleNode(),null!==a&&a!==e?(e=a,g=a.km("")):e=a);this.gE=e;if(null===e||!e.location.F())return!1;for(;!(null===g||g.$.F()&&g.Nj());)g=g.Q;if(null===g)return!1;var h=this.ta,d=Tr(this,c),a=Ur(this,g),k=d===bc,l=a===bc,m=c===g&&null!==c,n=this.qc,p=this.gf===Nj;this.Yi=m&&!n?p=!0:!1;var q=this.St===nj||m;if(!n&&!m&&k&&
l){if(k=!1,!q&&3<=h&&(q=this.getLinkPoint(b,c,d,!0,!1,e,g),l=this.getLinkPoint(e,g,a,!1,!1,b,c),k=this.adjustPoints(0,q,h-1,l))&&(q=this.getLinkPoint(b,c,d,!0,!1,e,g),l=this.getLinkPoint(e,g,a,!1,!1,b,c),this.adjustPoints(0,q,h-1,l)),!k)if(this.dq(),p){var h=this.getLinkPoint(b,c,d,!0,!1,e,g),q=this.getLinkPoint(e,g,a,!1,!1,b,c),k=q.x-h.x,l=q.y-h.y,m=this.computeCurviness(),p=n=0,r=h.x+k/3,s=h.y+l/3,u=r,t=s;Q(l,0)?t=0<k?t-m:t+m:(n=-k/l,p=Math.sqrt(m*m/(n*n+1)),0>m&&(p=-p),u=(0>l?-1:1)*p+r,t=n*(u-
r)+s);var r=h.x+2*k/3,s=h.y+2*l/3,y=r,w=s;Q(l,0)?w=0<k?w-m:w+m:(y=(0>l?-1:1)*p+r,w=n*(y-r)+s);this.dq();this.zi(h);this.Wl(u,t);this.Wl(y,w);this.zi(q);this.eh(0,this.getLinkPoint(b,c,d,!0,!1,e,g));this.eh(3,this.getLinkPoint(e,g,a,!1,!1,b,c))}else d=this.getLinkPoint(b,c,d,!0,!1,e,g),a=this.getLinkPoint(e,g,a,!1,!1,b,c),this.hasCurviness()?(q=a.x-d.x,e=a.y-d.y,g=this.computeCurviness(),b=d.x+q/2,c=d.y+e/2,h=b,k=c,Q(e,0)?k=0<q?k-g:k+g:(q=-q/e,h=Math.sqrt(g*g/(q*q+1)),0>g&&(h=-h),h=(0>e?-1:1)*h+b,
k=q*(h-b)+c),this.zi(d),this.Wl(h,k)):this.zi(d),this.zi(a)}else{p=this.Di;q&&(n&&p||m)&&this.dq();var C=m?this.computeCurviness():0,p=this.getLinkPoint(b,c,d,!0,n,e,g),r=u=s=0;if(n||!k||m)if(t=this.computeEndSegmentLength(b,c,d,!0),r=this.getLinkDirection(b,c,p,d,!0,n,e,g),m&&(k||d.O(a)||!n&&1===d.x+a.x&&1===d.y+a.y)&&(r-=n?90:30,0>C&&(r-=180)),0>r?r+=360:360<=r&&(r-=360),m&&(t+=Math.abs(C)*(n?1:2)),0===r?s=t:90===r?u=t:180===r?s=-t:270===r?u=-t:(s=t*Math.cos(r*Math.PI/180),u=t*Math.sin(r*Math.PI/
180)),d.Zd()&&m){var A=c.eb(gc,D.P()),N=D.Fb(A.x+1E3*s,A.y+1E3*u);this.getLinkPointFromPoint(b,c,A,N,!0,p);D.A(A);D.A(N)}var t=this.getLinkPoint(e,g,a,!1,n,b,c),H=w=y=0;if(n||!l||m)A=this.computeEndSegmentLength(e,g,a,!1),H=this.getLinkDirection(e,g,t,a,!1,n,b,c),m&&(l||d.O(a)||!n&&1===d.x+a.x&&1===d.y+a.y)&&(H+=n?0:30,0>C&&(H+=180)),0>H?H+=360:360<=H&&(H-=360),m&&(A+=Math.abs(C)*(n?1:2)),0===H?y=A:90===H?w=A:180===H?y=-A:270===H?w=-A:(y=A*Math.cos(H*Math.PI/180),w=A*Math.sin(H*Math.PI/180)),a.Zd()&&
m&&(A=g.eb(gc,D.P()),N=D.Fb(A.x+1E3*y,A.y+1E3*w),this.getLinkPointFromPoint(e,g,A,N,!1,t),D.A(A),D.A(N));a=p;if(n||!k||m)a=new O(p.x+s,p.y+u);d=t;if(n||!l||m)d=new O(t.x+y,t.y+w);!q&&!n&&k&&3<h&&this.adjustPoints(0,p,h-2,d)?this.eh(h-1,t):!q&&!n&&l&&3<h&&this.adjustPoints(1,a,h-1,t)?this.eh(0,p):!q&&(n?6<=h:4<h)&&this.adjustPoints(1,a,h-2,d)?(this.eh(0,p),this.eh(h-1,t)):(this.dq(),this.zi(p),(n||!k||m)&&this.zi(a),n&&this.addOrthoPoints(a,r,d,H,b,e),(n||!l||m)&&this.zi(d),this.zi(t))}return!0};
function Vr(a,b){Math.abs(b.x-a.x)>Math.abs(b.y-a.y)?(b.x=b.x>=a.x?a.x+9E9:a.x-9E9,b.y=a.y):(b.y=b.y>=a.y?a.y+9E9:a.y-9E9,b.x=a.x);return b}
J.prototype.getLinkPointFromPoint=function(a,b,c,d,e,g){void 0===g&&(g=new O);if(null===a||null===b)return g.assign(c),g;a.isVisible()||(e=a.findVisibleNode(),null!==e&&e!==a&&(b=e.port));var h=e=0,k=0,l=0;a=null;e=b.Q;null===e||e.kh()||(e=e.Q);if(null===e)e=d.x,h=d.y,k=c.x,l=c.y;else{a=e.Hh;e=1/(a.m11*a.m22-a.m12*a.m21);var k=a.m22*e,l=-a.m12*e,m=-a.m21*e,n=a.m11*e,p=e*(a.m21*a.dy-a.m22*a.dx),q=e*(a.m12*a.dx-a.m11*a.dy);e=d.x*k+d.y*m+p;h=d.x*l+d.y*n+q;k=c.x*k+c.y*m+p;l=c.x*l+c.y*n+q}b.Tn(e,h,k,l,
g);null!==a&&g.transform(a);return g};function Wr(a,b){var c=b.Xs;null===c&&(c=new Xr,c.port=b,c.Vc=b.Y,b.Xs=c);return Yr(c,a)}
J.prototype.getLinkPoint=function(a,b,c,d,e,g,h,k){void 0===k&&(k=new O);if(c.fd())return b.eb(c,k),k;if(c.Kj()){var l=Wr(this,b);if(null!==l){k.assign(l.Bq);if(e&&this.Ay===Mr){var m=Wr(this,h);if(null!==m&&l.Kn<m.Kn){var l=D.P(),m=D.P(),n=new B(b.eb(cc,l),b.eb(rc,m)),p=this.computeSpot(!d);a=this.getLinkPoint(g,h,p,!d,e,a,b,m);(c.Ij(tc)||c.Ij(uc))&&a.y>=n.y&&a.y<=n.y+n.height?k.y=a.y:(c.Ij(sc)||c.Ij(yc))&&a.x>=n.x&&a.x<=n.x+n.width&&(k.x=a.x);D.A(l);D.A(m)}}return k}}c=b.eb(gc,D.P());l=g=null;this.ta>
(e?6:2)?(l=d?this.n(1):this.n(this.ta-2),e&&(l=Vr(c,l.copy()))):(g=D.P(),l=h.eb(gc,g),e&&(l=Vr(c,l)),D.A(g));this.getLinkPointFromPoint(a,b,c,l,d,k);D.A(c);return k};
J.prototype.getLinkDirection=function(a,b,c,d,e,g,h,k){a:if(d.fd())c=d.x>d.y?d.x>1-d.y?0:d.x<1-d.y?270:315:d.x<d.y?d.x>1-d.y?90:d.x<1-d.y?180:135:.5>d.x?225:.5<d.x?45:0;else{if(d.Kj()){var l=Wr(this,b);if(null!==l)switch(l.Ke){case D.ud:c=270;break a;case D.Yc:c=180;break a;default:case D.ld:c=0;break a;case D.kd:c=90;break a}}var l=b.eb(gc,D.P()),m=null,n=null;this.ta>(g?6:2)?(n=e?this.n(1):this.n(this.ta-2),n=g?Vr(l,n.copy()):c):(m=D.P(),n=k.eb(gc,m),D.A(m));c=0;c=Math.abs(n.x-l.x)>Math.abs(n.y-
l.y)?n.x>=l.x?0:180:n.y>=l.y?90:270;D.A(l)}d.Zd()&&h.Ei(a)&&(c+=180,360<=c&&(c-=360));a=vr;a=e?this.nu:this.fv;a===vr&&(a=e?b.nu:b.fv);switch(a){case wr:b=b.Rn();c+=b;360<=c&&(c-=360);break;case vr:case Co:b=b.Rn();if(0===b)break;45<=b&&135>b?c+=90:135<=b&&225>b?c+=180:225<=b&&315>b&&(c+=270);360<=c&&(c-=360)}return c};
J.prototype.computeEndSegmentLength=function(a,b,c,d){if(null!==b&&c.Kj()&&(a=Wr(this,b),null!==a))return a.Dx;a=NaN;a=d?this.nm:this.Dm;null!==b&&isNaN(a)&&(a=d?b.nm:b.Dm);isNaN(a)&&(a=10);return a};J.prototype.computeSpot=function(a){return a?Tr(this,this.dd):Ur(this,this.Ld)};function Tr(a,b){if(null===b)return gc;var c=a.Gb;c.ed()&&null!==b&&(c=b.Gb);return c===Tc?bc:c}function Ur(a,b){if(null===b)return gc;var c=a.Hb;c.ed()&&null!==b&&(c=b.Hb);return c===Tc?bc:c}
J.prototype.computeOtherPoint=function(a,b){var c=b.eb(gc),d;d=b.Xs;d=null!==d?Yr(d,this):null;null!==d&&(c=d.Bq);return c};J.prototype.computeShortLength=function(a){if(a){if(a=this.ou,isNaN(a)){var b=this.dd;null!==b&&(a=b.ou)}}else a=this.gv,isNaN(a)&&(b=this.Ld,null!==b&&(a=b.gv));return isNaN(a)?0:a};
J.prototype.Qk=function(a,b,c,d,e,g){if(!1===this.pg)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var h=g;void 0===g&&(h=D.Of(),h.reset());h.multiply(this.transform);if(this.Hn(a,h))return cq(this,b,c,e),void 0===g&&D.He(h),!0;if(this.Wg(a,h)){var k=!1;if(!this.Yn)for(var l=this.xa.o,m=l.length;m--;){var n=l[m];if(n.visible||n===this.uf){var p=n.$,q=this.Ga;if(!(p.x>q.width||p.y>q.height||0>p.x+p.width||0>p.y+p.height)){p=D.Of();p.set(h);if(n instanceof x)k=n.Qk(a,b,c,d,e,p);else if(this.path===
n){if(n instanceof z){var k=n,r=a,s=d,q=p;if(!1===k.pg)k=!1;else if(q.multiply(k.transform),s)b:{var u=r,t=q;if(k.Hn(u,t))k=!0;else{if(void 0===t&&(t=k.transform,u.Nk(k.$))){k=!0;break b}var q=u.left,r=u.right,s=u.top,u=u.bottom,y=D.P(),w=D.P(),C=D.P(),A=D.Of();A.set(t);A.lB(k.transform);A.Qx();w.x=r;w.y=s;w.transform(A);y.x=q;y.y=s;y.transform(A);t=!1;pq(k,y,w,C)?t=!0:(y.x=r,y.y=u,y.transform(A),pq(k,y,w,C)?t=!0:(w.x=q,w.y=u,w.transform(A),pq(k,y,w,C)?t=!0:(y.x=q,y.y=s,y.transform(A),pq(k,y,w,C)&&
(t=!0))));D.He(A);D.A(y);D.A(w);D.A(C);k=t}}else k=k.Hn(r,q)}}else k=Io(n,a,d,p);k&&(null!==b&&(n=b(n)),n&&(null===c||c(n))&&(e instanceof L&&e.add(n),e instanceof K&&e.add(n)));D.He(p)}}}void 0===g&&D.He(h);return k||null!==this.background||null!==this.Zl}void 0===g&&D.He(h);return!1};D.w(J,{qc:"isOrthogonal"},function(){return 2===(this.mn.value&2)});D.w(J,{Di:"isAvoiding"},function(){return 4===(this.mn.value&4)});
J.prototype.computeCurve=function(){if(null===this.Yi){var a=this.dd,b=this.qc;this.Yi=null!==a&&a===this.Ld&&!b}return this.Yi?Nj:this.gf};J.prototype.computeCorner=function(){if(this.gf===Nj)return 0;var a=this.yA;if(isNaN(a)||0>a)a=10;return a};J.prototype.findMidLabel=function(){for(var a=this.path,b=this.xa.o,c=b.length,d=0;d<c;d++){var e=b[d];if(e!==a&&!e.Gf&&(-Infinity===e.Te||isNaN(e.Te)))return e}for(a=this.If;a.next();)if(b=a.value,-Infinity===b.Te||isNaN(b.Te))return b;return null};
J.prototype.computeSpacing=function(){if(!this.isVisible())return 0;var a;a=Math.max(14,this.computeThickness());var b=this.dd,c=this.Ld;if(null!==b&&null!==c){var d=this.findMidLabel();if(null!==d){var e=d.Ga,g=d.margin,h=isNaN(e.width)?30:e.width*d.scale+g.left+g.right,e=isNaN(e.height)?14:e.height*d.scale+g.top+g.bottom,d=d.Oq;d===sq||d===Mq||d===Lq?a=Math.max(a,e):d===Vp||d===Wp||d===Tp||d===Up?a=Math.max(a,h):(b=b.eb(gc).Jc(c.eb(gc))/180*Math.PI,a=Math.max(a,Math.abs(Math.sin(b)*h)+Math.abs(Math.cos(b)*
e)+1));this.gf===Nj&&(a*=1.333)}}return a};J.prototype.arrangeBundledLinks=function(a,b){if(b)for(var c=0;c<a.length;c++)a[c].fc()};J.prototype.computeCurviness=function(){var a=this.yx;if(isNaN(a)){var a=16,b=this.Mi;if(null!==b){for(var c=D.tb(),d=0,e=b.links,g=0;g<e.length;g++){var h=e[g],h=h.computeSpacing();c.push(h);d+=h}d=-d/2;for(g=0;g<e.length;g++){h=e[g];if(h===this){a=d+c[g]/2;break}d+=c[g]}b.Eq===this.aa&&(a=-a);D.Aa(c)}}return a};
J.prototype.computeThickness=function(){if(!this.isVisible())return 0;var a=this.path;return null!==a?Math.max(a.jb,1):1};J.prototype.hasCurviness=function(){return!isNaN(this.yx)||null!==this.Mi};
J.prototype.adjustPoints=function(a,b,c,d){var e=this.St;if(this.qc){if(e===Kr)return!1;e===Lr&&(e=Jr)}switch(e){case Kr:var g=this.n(a),h=this.n(c);if(!g.Sc(b)||!h.Sc(d)){var e=g.x,g=g.y,k=h.x-e,l=h.y-g,m=Math.sqrt(k*k+l*l);if(!yb(m,0)){var n=0;yb(k,0)?n=0>l?-Math.PI/2:Math.PI/2:(n=Math.atan(l/Math.abs(k)),0>k&&(n=Math.PI-n));var h=b.x,p=b.y,l=d.x-h,q=d.y-p,r=Math.sqrt(l*l+q*q),k=0;yb(l,0)?k=0>q?-Math.PI/2:Math.PI/2:(k=Math.atan(q/Math.abs(l)),0>l&&(k=Math.PI-k));m=r/m;n=k-n;this.eh(a,b);for(a+=
1;a<c;a++)b=this.n(a),k=b.x-e,l=b.y-g,b=Math.sqrt(k*k+l*l),yb(b,0)||(q=0,yb(k,0)?q=0>l?-Math.PI/2:Math.PI/2:(q=Math.atan(l/Math.abs(k)),0>k&&(q=Math.PI-q)),k=q+n,b*=m,this.ia(a,h+b*Math.cos(k),p+b*Math.sin(k)));this.eh(c,d)}}return!0;case Lr:g=this.n(a);p=this.n(c);if(!g.Sc(b)||!p.Sc(d)){var e=g.x,g=g.y,h=p.x,p=p.y,m=(h-e)*(h-e)+(p-g)*(p-g),k=b.x,n=b.y,l=d.x,q=d.y,r=0,s=1;0!==l-k?(r=(q-n)/(l-k),s=Math.sqrt(1+1/(r*r))):r=9E9;this.eh(a,b);for(a+=1;a<c;a++){b=this.n(a);var u=b.x,t=b.y,y=.5;0!==m&&(y=
((e-u)*(e-h)+(g-t)*(g-p))/m);var w=e+y*(h-e),C=g+y*(p-g);b=Math.sqrt((u-w)*(u-w)+(t-C)*(t-C));t<r*(u-w)+C&&(b=-b);0<r&&(b=-b);u=k+y*(l-k);y=n+y*(q-n);0!==r?(b=u+b/s,this.ia(a,b,y-(b-u)/r)):this.ia(a,u,y+b)}this.eh(c,d)}return!0;case Jr:a:{if(this.qc){h=this.n(a);p=this.n(a+1);e=this.n(a+2);m=p.x;k=p.y;Q(h.y,p.y)?Q(p.x,e.x)?k=b.y:Q(p.y,e.y)&&(m=b.x):Q(h.x,p.x)&&(Q(p.y,e.y)?m=b.x:Q(p.x,e.x)&&(k=b.y));g=this.g;if(this.Di&&null!==g&&(h=ha(g,!0,this.Pa,null),!h.vm(Math.min(m,e.x),Math.min(k,e.y),Math.abs(m-
e.x),Math.abs(k-e.y)))){c=!1;break a}this.ia(a+1,m,k);h=this.n(c);p=this.n(c-1);e=this.n(c-2);m=p.x;k=p.y;Q(h.y,p.y)?Q(p.x,e.x)?k=d.y:Q(p.y,e.y)&&(m=d.x):Q(h.x,p.x)&&(Q(p.y,e.y)?m=d.x:Q(p.x,e.x)&&(k=d.y));if(this.Di&&null!==g&&(h=ha(g,!0,this.Pa,null),!h.vm(Math.min(m,e.x),Math.min(k,e.y),Math.abs(m-e.x),Math.abs(k-e.y)))){c=!1;break a}this.ia(c-1,m,k)}this.eh(a,b);this.eh(c,d);c=!0}return c;default:return!1}};
J.prototype.addOrthoPoints=function(a,b,c,d,e,g){b=-45<=b&&45>b?0:45<=b&&135>b?90:135<=b&&225>b?180:270;d=-45<=d&&45>d?0:45<=d&&135>d?90:135<=d&&225>d?180:270;var h=e.$.copy(),k=g.$.copy();if(h.F()&&k.F()){h.eg(8,8);k.eg(8,8);h.Ki(a);k.Ki(c);var l,m;if(0===b)if(c.x>a.x||270===d&&c.y<a.y&&k.right>a.x||90===d&&c.y>a.y&&k.right>a.x)l=new O(c.x,a.y),m=new O(c.x,(a.y+c.y)/2),180===d?(l.x=this.computeMidOrthoPosition(a.x,c.x,!1),m.x=l.x,m.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(l.x=a.x<k.left?this.computeMidOrthoPosition(a.x,
k.left,!1):a.x<k.right&&(270===d&&a.y<k.top||90===d&&a.y>k.bottom)?this.computeMidOrthoPosition(a.x,c.x,!1):k.right,m.x=l.x,m.y=c.y):0===d&&a.x<k.left&&a.y>k.top&&a.y<k.bottom&&(l.x=a.x,l.y=a.y<c.y?Math.min(c.y,k.top):Math.max(c.y,k.bottom),m.y=l.y);else{l=new O(a.x,c.y);m=new O((a.x+c.x)/2,c.y);if(180===d||90===d&&c.y<h.top||270===d&&c.y>h.bottom)180===d&&(k.Oa(a)||h.Oa(c))?l.y=this.computeMidOrthoPosition(a.y,c.y,!0):c.y<a.y&&(180===d||90===d)?l.y=this.computeMidOrthoPosition(h.top,Math.max(c.y,
k.bottom),!0):c.y>a.y&&(180===d||270===d)&&(l.y=this.computeMidOrthoPosition(h.bottom,Math.min(c.y,k.top),!0)),m.x=c.x,m.y=l.y;if(l.y>h.top&&l.y<h.bottom)if(c.x>=h.left&&c.x<=a.x||a.x<=k.right&&a.x>=c.x){if(90===d||270===d)l=new O(Math.max((a.x+c.x)/2,a.x),a.y),m=new O(l.x,c.y)}else l.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,0===d?h.top:Math.min(h.top,k.top)):Math.max(c.y,0===d?h.bottom:Math.max(h.bottom,k.bottom)),m.x=c.x,m.y=l.y}else if(180===b)if(c.x<a.x||270===d&&c.y<a.y&&k.left<a.x||
90===d&&c.y>a.y&&k.left<a.x)l=new O(c.x,a.y),m=new O(c.x,(a.y+c.y)/2),0===d?(l.x=this.computeMidOrthoPosition(a.x,c.x,!1),m.x=l.x,m.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(l.x=a.x>k.right?this.computeMidOrthoPosition(a.x,k.right,!1):a.x>k.left&&(270===d&&a.y<k.top||90===d&&a.y>k.bottom)?this.computeMidOrthoPosition(a.x,c.x,!1):k.left,m.x=l.x,m.y=c.y):180===d&&a.x>k.right&&a.y>k.top&&a.y<k.bottom&&(l.x=a.x,l.y=a.y<c.y?Math.min(c.y,k.top):Math.max(c.y,k.bottom),m.y=l.y);else{l=new O(a.x,c.y);m=new O((a.x+
c.x)/2,c.y);if(0===d||90===d&&c.y<h.top||270===d&&c.y>h.bottom)0===d&&(k.Oa(a)||h.Oa(c))?l.y=this.computeMidOrthoPosition(a.y,c.y,!0):c.y<a.y&&(0===d||90===d)?l.y=this.computeMidOrthoPosition(h.top,Math.max(c.y,k.bottom),!0):c.y>a.y&&(0===d||270===d)&&(l.y=this.computeMidOrthoPosition(h.bottom,Math.min(c.y,k.top),!0)),m.x=c.x,m.y=l.y;if(l.y>h.top&&l.y<h.bottom)if(c.x<=h.right&&c.x>=a.x||a.x>=k.left&&a.x<=c.x){if(90===d||270===d)l=new O(Math.min((a.x+c.x)/2,a.x),a.y),m=new O(l.x,c.y)}else l.y=270===
d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,180===d?h.top:Math.min(h.top,k.top)):Math.max(c.y,180===d?h.bottom:Math.max(h.bottom,k.bottom)),m.x=c.x,m.y=l.y}else if(90===b)if(c.y>a.y||180===d&&c.x<a.x&&k.bottom>a.y||0===d&&c.x>a.x&&k.bottom>a.y)l=new O(a.x,c.y),m=new O((a.x+c.x)/2,c.y),270===d?(l.y=this.computeMidOrthoPosition(a.y,c.y,!0),m.x=c.x,m.y=l.y):180===d&&c.x<a.x||0===d&&c.x>a.x?(l.y=a.y<k.top?this.computeMidOrthoPosition(a.y,k.top,!0):a.y<k.bottom&&(180===d&&a.x<k.left||0===d&&a.x>k.right)?
this.computeMidOrthoPosition(a.y,c.y,!0):k.bottom,m.x=c.x,m.y=l.y):90===d&&a.y<k.top&&a.x>k.left&&a.x<k.right&&(l.x=a.x<c.x?Math.min(c.x,k.left):Math.max(c.x,k.right),l.y=a.y,m.x=l.x);else{l=new O(c.x,a.y);m=new O(c.x,(a.y+c.y)/2);if(270===d||0===d&&c.x<h.left||180===d&&c.x>h.right)270===d&&(k.Oa(a)||h.Oa(c))?l.x=this.computeMidOrthoPosition(a.x,c.x,!1):c.x<a.x&&(270===d||0===d)?l.x=this.computeMidOrthoPosition(h.left,Math.max(c.x,k.right),!1):c.x>a.x&&(270===d||180===d)&&(l.x=this.computeMidOrthoPosition(h.right,
Math.min(c.x,k.left),!1)),m.x=l.x,m.y=c.y;if(l.x>h.left&&l.x<h.right)if(c.y>=h.top&&c.y<=a.y||a.y<=k.bottom&&a.y>=c.y){if(0===d||180===d)l=new O(a.x,Math.max((a.y+c.y)/2,a.y)),m=new O(c.x,l.y)}else l.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,90===d?h.left:Math.min(h.left,k.left)):Math.max(c.x,90===d?h.right:Math.max(h.right,k.right)),m.x=l.x,m.y=c.y}else if(c.y<a.y||180===d&&c.x<a.x&&k.top<a.y||0===d&&c.x>a.x&&k.top<a.y)l=new O(a.x,c.y),m=new O((a.x+c.x)/2,c.y),90===d?(l.y=this.computeMidOrthoPosition(a.y,
c.y,!0),m.x=c.x,m.y=l.y):180===d&&c.x<a.x||0===d&&c.x>=a.x?(l.y=a.y>k.bottom?this.computeMidOrthoPosition(a.y,k.bottom,!0):a.y>k.top&&(180===d&&a.x<k.left||0===d&&a.x>k.right)?this.computeMidOrthoPosition(a.y,c.y,!0):k.top,m.x=c.x,m.y=l.y):270===d&&a.y>k.bottom&&a.x>k.left&&a.x<k.right&&(l.x=a.x<c.x?Math.min(c.x,k.left):Math.max(c.x,k.right),l.y=a.y,m.x=l.x);else{l=new O(c.x,a.y);m=new O(c.x,(a.y+c.y)/2);if(90===d||0===d&&c.x<h.left||180===d&&c.x>h.right)90===d&&(k.Oa(a)||h.Oa(c))?l.x=this.computeMidOrthoPosition(a.x,
c.x,!1):c.x<a.x&&(90===d||0===d)?l.x=this.computeMidOrthoPosition(h.left,Math.max(c.x,k.right),!1):c.x>a.x&&(90===d||180===d)&&(l.x=this.computeMidOrthoPosition(h.right,Math.min(c.x,k.left),!1)),m.x=l.x,m.y=c.y;if(l.x>h.left&&l.x<h.right)if(c.y<=h.bottom&&c.y>=a.y||a.y>=k.top&&a.y<=c.y){if(0===d||180===d)l=new O(a.x,Math.min((a.y+c.y)/2,a.y)),m=new O(c.x,l.y)}else l.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,270===d?h.left:Math.min(h.left,k.left)):Math.max(c.x,270===d?h.right:Math.max(h.right,
k.right)),m.x=l.x,m.y=c.y}var n=l,p=m;if(this.Di){var q=this.g,r;(r=null===q)||(q.Xa.sf?r=!1:(r=q.gb,r=r instanceof Mh?!r.Xw||r.dJ:!0),r=!r);if(r||h.Oa(c)&&!g.Ei(e)||k.Oa(a)&&!e.Ei(g)||e===g||this.layer.Tc)a=!1;else if(e=ha(q,!0,this.Pa,null),e.vm(Math.min(a.x,n.x),Math.min(a.y,n.y),Math.abs(a.x-n.x),Math.abs(a.y-n.y))&&e.vm(Math.min(n.x,p.x),Math.min(n.y,p.y),Math.abs(n.x-p.x),Math.abs(n.y-p.y))&&e.vm(Math.min(p.x,c.x),Math.min(p.y,c.y),Math.abs(p.x-c.x),Math.abs(p.y-c.y)))a=!1;else if(h=h.copy().Wh(k),
h.eg(2*e.cq,2*e.aq),Zr(e,a,b,c,d,h),k=$r(e,c.x,c.y),e.abort||999999!==k||(Kn(e),k=e.SG,h.eg(e.cq*k,e.aq*k),Zr(e,a,b,c,d,h),k=$r(e,c.x,c.y)),e.abort||999999!==k||(Kn(e),k=e.ZF,h.eg(e.cq*k,e.aq*k),Zr(e,a,b,c,d,h),k=$r(e,c.x,c.y)),!e.abort&&999999===k&&e.jH&&(Kn(e),Zr(e,a,b,c,d,e.sb),k=$r(e,c.x,c.y)),!e.abort&&999999>k&&0!==$r(e,c.x,c.y)){as(this,e,c.x,c.y,d,!0);d=this.n(2);if(4>this.ta)0===b||180===b?(d.x=a.x,d.y=c.y):(d.x=c.x,d.y=a.y),this.ia(2,d.x,d.y),this.B(3,d.x,d.y);else if(c=this.n(3),0===b||
180===b)Q(d.x,c.x)?(b=0===b?Math.max(d.x,a.x):Math.min(d.x,a.x),this.ia(2,b,a.y),this.ia(3,b,c.y)):Q(d.y,c.y)?(Math.abs(a.y-d.y)<=e.aq/2&&(this.ia(2,d.x,a.y),this.ia(3,c.x,a.y)),this.B(2,d.x,a.y)):this.ia(2,a.x,d.y);else if(90===b||270===b)Q(d.y,c.y)?(b=90===b?Math.max(d.y,a.y):Math.min(d.y,a.y),this.ia(2,a.x,b),this.ia(3,c.x,b)):Q(d.x,c.x)?(Math.abs(a.x-d.x)<=e.cq/2&&(this.ia(2,a.x,d.y),this.ia(3,a.x,c.y)),this.B(2,a.x,d.y)):this.ia(2,d.x,a.y);a=!0}else a=!1}else a=!1;a||(this.zi(l),this.zi(m))}};
J.prototype.computeMidOrthoPosition=function(a,b){if(this.hasCurviness()){var c=this.computeCurviness();return(a+b)/2+c}return(a+b)/2};function Qh(a){if(null===a.g||!a.Di)return!1;var b=a.points.o,c=b.length;if(4>c)return!1;a=ha(a.g,!0,a.Pa,null);for(var d=1;d<c-2;d++){var e=b[d],g=b[d+1];if(!a.vm(Math.min(e.x,g.x),Math.min(e.y,g.y),Math.abs(e.x-g.x),Math.abs(e.y-g.y)))return!0}return!1}
function as(a,b,c,d,e,g){var h=b.cq,k=b.aq,l=$r(b,c,d),m=c,n=d;for(0===e?m+=h:90===e?n+=k:180===e?m-=h:n-=k;1<l&&$r(b,m,n)===l-1;)c=m,d=n,0===e?m+=h:90===e?n+=k:180===e?m-=h:n-=k,l-=1;if(g){if(1<l)if(180===e||0===e)c=Math.floor(c/h)*h+h/2;else if(90===e||270===e)d=Math.floor(d/k)*k+k/2}else c=Math.floor(c/h)*h+h/2,d=Math.floor(d/k)*k+k/2;1<l&&(g=e,m=c,n=d,0===e?(g=90,n+=k):90===e?(g=180,m-=h):180===e?(g=270,n-=k):270===e&&(g=0,m+=h),$r(b,m,n)===l-1?as(a,b,m,n,g,!1):(m=c,n=d,0===e?(g=270,n-=k):90===
e?(g=0,m+=h):180===e?(g=90,n+=k):270===e&&(g=180,m-=h),$r(b,m,n)===l-1&&as(a,b,m,n,g,!1)));a.Wl(c,d)}J.prototype.findClosestSegment=function(a){v&&D.l(a,O,J,"findClosestSegment:p");var b=a.x;a=a.y;for(var c=this.n(0),d=this.n(1),e=jb(b,a,c.x,c.y,d.x,d.y),g=0,h=1;h<this.ta-1;h++){var c=this.n(h+1),k=jb(b,a,d.x,d.y,c.x,c.y),d=c;k<e&&(g=h,e=k)}return g};J.prototype.Re=function(){this.ob=null};D.w(J,{Df:"geometry"},function(){null===this.ob&&(this.yo(),this.ob=this.makeGeometry());return this.ob});
J.prototype.Gu=function(a){if(!a){if(!1===this.lh)return;a=this.Vd();if(null!==this.ob&&(null===a||null!==a.Df))return}this.ob=this.makeGeometry();a=this.path;if(null!==a){a.ob=this.ob;for(var b=this.xa.o,c=b.length,d=0;d<c;d++){var e=b[d];e!==a&&e.Gf&&e instanceof z&&(e.ob=this.ob)}}};
J.prototype.makeGeometry=function(){var a=this.ta;if(2>a)return new bf(sf);var b=!1,c=this.g;null!==c&&Qr(this)&&c.sl.contains(this)&&null!==this.Iw&&(b=!0);var d=c=0,e=this.n(0).copy(),g=e.copy(),c=this.ad.o,h=this.computeCurve();if(h===Nj&&3<=a&&!yb(this.Tq,0))if(3===a)var k=this.n(1),c=Math.min(e.x,k.x),d=Math.min(e.y,k.y),k=this.n(2),c=Math.min(c,k.x),d=Math.min(d,k.y);else{if(this.qc)for(k=0;k<a;k++)d=c[k],g.x=Math.min(d.x,g.x),g.y=Math.min(d.y,g.y);else for(k=3;k<a;k+=3)k+3>=a&&(k=a-1),c=this.n(k),
g.x=Math.min(c.x,g.x),g.y=Math.min(c.y,g.y);c=g.x;d=g.y}else{for(k=0;k<a;k++)d=c[k],g.x=Math.min(d.x,g.x),g.y=Math.min(d.y,g.y);c=g.x;d=g.y}c-=this.dA.x;d-=this.dA.y;e.x-=c;e.y-=d;if(2!==a||Qr(this)){var l=D.v();0!==this.computeShortLength(!0)&&(e=bs(this,e,!0,g));T(l,e.x,e.y,!1,!1);if(h===Nj&&3<=a&&!yb(this.Tq,0))if(3===a)k=this.n(1),a=k.x-c,b=k.y-d,k=this.n(2).copy(),k.x-=c,k.y-=d,0!==this.computeShortLength(!1)&&(k=bs(this,k,!1,g)),V(l,a,b,a,b,k.x,k.y);else if(this.qc){for(var g=new O(c,d),e=this.n(1).copy(),
h=new O(c,d),a=new O(c,d),b=this.n(0),m=null,n=this.Tq/3,k=1;k<this.ta-1;k++){var m=this.n(k),p=b,q=m,r=this.n(cs(this,m,k,!1));if(!yb(p.x,q.x)||!yb(q.x,r.x))if(!yb(p.y,q.y)||!yb(q.y,r.y)){var s=n,u=h,t=a;isNaN(s)&&(s=this.Tq/3);var y=p.x,p=p.y,w=q.x,q=q.y,C=r.x,r=r.y,A=s*ds(y,p,w,q),s=s*ds(w,q,C,r);yb(p,q)&&yb(w,C)&&(w>y?r>q?(u.x=w-A,u.y=q-A,t.x=w+s,t.y=q+s):(u.x=w-A,u.y=q+A,t.x=w+s,t.y=q-s):r>q?(u.x=w+A,u.y=q-A,t.x=w-s,t.y=q+s):(u.x=w+A,u.y=q+A,t.x=w-s,t.y=q-s));yb(y,w)&&yb(q,r)&&(q>p?(C>w?(u.x=
w-A,u.y=q-A,t.x=w+s):(u.x=w+A,u.y=q-A,t.x=w-s),t.y=q+s):(C>w?(u.x=w-A,u.y=q+A,t.x=w+s):(u.x=w+A,u.y=q+A,t.x=w-s),t.y=q-s));if(yb(y,w)&&yb(w,C)||yb(p,q)&&yb(q,r))y=.5*(y+C),p=.5*(p+r),u.x=y,u.y=p,t.x=y,t.y=p;1===k?(e.x=.5*(b.x+m.x),e.y=.5*(b.y+m.y)):2===k&&yb(b.x,this.n(0).x)&&yb(b.y,this.n(0).y)&&(e.x=.5*(b.x+m.x),e.y=.5*(b.y+m.y));V(l,e.x-c,e.y-d,h.x-c,h.y-d,m.x-c,m.y-d);g.set(h);e.set(a);b=m}}k=b.x;b=b.y;g=this.n(this.ta-1);0!==this.computeShortLength(!1)&&(g=bs(this,g.copy(),!1,Gd));k=.5*(k+g.x);
b=.5*(b+g.y);V(l,a.x-c,a.y-d,k-c,b-d,g.x-c,g.y-d)}else for(k=3;k<a;k+=3)b=this.n(k-2),k+3>=a&&(k=a-1),g=this.n(k-1),e=this.n(k),k===a-1&&0!==this.computeShortLength(!1)&&(e=bs(this,e.copy(),!1,Gd)),V(l,b.x-c,b.y-d,g.x-c,g.y-d,e.x-c,e.y-d);else{g=D.P();g.assign(this.n(0));for(k=1;k<a;){k=cs(this,g,k,1<k);u=this.n(k);if(k>=a-1){g!==u&&(0!==this.computeShortLength(!1)&&(u=bs(this,u.copy(),!1,Gd)),es(this,l,-c,-d,g,u,b));break}k=cs(this,u,k+1,k<a-3);e=l;h=-c;m=-d;n=g;t=this.n(k);y=g;p=b;Q(n.y,u.y)&&Q(u.x,
t.x)?(s=this.computeCorner(),s=Math.min(s,Math.abs(u.x-n.x)/2),s=w=Math.min(s,Math.abs(t.y-u.y)/2),Q(s,0)?(es(this,e,h,m,n,u,p),y.assign(u)):(q=u.x,C=u.y,r=q,A=C,q=u.x>n.x?u.x-s:u.x+s,A=t.y>u.y?u.y+w:u.y-w,es(this,e,h,m,n,new O(q,C),p),zf(e,u.x+h,u.y+m,r+h,A+m),y.m(r,A))):Q(n.x,u.x)&&Q(u.y,t.y)?(s=this.computeCorner(),w=Math.min(s,Math.abs(u.y-n.y)/2),w=s=Math.min(w,Math.abs(t.x-u.x)/2),Q(s,0)?(es(this,e,h,m,n,u,p),y.assign(u)):(q=u.x,A=C=u.y,C=u.y>n.y?u.y-w:u.y+w,r=t.x>u.x?u.x+s:u.x-s,es(this,e,
h,m,n,new O(q,C),p),zf(e,u.x+h,u.y+m,r+h,A+m),y.m(r,A))):(es(this,e,h,m,n,u,p),y.assign(u))}D.A(g)}c=l.q;D.u(l)}else l=this.n(1).copy(),l.x-=c,l.y-=d,0!==this.computeShortLength(!0)&&(e=bs(this,e,!0,g)),0!==this.computeShortLength(!1)&&(l=bs(this,l,!1,g)),c=new bf(sf),c.ma=e.x,c.ka=e.y,c.H=l.x,c.I=l.y;return c};
function ds(a,b,c,d){a=c-a;if(isNaN(a)||Infinity===a||-Infinity===a)return NaN;0>a&&(a=-a);b=d-b;if(isNaN(b)||Infinity===b||-Infinity===b)return NaN;0>b&&(b=-b);return yb(a,0)?b:yb(b,0)?a:Math.sqrt(a*a+b*b)}
function bs(a,b,c,d){var e=a.ta;if(2>e)return b;if(c){var g=a.n(1);c=g.x-d.x;d=g.y-d.y;g=ds(b.x,b.y,c,d);if(0===g)return b;e=2===e?.5*g:g;a=a.computeShortLength(!0);a>e&&(a=e);c=a*(c-b.x)/g;a=a*(d-b.y)/g;b.x+=c;b.y+=a}else{g=a.n(e-2);c=g.x-d.x;d=g.y-d.y;g=ds(b.x,b.y,c,d);if(0===g)return b;e=2===e?.5*g:g;a=a.computeShortLength(!1);a>e&&(a=e);c=a*(b.x-c)/g;a=a*(b.y-d)/g;b.x-=c;b.y-=a}return b}
function cs(a,b,c,d){for(var e=a.ta,g=b;yb(b.x,g.x)&&yb(b.y,g.y);){if(c>=e)return e-1;g=a.n(c++)}if(!yb(b.x,g.x)&&!yb(b.y,g.y))return c-1;for(var h=g;yb(b.x,g.x)&&yb(g.x,h.x)&&(!d||(b.y>=g.y?g.y>=h.y:g.y<=h.y))||yb(b.y,g.y)&&yb(g.y,h.y)&&(!d||(b.x>=g.x?g.x>=h.x:g.x<=h.x));){if(c>=e)return e-1;h=a.n(c++)}return c-2}
function es(a,b,c,d,e,g,h){if(!h&&Qr(a)){h=[];var k=0;a.isVisible()&&(k=fs(a,e,g,h));var l=e.x,l=e.y;if(0<k)if(Q(e.y,g.y))if(e.x<g.x)for(var m=0;m<k;){var n=Math.max(e.x,Math.min(h[m++]-5,g.x-10));b.lineTo(n+c,g.y+d);for(var l=n+c,p=Math.min(n+10,g.x);m<k;){var q=h[m];if(q<p+10)m++,p=Math.min(q+5,g.x);else break}q=(n+p)/2+c;q=g.y-10+d;n=p+c;p=g.y+d;a.gf===mj?T(b,n,p,!1,!1):V(b,l,q,n,q,n,p)}else for(m=k-1;0<=m;){n=Math.min(e.x,Math.max(h[m--]+5,g.x+10));b.lineTo(n+c,g.y+d);l=n+c;for(p=Math.max(n-10,
g.x);0<=m;)if(q=h[m],q>p-10)m--,p=Math.max(q-5,g.x);else break;q=g.y-10+d;n=p+c;p=g.y+d;a.gf===mj?T(b,n,p,!1,!1):V(b,l,q,n,q,n,p)}else if(Q(e.x,g.x))if(e.y<g.y)for(m=0;m<k;){n=Math.max(e.y,Math.min(h[m++]-5,g.y-10));b.lineTo(g.x+c,n+d);l=n+d;for(p=Math.min(n+10,g.y);m<k;)if(q=h[m],q<p+10)m++,p=Math.min(q+5,g.y);else break;q=g.x-10+c;n=g.x+c;p+=d;a.gf===mj?T(b,n,p,!1,!1):V(b,q,l,q,p,n,p)}else for(m=k-1;0<=m;){n=Math.min(e.y,Math.max(h[m--]+5,g.y+10));b.lineTo(g.x+c,n+d);l=n+d;for(p=Math.max(n-10,g.y);0<=
m;)if(q=h[m],q>p-10)m--,p=Math.max(q-5,g.y);else break;q=g.x-10+c;n=g.x+c;p+=d;a.gf===mj?T(b,n,p,!1,!1):V(b,q,l,q,p,n,p)}}b.lineTo(g.x+c,g.y+d)}
function fs(a,b,c,d){var e=a.g;if(null===e||b.O(c))return 0;for(e=e.ao;e.next();){var g=e.value;if(null!==g&&g.visible)for(var g=g.pb.o,h=g.length,k=0;k<h;k++){var l=g[k];if(l instanceof J){if(l===a)return 0<d.length&&d.sort(function(a,b){return a-b}),d.length;if(l.isVisible()&&Qr(l)){var m=l.qo;m.F()&&a.qo.Wg(m)&&!a.usesSamePort(l)&&(m=l.path,null!==m&&m.Nj()&&gs(b,c,d,l))}}}}0<d.length&&d.sort(function(a,b){return a-b});return d.length}
function gs(a,b,c,d){for(var e=Q(a.y,b.y),g=d.ta,h=d.n(0),k=D.P(),l=1;l<g;l++){var m=d.n(l);if(l<g-1){var n=d.n(l+1);if(h.y===m.y&&m.y===n.y){if(m.x>h.x&&n.x>m.x||m.x<h.x&&n.x<m.x)m=n,l++}else h.x===m.x&&m.x===n.x&&(m.y>h.y&&n.y>m.y||m.y<h.y&&n.y<m.y)&&(m=n,l++)}a:{var n=k,p=a.x,q=a.y,r=b.x,s=b.y,u=h.x,h=h.y,t=m.x,y=m.y;if(!Q(p,r)){if(Q(q,s)&&Q(u,t)&&Math.min(p,r)<u&&Math.max(p,r)>u&&Math.min(h,y)<q&&Math.max(h,y)>q&&!Q(h,y)){n.x=u;n.y=q;n=!0;break a}}else if(!Q(q,s)&&Q(h,y)&&Math.min(q,s)<h&&Math.max(q,
s)>h&&Math.min(u,t)<p&&Math.max(u,t)>p&&!Q(u,t)){n.x=p;n.y=h;n=!0;break a}n.x=0;n.y=0;n=!1}n&&(e?c.push(k.x):c.push(k.y));h=m}D.A(k)}D.w(J,{ju:"firstPickIndex"},function(){var a;2>=this.ta?a=0:((a=this.qc)||(a=this.computeSpot(!0)!==bc),a=a?1:0);return a});D.w(J,{ay:"lastPickIndex"},function(){var a=this.ta;if(0===a)a=0;else if(2>=a)a-=1;else{var b;(b=this.qc)||(b=this.computeSpot(!1)!==bc);a=b?a-2:a-1}return a});function Qr(a){a=a.gf;return a===lj||a===mj}
function Sr(a,b){if(b||Qr(a)){var c=a.g;null===c||c.sl.contains(a)||null===a.Iw||c.sl.add(a,a.Iw)}}function oj(a,b){var c=a.layer;if(null!==c&&c.visible&&!c.Tc){var d=c.g;if(null!==d)for(var e=!1,d=d.ao;d.next();){var g=d.value;if(g.visible)if(g===c)for(var e=!0,h=!1,g=g.pb.o,k=g.length,l=0;l<k;l++){var m=g[l];m instanceof J&&(m===a?h=!0:h&&hs(a,m,b))}else if(e)for(g=g.pb.o,k=g.length,l=0;l<k;l++)m=g[l],m instanceof J&&hs(a,m,b)}}}
function hs(a,b,c){if(null!==b&&null!==b.ob&&Qr(b)){var d=b.qo;d.F()&&(a.qo.Wg(d)||c.Wg(d))&&(a.usesSamePort(b)||b.Re())}}J.prototype.usesSamePort=function(a){var b=this.ta,c=a.ta;if(0<b&&0<c){var d=this.n(0),e=a.n(0);if(d.Sc(e))return!0;b=this.n(b-1);a=a.n(c-1);if(b.Sc(a)||d.Sc(a)||b.Sc(e))return!0}else if(this.aa===a.aa||this.da===a.da||this.aa===a.da||this.da===a.aa)return!0;return!1};
J.prototype.isVisible=function(){if(!F.prototype.isVisible.call(this))return!1;var a=this.Pa,b=!0,c=this.g;null!==c&&(b=c.$d);var d=this.aa;if(null!==d){if(this.Uc&&b&&!d.rd)return!1;if(d===a)return!0;for(c=d;null!==c;){if(c.zc===this)return!0;c=c.Pa}c=d.findVisibleNode();if(null===c||c===a)return!1}d=this.da;if(null!==d){if(this.Uc&&!b&&!d.rd)return!1;if(d===a)return!0;for(c=d;null!==c;){if(c.zc===this)return!0;c=c.Pa}b=d.findVisibleNode();if(null===b||b===a)return!1}return!0};
J.prototype.Hd=function(a){F.prototype.Hd.call(this,a);null!==this.Mi&&this.Mi.wq();if(null!==this.zf)for(var b=this.zf.j;b.next();)b.value.Hd(a)};D.defineProperty(J,{St:"adjusting"},function(){return this.cr},function(a){var b=this.cr;b!==a&&(v&&D.Ca(a,J,J,"adjusting"),this.cr=a,this.i("adjusting",b,a))});D.defineProperty(J,{yA:"corner"},function(){return this.xr},function(a){var b=this.xr;b!==a&&(v&&D.h(a,"number",J,"corner"),this.xr=a,this.Re(),this.i("corner",b,a))});
D.defineProperty(J,{gf:"curve"},function(){return this.Ar},function(a){var b=this.Ar;b!==a&&(v&&D.Ca(a,J,J,"curve"),this.Ar=a,this.fc(),this.Re(),Sr(this,b===mj||b===lj||a===mj||a===lj),this.i("curve",b,a))});D.defineProperty(J,{yx:"curviness"},function(){return this.Br},function(a){var b=this.Br;b!==a&&(v&&D.h(a,"number",J,"curviness"),this.Br=a,this.fc(),this.Re(),this.i("curviness",b,a))});
D.defineProperty(J,{Ay:"routing"},function(){return this.mn},function(a){var b=this.mn;b!==a&&(v&&D.Ca(a,J,J,"routing"),this.mn=a,this.Yi=null,this.fc(),Sr(this,2===(b.value&2)||2===(a.value&2)),this.i("routing",b,a))});D.defineProperty(J,{Tq:"smoothness"},function(){return this.wt},function(a){var b=this.wt;b!==a&&(v&&D.h(a,"number",J,"smoothness"),this.wt=a,this.Re(),this.i("smoothness",b,a))});
function Or(a){var b=a.yg;if(null!==b){var c=a.Pg;if(null!==c){var d=a.ci;a=a.xi;for(var e=null,g=null,h=b.uc.o,k=h.length,l=0;l<k;l++){var m=h[l];if(m.yg===b&&m.ci===d&&m.Pg===c&&m.xi===a||m.yg===c&&m.ci===a&&m.Pg===b&&m.xi===d)null===g?g=m:(null===e&&(e=[],e.push(g)),e.push(m))}if(null!==e){g=zr(b,c,d,a);null===g&&(g=new Dl,g.Eq=b,g.py=d,g.Lu=c,g.qy=a,yr(b,g),yr(c,g));g.links=e;for(l=0;l<e.length;l++)m=e[l],m.Mi=g;g.wq()}}}}
function Nr(a){var b=a.Mi;null!==b&&(a.Mi=null,a=b.links.indexOf(a),0<=a&&(D.Sg(b.links,a),b.wq()))}function Dl(){D.tc(this);this.dw=!1;this.qy=this.Lu=this.py=this.Eq=null;this.links=[]}Dl.prototype.wq=function(){if(!this.dw){var a=this.links;0<a.length&&(a=a[0].g,null!==a&&a.eD.add(this))}this.dw=!0};
Dl.prototype.XB=function(){if(this.dw){this.dw=!1;var a=this.links;if(0<a.length){var b=a[0],c=b.g;b.arrangeBundledLinks(a,null===c||c.Zn);1===a.length&&(b.Mi=null,a.length=0)}0===a.length&&(a=this.Eq,null!==this&&null!==a.Xh&&a.Xh.remove(this),a=this.Lu,null!==this&&null!==a.Xh&&a.Xh.remove(this))}};D.ke(Dl,{Eq:!0,py:!0,Lu:!0,qy:!0,links:!0,spacing:!0});
function In(){D.tc(this);this.KB=this.group=null;this.vq=!0;this.abort=!1;this.Wf=this.Vf=1;this.ys=this.xs=-1;this.Md=this.ce=8;this.wd=null;this.jH=!1;this.SG=22;this.ZF=111}D.ke(In,{group:!0,KB:!0,vq:!0,abort:!0,jH:!0,SG:!0,ZF:!0});
In.prototype.initialize=function(a){if(!(0>=a.width||0>=a.height)){var b=a.y,c=a.x+a.width,d=a.y+a.height;this.Vf=Math.floor((a.x-this.ce)/this.ce)*this.ce;this.Wf=Math.floor((b-this.Md)/this.Md)*this.Md;this.xs=Math.ceil((c+2*this.ce)/this.ce)*this.ce;this.ys=Math.ceil((d+2*this.Md)/this.Md)*this.Md;a=1+(Math.ceil((this.xs-this.Vf)/this.ce)|0);b=1+(Math.ceil((this.ys-this.Wf)/this.Md)|0);if(null===this.wd||this.yn<a-1||this.zn<b-1){c=[];for(d=0;d<=a;d++){for(var e=[],g=0;g<=b;g++)e[g]=0;c[d]=e}this.wd=
c;this.yn=a-1;this.zn=b-1}if(null!==this.wd)for(a=0;a<=this.yn;a++)for(b=0;b<=this.zn;b++)this.wd[a][b]=999999}};D.w(In,{sb:null},function(){return new B(this.Vf,this.Wf,this.xs-this.Vf,this.ys-this.Wf)});D.defineProperty(In,{cq:null},function(){return this.ce},function(a){0<a&&a!==this.ce&&(this.ce=a,this.initialize(this.sb))});D.defineProperty(In,{aq:null},function(){return this.Md},function(a){0<a&&a!==this.Md&&(this.Md=a,this.initialize(this.sb))});
function is(a,b,c){return a.Vf<=b&&b<=a.xs&&a.Wf<=c&&c<=a.ys}function $r(a,b,c){if(!is(a,b,c))return 0;b-=a.Vf;b/=a.ce;c-=a.Wf;c/=a.Md;return a.wd[b|0][c|0]}function Ln(a,b,c){is(a,b,c)&&(b-=a.Vf,b/=a.ce,c-=a.Wf,c/=a.Md,a.wd[b|0][c|0]=0)}function Kn(a){if(null!==a.wd)for(var b=0;b<=a.yn;b++)for(var c=0;c<=a.zn;c++)1<=a.wd[b][c]&&(a.wd[b][c]|=999999)}
In.prototype.vm=function(a,b,c,d){if(a>this.xs||a+c<this.Vf||b>this.ys||b+d<this.Wf)return!0;a=(a-this.Vf)/this.ce|0;b=(b-this.Wf)/this.Md|0;c=Math.max(0,c)/this.ce+1|0;var e=Math.max(0,d)/this.Md+1|0;0>a&&(c+=a,a=0);0>b&&(e+=b,b=0);if(0>c||0>e)return!0;d=Math.min(a+c-1,this.yn)|0;for(c=Math.min(b+e-1,this.zn)|0;a<=d;a++)for(e=b;e<=c;e++)if(0===this.wd[a][e])return!1;return!0};
function js(a,b,c,d,e,g,h,k,l){if(!(b<g||b>h||c<k||c>l)){var m,n;m=b|0;n=c|0;var p=a.wd[m][n];if(1<=p&&999999>p)for(e?n+=d:m+=d,p+=1;g<=m&&m<=h&&k<=n&&n<=l&&!(p>=a.wd[m][n]);)a.wd[m][n]=p,p+=1,e?n+=d:m+=d;m=e?n:m;if(e)if(0<d)for(c+=d;c<m;c+=d)js(a,b,c,1,!e,g,h,k,l),js(a,b,c,-1,!e,g,h,k,l);else for(c+=d;c>m;c+=d)js(a,b,c,1,!e,g,h,k,l),js(a,b,c,-1,!e,g,h,k,l);else if(0<d)for(b+=d;b<m;b+=d)js(a,b,c,1,!e,g,h,k,l),js(a,b,c,-1,!e,g,h,k,l);else for(b+=d;b>m;b+=d)js(a,b,c,1,!e,g,h,k,l),js(a,b,c,-1,!e,g,h,
k,l)}}function ks(a,b,c,d,e,g,h,k,l){b|=0;c|=0;var m=0,n=1;for(a.wd[b][c]=n;0===m&&b>g&&b<h&&c>k&&c<l;)n+=1,a.wd[b][c]=n,e?c+=d:b+=d,m=a.wd[b][c]}function ls(a,b,c,d,e,g,h,k,l){b|=0;c|=0;var m=0;for(a.wd[b][c]=999999;0===m&&b>g&&b<h&&c>k&&c<l;)a.wd[b][c]=999999,e?c+=d:b+=d,m=a.wd[b][c]}
function Zr(a,b,c,d,e,g){if(null!==a.wd){a.abort=!1;var h=b.x,k=b.y;if(is(a,h,k)&&(h-=a.Vf,h/=a.ce,k-=a.Wf,k/=a.Md,b=d.x,d=d.y,is(a,b,d)))if(b-=a.Vf,b/=a.ce,d-=a.Wf,d/=a.Md,1>=Math.abs(h-b)&&1>=Math.abs(k-d))a.abort=!0;else{var l=g.x,m=g.y,n=g.x+g.width,p=g.y+g.height,l=l-a.Vf,l=l/a.ce,m=m-a.Wf,m=m/a.Md,n=n-a.Vf,n=n/a.ce,p=p-a.Wf,p=p/a.Md;g=Math.max(0,Math.min(a.yn,l|0));n=Math.min(a.yn,Math.max(0,n|0));m=Math.max(0,Math.min(a.zn,m|0));p=Math.min(a.zn,Math.max(0,p|0));h|=0;k|=0;b|=0;d|=0;l=90===c||
270===c;ks(a,h,k,0===c||90===c?1:-1,l,g,n,m,p);ks(a,h,k,1,!l,g,n,m,p);ks(a,h,k,-1,!l,g,n,m,p);ls(a,b,d,0===e||90===e?1:-1,90===e||270===e,g,n,m,p);ls(a,b,d,1,!(90===e||270===e),g,n,m,p);ls(a,b,d,-1,!(90===e||270===e),g,n,m,p);a.abort||(js(a,h,k,1,!1,g,n,m,p),js(a,h,k,-1,!1,g,n,m,p),js(a,h,k,1,!0,g,n,m,p),js(a,h,k,-1,!0,g,n,m,p))}}}function Xr(){D.tc(this);this.port=this.Vc=null;this.kg=[];this.Dq=!1}D.ke(Xr,{Vc:!0,port:!0,kg:!0,Dq:!0});
Xr.prototype.toString=function(){for(var a=this.kg,b=this.Vc.toString()+" "+a.length.toString()+":",c=0;c<a.length;c++){var d=a[c];null!==d&&(b+="\n  "+d.toString())}return b};
function ms(a,b,c,d){b=b.offsetY;switch(b){case D.kd:return 90;case D.Yc:return 180;case D.ud:return 270;case D.ld:return 0}switch(b){case D.kd|D.ud:return 180<c?270:90;case D.Yc|D.ld:return 90<c&&270>=c?180:0}a=180*Math.atan2(a.height,a.width)/Math.PI;switch(b){case D.Yc|D.ud:return c>a&&c<=180+a?180:270;case D.ud|D.ld:return c>180-a&&c<=360-a?270:0;case D.ld|D.kd:return c>a&&c<=180+a?90:0;case D.kd|D.Yc:return c>180-a&&c<=360-a?180:90;case D.Yc|D.ud|D.ld:return 90<c&&c<=180+a?180:c>180+a&&c<=360-
a?270:0;case D.ud|D.ld|D.kd:return 180<c&&c<=360-a?270:c>a&&180>=c?90:0;case D.ld|D.kd|D.Yc:return c>a&&c<=180-a?90:c>180-a&&270>=c?180:0;case D.kd|D.Yc|D.ud:return c>180-a&&c<=180+a?180:c>180+a?270:90}d&&b!==(D.Yc|D.ud|D.ld|D.kd)&&(c-=15,0>c&&(c+=360));return c>a&&c<180-a?90:c>=180-a&&c<=180+a?180:c>180+a&&c<360-a?270:0}Xr.prototype.wq=function(){this.kg.length=0};
function Yr(a,b){var c=a.kg;if(0===c.length){a:if(!a.Dq){c=a.Dq;a.Dq=!0;var d,e=null,g=a.Vc,g=g instanceof I?g:null;if(null===g||g.Je)d=a.Vc.lF(a.port.sd);else{if(!g.$.F()){a.Dq=c;break a}e=g;d=e.kF()}var h=a.kg.length=0,k=a.port.eb(cc,D.P()),l=a.port.eb(rc,D.P()),g=D.gh(k.x,k.y,0,0);g.Ki(l);D.A(k);D.A(l);k=D.Fb(g.x+g.width/2,g.y+g.height/2);for(d=d.j;d.next();)if(l=d.value,l.isVisible()){var m=l.dd===a.port||l.aa.Ei(e),n=l.computeSpot(m);if(n.Kj()&&(m=m?l.Ld:l.dd,null!==m)){var p=m.Y;if(null!==p){var m=
l.computeOtherPoint(p,m),p=k.Jc(m),n=ms(g,n,p,l.qc),q=0;0===n?(q=D.ld,180<p&&(p-=360)):q=90===n?D.kd:180===n?D.Yc:D.ud;n=a.kg[h];void 0===n?(n=new ns(l,p,q),a.kg[h]=n):(n.link=l,n.angle=p,n.Ke=q);n.ny.set(m);h++}}}D.A(k);a.kg.sort(Xr.prototype.LJ);e=a.kg.length;k=-1;for(h=d=0;h<e;h++)n=a.kg[h],void 0!==n&&(n.Ke!==k&&(k=n.Ke,d=0),n.tq=d,d++);k=-1;d=0;for(h=e-1;0<=h;h--)n=a.kg[h],void 0!==n&&(n.Ke!==k&&(k=n.Ke,d=n.tq+1),n.Kn=d);h=a.kg;m=a.port;e=a.Vc.QJ;k=D.P();d=D.P();l=D.P();n=D.P();m.eb(cc,k);m.eb(ec,
d);m.eb(rc,l);m.eb(pc,n);var r=q=p=m=0;if(e===xr)for(var s=0;s<h.length;s++){var u=h[s];if(null!==u){var t=u.link.computeThickness();switch(u.Ke){case D.kd:q+=t;break;case D.Yc:r+=t;break;case D.ud:m+=t;break;default:case D.ld:p+=t}}}for(var y=0,w=0,C=1,s=0;s<h.length;s++)if(u=h[s],null!==u){var A,N;if(y!==u.Ke){y=u.Ke;switch(y){case D.kd:A=l;N=n;break;case D.Yc:A=n;N=k;break;case D.ud:A=k;N=d;break;default:case D.ld:A=d,N=l}var H=N.x-A.x;N=N.y-A.y;switch(y){case D.kd:q>Math.abs(H)?(C=Math.abs(H)/
q,q=Math.abs(H)):C=1;break;case D.Yc:r>Math.abs(N)?(C=Math.abs(N)/r,r=Math.abs(N)):C=1;break;case D.ud:m>Math.abs(H)?(C=Math.abs(H)/m,m=Math.abs(H)):C=1;break;default:case D.ld:p>Math.abs(N)?(C=Math.abs(N)/p,p=Math.abs(N)):C=1}w=0}var W=u.Bq;if(e===xr){t=u.link.computeThickness();t*=C;W.set(A);switch(y){case D.kd:W.x=A.x+H/2+q/2-w-t/2;break;case D.Yc:W.y=A.y+N/2+r/2-w-t/2;break;case D.ud:W.x=A.x+H/2-m/2+w+t/2;break;default:case D.ld:W.y=A.y+N/2-p/2+w+t/2}w+=t}else t=.5,e===ur&&(t=(u.tq+1)/(u.Kn+1)),
W.x=A.x+H*t,W.y=A.y+N*t}D.A(k);D.A(d);D.A(l);D.A(n);A=a.kg;for(H=0;H<A.length;H++)N=A[H],null!==N&&(N.Dx=a.computeEndSegmentLength(N));a.Dq=c;D.Mb(g)}c=a.kg}for(g=0;g<c.length;g++)if(A=c[g],null!==A&&A.link===b)return A;return null}Xr.prototype.LJ=function(a,b){return a===b?0:null===a?-1:null===b?1:a.Ke<b.Ke?-1:a.Ke>b.Ke?1:a.angle<b.angle?-1:a.angle>b.angle?1:0};
Xr.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.Vc,this.port,bc,b.dd===this.port),d=a.tq;if(0>d)return c;var e=a.Kn;if(1>=e||!b.qc)return c;var b=a.ny,g=a.Bq;if(a.Ke===D.Yc||a.Ke===D.kd)d=e-1-d;return((a=a.Ke===D.Yc||a.Ke===D.ld)?b.y<g.y:b.x<g.x)?c+8*d:(a?b.y===g.y:b.x===g.x)?c:c+8*(e-1-d)};function ns(a,b,c){this.link=a;this.angle=b;this.Ke=c;this.ny=new O;this.Kn=this.tq=0;this.Bq=new O;this.Dx=0}
D.ke(ns,{link:!0,angle:!0,Ke:!0,ny:!0,tq:!0,Kn:!0,Bq:!0,Dx:!0});ns.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.Ke.toString()+":"+this.tq.toString()+"/"+this.Kn.toString()+" "+this.Bq.toString()+" "+this.Dx.toString()+" "+this.ny.toString()};function Bo(){this.Gk=this.jk=Tc;this.Ek=this.hk=NaN;this.Dk=this.gk=vr;this.Fk=this.ik=NaN;this.Ht=this.Tr=null;this.It=this.Ur=Infinity}
Bo.prototype.copy=function(){var a=new Bo;a.jk=this.jk.V();a.Gk=this.Gk.V();a.hk=this.hk;a.Ek=this.Ek;a.gk=this.gk;a.Dk=this.Dk;a.ik=this.ik;a.Fk=this.Fk;a.Tr=this.Tr;a.Ht=this.Ht;a.Ur=this.Ur;a.It=this.It;return a};function I(a){G.call(this,a);this.Ba|=4608;this.As=new L(F);this.en=new L(I);this.Qb=this.At=this.Il=this.Bs=this.zs=null;this.te=new Tg;this.te.group=this}D.Sa(I,G);D.ja("Group",I);
I.prototype.cloneProtected=function(a){G.prototype.cloneProtected.call(this,a);this.Ba&=-32769;a.zs=this.zs;a.Bs=this.Bs;a.Il=this.Il;a.At=this.At;var b=a.gu(function(a){return a instanceof Rj});a.Qb=b instanceof Rj?b:null;null!==this.te?(a.te=this.te.copy(),a.te.group=a):(null!==a.te&&(a.te.group=null),a.te=null)};I.prototype.Bi=function(a){G.prototype.Bi.call(this,a);var b=a.pq();for(a=a.Mc;a.next();){var c=a.value;c.K();c.N(8);c.Zt();if(c instanceof G)c.fg(b);else if(c instanceof J)for(c=c.If;c.next();)c.value.fg(b)}};
I.prototype.po=function(a,b,c,d,e,g,h){if(a===mg&&"elements"===b)if(e instanceof Rj){var k=e;null===this.Qb?this.Qb=k:this.Qb!==k&&D.k("Cannot insert a second Placeholder into the visual tree of a Group.")}else e instanceof x&&(k=e.gu(function(a){return a instanceof Rj}),k instanceof Rj&&(null===this.Qb?this.Qb=k:this.Qb!==k&&D.k("Cannot insert a second Placeholder into the visual tree of a Group.")));else a===ng&&"elements"===b&&null!==this.Qb&&(d===this.Qb?this.Qb=null:d instanceof x&&this.Qb.tm(d)&&
(this.Qb=null));G.prototype.po.call(this,a,b,c,d,e,g,h)};I.prototype.yj=function(a,b,c,d){this.Hl=this.Qb;x.prototype.yj.call(this,a,b,c,d)};I.prototype.um=function(){if(!G.prototype.um.call(this))return!1;for(var a=this.Mc;a.next();){var b=a.value;if(b instanceof G){if(b.isVisible()&&Im(b))return!1}else if(b instanceof J&&b.isVisible()&&Im(b)&&b.aa!==this&&b.da!==this)return!1}return!0};D.w(I,{placeholder:"placeholder"},function(){return this.Qb});
D.defineProperty(I,{eI:"computesBoundsAfterDrag"},function(){return 0!==(this.Ba&2048)},function(a){var b=0!==(this.Ba&2048);b!==a&&(D.h(a,"boolean",I,"computesBoundsAfterDrag"),this.Ba^=2048,this.i("computesBoundsAfterDrag",b,a))});D.defineProperty(I,{ux:"computesBoundsIncludingLinks"},function(){return 0!==(this.Ba&4096)},function(a){D.h(a,"boolean",I,"computesBoundsIncludingLinks");var b=0!==(this.Ba&4096);b!==a&&(this.Ba^=4096,this.i("computesBoundsIncludingLinks",b,a))});
D.defineProperty(I,{fI:"computesBoundsIncludingLocation"},function(){return 0!==(this.Ba&8192)},function(a){D.h(a,"boolean",I,"computesBoundsIncludingLocation");var b=0!==(this.Ba&8192);b!==a&&(this.Ba^=8192,this.i("computesBoundsIncludingLocation",b,a))});D.defineProperty(I,{UI:"handlesDragDropForMembers"},function(){return 0!==(this.Ba&16384)},function(a){D.h(a,"boolean",I,"handlesDragDropForMembers");var b=0!==(this.Ba&16384);b!==a&&(this.Ba^=16384,this.i("handlesDragDropForMembers",b,a))});
D.w(I,{Mc:"memberParts"},function(){return this.As.j});function qr(a,b){if(a.As.add(b)){b instanceof I&&a.en.add(b);var c=a.DJ;if(null!==c){var d=!0,e=a.g;null!==e&&(d=e.ab,e.ab=!0);c(a,b);null!==e&&(e.ab=d)}a.isVisible()&&a.Je||b.Hd(!1)}b instanceof J&&!a.ux||(c=a.Qb,null===c&&(c=a),c.K())}
function pr(a,b){if(a.As.remove(b)){b instanceof I&&a.en.remove(b);var c=a.EJ;if(null!==c){var d=!0,e=a.g;null!==e&&(d=e.ab,e.ab=!0);c(a,b);null!==e&&(e.ab=d)}a.isVisible()&&a.Je||b.Hd(!0)}b instanceof J&&!a.ux||(c=a.Qb,null===c&&(c=a),c.K())}I.prototype.Mn=function(){if(0<this.As.count){var a=this.g;if(null!==a)for(var b=this.As.copy().j;b.next();)a.remove(b.value)}G.prototype.Mn.call(this)};
D.defineProperty(I,{Vb:"layout"},function(){return this.te},function(a){var b=this.te;b!==a&&(null!==a&&D.l(a,Tg,I,"layout"),null!==b&&(b.g=null,b.group=null),this.te=a,null!==a&&(a.g=this.g,a.group=this),this.i("layout",b,a))});D.defineProperty(I,{DJ:"memberAdded"},function(){return this.zs},function(a){var b=this.zs;b!==a&&(null!==a&&D.h(a,"function",I,"memberAdded"),this.zs=a,this.i("memberAdded",b,a))});
D.defineProperty(I,{EJ:"memberRemoved"},function(){return this.Bs},function(a){var b=this.Bs;b!==a&&(null!==a&&D.h(a,"function",I,"memberRemoved"),this.Bs=a,this.i("memberRemoved",b,a))});D.defineProperty(I,{gB:"memberValidation"},function(){return this.Il},function(a){var b=this.Il;b!==a&&(null!==a&&D.h(a,"function",I,"memberValidation"),this.Il=a,this.i("memberValidation",b,a))});
I.prototype.canAddMembers=function(a){var b=this.g;if(null===b)return!1;b=b.wb;for(a=Oh(a).j;a.next();)if(!b.isValidMember(this,a.value))return!1;return!0};I.prototype.addMembers=function(a,b){var c=this.g;if(null===c)return!1;for(var c=c.wb,d=!0,e=Oh(a).j;e.next();){var g=e.value;!b||c.isValidMember(this,g)?g.Pa=this:d=!1}return d};
D.defineProperty(I,{xK:"ungroupable"},function(){return 0!==(this.Ba&256)},function(a){var b=0!==(this.Ba&256);b!==a&&(D.h(a,"boolean",I,"ungroupable"),this.Ba^=256,this.i("ungroupable",b,a))});I.prototype.canUngroup=function(){if(!this.xK)return!1;var a=this.layer;if(null!==a&&!a.ox)return!1;a=a.g;return null===a||a.ox?!0:!1};
I.prototype.fg=function(a){void 0===a&&(a=null);var b=0!==(this.Ba&65536);G.prototype.fg.call(this,a);if(!b)for(0!==(this.Ba&65536)!==!0&&(this.Ba^=65536),b=this.kF();b.next();){var c=b.value;if(null===a||!a.contains(c)){var d=c.aa;null!==d&&d!==this&&d.Ei(this)&&!d.isVisible()?c.fc():(d=c.da,null!==d&&d!==this&&d.Ei(this)&&!d.isVisible()&&c.fc())}}};
I.prototype.findExternalLinksConnected=I.prototype.kF=function(){var a=this.pq();a.add(this);for(var b=new L(J),c=a.j;c.next();){var d=c.value;if(d instanceof G)for(d=d.Gd;d.next();){var e=d.value;a.contains(e)||b.add(e)}}return b.j};I.prototype.findExternalNodesConnected=function(){var a=this.pq();a.add(this);for(var b=new L(G),c=a.j;c.next();){var d=c.value;if(d instanceof G)for(d=d.Gd;d.next();){var e=d.value,g=e.aa;a.contains(g)&&g!==this||b.add(g);e=e.da;a.contains(e)&&e!==this||b.add(e)}}return b.j};
I.prototype.findContainingGroupChain=function(){function a(b,d){null!==b&&(d.add(b),a(b.Pa,d))}var b=new L(I);a(this,b);return b};I.prototype.findSubGraphParts=I.prototype.pq=function(){var a=new L(F);Ih(a,this,!0,0,!0);a.remove(this);return a};I.prototype.Hd=function(a){G.prototype.Hd.call(this,a);for(var b=this.Mc;b.next();)b.value.Hd(a)};I.prototype.collapseSubGraph=I.prototype.collapseSubGraph=function(){var a=this.g;if(null!==a&&!a.Oh){a.Oh=!0;var b=this.pq();os(this,b,a.Xa,this);a.Oh=!1}};
function os(a,b,c,d){for(var e=a.Mc;e.next();){var g=e.value;g.Hd(!1);if(g instanceof I){var h=g;h.Je&&(h.ZB=h.Je,os(h,b,c,d))}if(g instanceof G)g.fg(b),ll(c,g,d);else if(g instanceof J)for(g=g.If;g.next();)g.value.fg(b)}a.Je=!1}I.prototype.expandSubGraph=I.prototype.expandSubGraph=function(){var a=this.g;if(null!==a&&!a.Oh){a.Oh=!0;var b=this.pq();ps(this,b,a.Xa,this);a.Oh=!1}};
function ps(a,b,c,d){for(var e=a.Mc;e.next();){var g=e.value;g.Hd(!0);if(g instanceof I){var h=g;h.ZB&&(h.ZB=!1,ps(h,b,c,d))}if(g instanceof G)g.fg(b),kl(c,g,d);else if(g instanceof J)for(g=g.If;g.next();)g.value.fg(b)}a.Je=!0}
D.defineProperty(I,{Je:"isSubGraphExpanded"},function(){return 0!==(this.Ba&512)},function(a){var b=0!==(this.Ba&512);if(b!==a){D.h(a,"boolean",I,"isSubGraphExpanded");this.Ba^=512;var c=this.g;this.i("isSubGraphExpanded",b,a);b=this.nK;if(null!==b){var d=!0;null!==c&&(d=c.ab,c.ab=!0);b(this);null!==c&&(c.ab=d)}null!==c&&c.ra.nb?null!==this.Qb&&this.Qb.K():a?this.expandSubGraph():this.collapseSubGraph()}});
D.defineProperty(I,{ZB:"wasSubGraphExpanded"},function(){return 0!==(this.Ba&1024)},function(a){var b=0!==(this.Ba&1024);b!==a&&(D.h(a,"boolean",I,"wasSubGraphExpanded"),this.Ba^=1024,this.i("wasSubGraphExpanded",b,a))});D.defineProperty(I,{nK:"subGraphExpandedChanged"},function(){return this.At},function(a){var b=this.At;b!==a&&(null!==a&&D.h(a,"function",I,"subGraphExpandedChanged"),this.At=a,this.i("subGraphExpandedChanged",b,a))});
I.prototype.move=function(a){var b=this.position,c=b.x;isNaN(c)&&(c=0);b=b.y;isNaN(b)&&(b=0);var c=a.x-c,b=a.y-b,d=D.Fb(c,b);G.prototype.move.call(this,a);for(a=this.pq().j;a.next();){var e=a.value;if(!(e instanceof J||e instanceof G&&e.tf)){var g=e.position,h=e.location;g.F()?(d.x=g.x+c,d.y=g.y+b,e.position=d):h.F()&&(d.x=h.x+c,d.y=h.y+b,e.location=d)}}for(a.reset();a.next();)e=a.value,e instanceof J&&(g=e.position,d.x=g.x+c,d.y=g.y+b,e.move(d));D.A(d)};
D.defineProperty(I,{mo:null},function(){return 0!==(this.Ba&32768)},function(a){0!==(this.Ba&32768)!==a&&(this.Ba^=32768)});function Rj(){P.call(this);this.of=Ud;this.kt=new B(NaN,NaN,NaN,NaN)}D.Sa(Rj,P);D.ja("Placeholder",Rj);Rj.prototype.cloneProtected=function(a){P.prototype.cloneProtected.call(this,a);a.of=this.of.V();a.kt=this.kt.copy()};Rj.prototype.Mk=function(a){if(null===this.background&&null===this.Zl)return!1;var b=this.Ga;return Pb(0,0,b.width,b.height,a.x,a.y)};
Rj.prototype.ho=function(){var a=this.Y;null!==a&&(a instanceof I||a instanceof da)||D.k("Placeholder is not inside a Group or Adornment.");if(a instanceof I){var b=this.computeBorder(this.kt),c=this.$c;wb(c,b.width||0,b.height||0);Go(this,0,0,c.width,c.height);for(var c=a.Mc,d=!1;c.next();)if(c.value.isVisible()){d=!0;break}!d||isNaN(b.x)||isNaN(b.y)||(c=new O,c.so(b,a.Kf),a.location=new O(c.x,c.y))}else{var b=this.Ea,c=this.$c,d=this.padding,e=d.left+d.right,g=d.top+d.bottom;if(b.F())wb(c,b.width+
e||0,b.height+g||0),Go(this,-d.left,-d.top,c.width,c.height);else{var h=a.zb,k=h.eb(cc,D.P()),b=D.gh(k.x,k.y,0,0);b.Ki(h.eb(rc,k));b.Ki(h.eb(ec,k));b.Ki(h.eb(pc,k));a.hj.m(b.x,b.y);wb(c,b.width+e||0,b.height+g||0);Go(this,-d.left,-d.top,c.width,c.height);D.A(k);D.Mb(b)}}};Rj.prototype.yj=function(a,b,c,d){var e=this.$;e.x=a;e.y=b;e.width=c;e.height=d};
Rj.prototype.computeBorder=function(a){var b=this.Y;if(b instanceof I){var c=b;if(c.eI&&this.kt.F()){var d=c.g;if(null!==d&&(d=d.gb,d instanceof Mh&&!d.Mr&&null!==d.ec&&!d.ec.contains(c)))return a.assign(this.kt),a}}var c=D.Nf(),d=this.computeMemberBounds(c),e=this.padding;a.m(d.x-e.left,d.y-e.top,Math.max(d.width+e.left+e.right,0),Math.max(d.height+e.top+e.bottom,0));D.Mb(c);b instanceof I&&(c=b,c.fI&&c.location.F()&&a.Ki(c.location));return a};
Rj.prototype.computeMemberBounds=function(a){if(!(this.Y instanceof I))return a.m(0,0,0,0),a;for(var b=this.Y,c=Infinity,d=Infinity,e=-Infinity,g=-Infinity,h=b.Mc;h.next();){var k=h.value;if(k.isVisible()){if(k instanceof J){var l=k;if(!b.ux)continue;if(Hm(l))continue;if(l.aa===b||l.da===b)continue}k=k.$;k.left<c&&(c=k.left);k.top<d&&(d=k.top);k.right>e&&(e=k.right);k.bottom>g&&(g=k.bottom)}}isFinite(c)&&isFinite(d)?a.m(c,d,e-c,g-d):(b=b.location,c=this.padding,a.m(b.x+c.left,b.y+c.top,0,0));return a};
D.defineProperty(Rj,{padding:"padding"},function(){return this.of},function(a){"number"===typeof a?a=new Hb(a):D.l(a,Hb,Rj,"padding");var b=this.of;b.O(a)||(this.of=a=a.V(),this.i("padding",b,a))});function Tg(){0<arguments.length&&D.td(Tg);D.tc(this);this.Ez=this.ba=null;this.ok=this.gs=!0;this.ms=!1;this.gr=(new O(0,0)).freeze();this.js=this.ks=!0;this.QC="";this.pp=!1;this.Rz=null}D.ja("Layout",Tg);
Tg.prototype.cloneProtected=function(a){a.gs=this.gs;a.ok=this.ok;a.ms=this.ms;a.gr.assign(this.gr);a.ks=this.ks;a.js=this.js;a.QC=this.QC;this.ok||(a.pp=!0)};Tg.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};Tg.prototype.nc=function(a){D.Xj(this,a)};Tg.prototype.toString=function(){var a=D.qf(Object.getPrototypeOf(this)),a=a+"(";null!==this.group&&(a+=" in "+this.group);null!==this.g&&(a+=" for "+this.g);return a+")"};
D.defineProperty(Tg,{g:"diagram"},function(){return this.ba},function(a){null!==a&&D.l(a,E,Tg,"diagram");this.ba=a});D.defineProperty(Tg,{group:"group"},function(){return this.Ez},function(a){this.Ez!==a&&(null!==a&&D.l(a,I,Tg,"group"),this.Ez=a,null!==a&&(this.ba=a.g))});D.defineProperty(Tg,{jJ:"isOngoing"},function(){return this.gs},function(a){this.gs!==a&&(D.h(a,"boolean",Tg,"isOngoing"),this.gs=a)});
D.defineProperty(Tg,{SF:"isInitial"},function(){return this.ok},function(a){D.h(a,"boolean",Tg,"isInitial");this.ok=a;a||(this.pp=!0)});D.defineProperty(Tg,{Zx:"isViewportSized"},function(){return this.ms},function(a){this.ms!==a&&(D.h(a,"boolean",Tg,"isViewportSized"),(this.ms=a)&&this.N())});D.defineProperty(Tg,{zu:"isRouting"},function(){return this.ks},function(a){this.ks!==a&&(D.h(a,"boolean",Tg,"isRouting"),this.ks=a)});
D.defineProperty(Tg,{UF:"isRealtime"},function(){return this.js},function(a){this.js!==a&&(D.h(a,"boolean",Tg,"isRealtime"),this.js=a)});D.defineProperty(Tg,{Hf:"isValidLayout"},function(){return this.pp},function(a){this.pp!==a&&(D.h(a,"boolean",Tg,"isValidLayout"),this.pp=a,a||(a=this.g,null!==a&&(a.wv=!0)))});Tg.prototype.invalidateLayout=Tg.prototype.N=function(){if(this.pp){var a=this.g;if(null!==a&&!a.ra.nb){var b=a.Xa;!b.op&&(b.sf&&b.Ii(),this.jJ&&a.Zn||this.SF&&!a.Zn)&&(this.Hf=!1,a.Se())}}};
D.defineProperty(Tg,{network:"network"},function(){return this.Rz},function(a){var b=this.Rz;b!==a&&(null!==a&&D.l(a,va,Tg,"network"),null!==b&&(b.Vb=null),this.Rz=a,null!==a&&(a.Vb=this))});Tg.prototype.createNetwork=function(){return new va};Tg.prototype.makeNetwork=function(a){var b=this.createNetwork();b.Vb=this;a instanceof E?(b.Jk(a.ng,!0),b.Jk(a.links,!0)):a instanceof I?b.Jk(a.Mc):b.Jk(a.j);return b};
Tg.prototype.updateParts=function(){var a=this.g;if(null===a&&null!==this.network)for(var b=this.network.vertexes.j;b.next();){var c=b.value.Vc;if(null!==c&&(a=c.g,null!==a))break}this.Hf=!0;try{null!==a&&a.$b("Layout"),this.commitLayout()}finally{null!==a&&a.Td("Layout")}};Tg.prototype.commitLayout=function(){for(var a=this.network.vertexes.j;a.next();)a.value.commit();if(this.zu)for(a=this.network.edges.j;a.next();)a.value.commit()};
Tg.prototype.doLayout=function(a){null===a&&D.k("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");var b=new L(F);a instanceof E?(qs(this,b,a.ng,!0,this.mo,!0,!1,!0),qs(this,b,a.Gi,!0,this.mo,!0,!1,!0)):a instanceof I?qs(this,b,a.Mc,!1,this.mo,!0,!1,!0):b.Rc(a.j);var c=b.count;if(0<c){a=this.g;null!==a&&a.$b("Layout");for(var c=Math.ceil(Math.sqrt(c)),d=this.Ae.x,e=d,g=this.Ae.y,h=0,k=0,b=b.j;b.next();){var l=b.value;l.hf();var m=l.Fa,n=m.width,
m=m.height;l.moveTo(e,g);l instanceof I&&(l.mo=!1);e+=Math.max(n,50)+20;k=Math.max(k,Math.max(m,50));h>=c-1?(h=0,e=d,g+=k+20,k=0):h++}null!==a&&a.Td("Layout")}this.Hf=!0};Tg.prototype.mo=function(a){return!a.location.F()||a instanceof I&&a.mo?!0:!1};
function qs(a,b,c,d,e,g,h,k){for(c=c.j;c.next();){var l=c.value;d&&!l.zq||null!==e&&!e(l)||!l.canLayout()||(g&&l instanceof G?l.tf||(l instanceof I?null===l.Vb?qs(a,b,l.Mc,!1,e,g,h,k):(rs(l),b.add(l)):(rs(l),b.add(l))):h&&l instanceof J?b.add(l):!k||!l.oe()||l instanceof G||(rs(l),b.add(l)))}}function rs(a){var b=a.$;(0===b.width||0===b.height||isNaN(b.width)||isNaN(b.height))&&a.hf()}
Tg.prototype.collectParts=Tg.prototype.ZH=function(a){var b=new L(F);a instanceof E?(qs(this,b,a.ng,!0,null,!0,!0,!0),qs(this,b,a.links,!0,null,!0,!0,!0),qs(this,b,a.Gi,!0,null,!0,!0,!0)):a instanceof I?qs(this,b,a.Mc,!1,null,!0,!0,!0):qs(this,b,a.j,!1,null,!0,!0,!0);return b};D.defineProperty(Tg,{Ae:"arrangementOrigin"},function(){return this.gr},function(a){D.l(a,O,Tg,"arrangementOrigin");this.gr.O(a)||(this.gr.assign(a),this.N())});
Tg.prototype.initialOrigin=function(a){var b=this.group;if(null!==b){var c=b.position.copy();(isNaN(c.x)||isNaN(c.y))&&c.set(a);b=b.placeholder;null!==b&&(c=b.eb(cc),(isNaN(c.x)||isNaN(c.y))&&c.set(a),c.x+=b.padding.left,c.y+=b.padding.top);return c}return a};
function va(){D.tc(this);this.te=null;if(this.vertexes)for(var a=this.vertexes.j;a.next();){var b=a.value;b.clear();b.network=null}if(this.edges)for(a=this.edges.j;a.next();)b=a.value,b.clear(),b.network=null;this.vertexes=new L(wa);this.edges=new L(xa);this.ky=new ma(G,wa);this.ey=new ma(J,xa)}D.ja("LayoutNetwork",va);
va.prototype.clear=function(){if(this.vertexes)for(var a=this.vertexes.j;a.next();){var b=a.value;b.clear();b.network=null}if(this.edges)for(a=this.edges.j;a.next();)b=a.value,b.clear(),b.network=null;this.vertexes=new L(wa);this.edges=new L(xa);this.ky=new ma(G,wa);this.ey=new ma(J,xa)};
va.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutNetwork"+(null!==this.Vb?"("+this.Vb.toString()+")":"");if(0>=a)return b;b+=" vertexes: "+this.vertexes.count+" edges: "+this.edges.count;if(1<a){for(var c=this.vertexes.j;c.next();)b+="\n    "+c.value.toString(a-1);for(c=this.edges.j;c.next();)b+="\n    "+c.value.toString(a-1)}return b};D.defineProperty(va,{Vb:"layout"},function(){return this.te},function(a){v&&null!==a&&D.l(a,Tg,va,"layout");this.te=a});va.prototype.createVertex=function(){return new wa};
va.prototype.createEdge=function(){return new xa};
va.prototype.addParts=va.prototype.Jk=function(a,b,c){if(null!==a){void 0===b&&(b=!1);D.h(b,"boolean",va,"addParts:toplevelonly");void 0===c&&(c=null);null===c&&(c=function(a){if(a instanceof G)return!a.tf;if(a instanceof J){var b=a.aa;if(null===b||b.tf)return!1;a=a.da;return null===a||a.tf?!1:!0}return!1});for(a=a.j;a.next();){var d=a.value;if(d instanceof G&&(!b||d.zq)&&d.canLayout()&&c(d))if(d instanceof I&&null===d.Vb)this.Jk(d.Mc,!1);else if(null===this.Qn(d)){var e=this.createVertex();e.Vc=
d;this.Xl(e)}}for(a.reset();a.next();)if(d=a.value,d instanceof J&&(!b||d.zq)&&d.canLayout()&&c(d)&&null===this.Fx(d)){var g=d.aa,e=d.da;null!==g&&null!==e&&g!==e&&(g=this.findGroupVertex(g),e=this.findGroupVertex(e),null!==g&&null!==e&&this.Cq(g,e,d))}}};va.prototype.findGroupVertex=function(a){if(null===a)return null;var b=a.findVisibleNode();if(null===b)return null;a=this.Qn(b);if(null!==a)return a;for(b=b.Pa;null!==b;){a=this.Qn(b);if(null!==a)return a;b=b.Pa}return null};
va.prototype.addVertex=va.prototype.Xl=function(a){if(null!==a){v&&D.l(a,wa,va,"addVertex:vertex");this.vertexes.add(a);var b=a.Vc;null!==b&&this.ky.add(b,a);a.network=this}};va.prototype.addNode=va.prototype.Rt=function(a){if(null===a)return null;v&&D.l(a,G,va,"addNode:node");var b=this.Qn(a);null===b&&(b=this.createVertex(),b.Vc=a,this.Xl(b));return b};
va.prototype.deleteVertex=va.prototype.aF=function(a){if(null!==a&&(v&&D.l(a,wa,va,"deleteVertex:vertex"),ss(this,a))){for(var b=a.Ve,c=b.count-1;0<=c;c--){var d=b.ea(c);this.kq(d)}b=a.Pe;for(c=b.count-1;0<=c;c--)d=b.ea(c),this.kq(d)}};function ss(a,b){if(null===b)return!1;var c=a.vertexes.remove(b);c&&(a.ky.remove(b.Vc),b.network=null);return c}va.prototype.deleteNode=function(a){null!==a&&(v&&D.l(a,G,va,"deleteNode:node"),a=this.Qn(a),null!==a&&this.aF(a))};
va.prototype.findVertex=va.prototype.Qn=function(a){if(null===a)return null;v&&D.l(a,G,va,"findVertex:node");return this.ky.oa(a)};va.prototype.addEdge=va.prototype.Yp=function(a){if(null!==a){v&&D.l(a,xa,va,"addEdge:edge");this.edges.add(a);var b=a.link;null!==b&&null===this.Fx(b)&&this.ey.add(b,a);b=a.toVertex;null!==b&&b.DE(a);b=a.fromVertex;null!==b&&b.BE(a);a.network=this}};
va.prototype.addLink=function(a){if(null===a)return null;v&&D.l(a,J,va,"addLink:link");var b=a.aa,c=a.da,d=this.Fx(a);null===d?(d=this.createEdge(),d.link=a,null!==b&&(d.fromVertex=this.Rt(b)),null!==c&&(d.toVertex=this.Rt(c)),this.Yp(d)):(d.fromVertex=null!==b?this.Rt(b):null,d.toVertex=null!==c?this.Rt(c):null);return d};va.prototype.deleteEdge=va.prototype.kq=function(a){if(null!==a){v&&D.l(a,xa,va,"deleteEdge:edge");var b=a.toVertex;null!==b&&b.$E(a);b=a.fromVertex;null!==b&&b.ZE(a);ts(this,a)}};
function ts(a,b){null!==b&&a.edges.remove(b)&&(a.ey.remove(b.link),b.network=null)}va.prototype.deleteLink=function(a){null!==a&&(v&&D.l(a,J,va,"deleteLink:link"),a=this.Fx(a),null!==a&&this.kq(a))};va.prototype.findEdge=va.prototype.Fx=function(a){if(null===a)return null;v&&D.l(a,J,va,"findEdge:link");return this.ey.oa(a)};
va.prototype.linkVertexes=va.prototype.Cq=function(a,b,c){if(null===a||null===b)return null;v&&(D.l(a,wa,va,"linkVertexes:fromVertex"),D.l(b,wa,va,"linkVertexes:toVertex"),null!==c&&D.l(c,J,va,"linkVertexes:link"));if(a.network===this&&b.network===this){var d=this.createEdge();d.link=c;d.fromVertex=a;d.toVertex=b;this.Yp(d);return d}return null};
va.prototype.reverseEdge=va.prototype.zy=function(a){if(null!==a){v&&D.l(a,xa,va,"reverseEdge:edge");var b=a.fromVertex,c=a.toVertex;null!==b&&null!==c&&(b.ZE(a),c.$E(a),a.zy(),b.DE(a),c.BE(a))}};va.prototype.deleteSelfEdges=va.prototype.Ax=function(){for(var a=D.tb(),b=this.edges.j;b.next();){var c=b.value;c.fromVertex===c.toVertex&&a.push(c)}b=a.length;for(c=0;c<b;c++)this.kq(a[c]);D.Aa(a)};
va.prototype.deleteArtificialVertexes=function(){for(var a=D.tb(),b=this.vertexes.j;b.next();){var c=b.value;null===c.Vc&&a.push(c)}for(var c=a.length,d=0;d<c;d++)this.aF(a[d]);b=D.tb();for(c=this.edges.j;c.next();)d=c.value,null===d.link&&b.push(d);c=b.length;for(d=0;d<c;d++)this.kq(b[d]);D.Aa(a);D.Aa(b)};function us(a){for(var b=D.tb(),c=a.edges.j;c.next();){var d=c.value;null!==d.fromVertex&&null!==d.toVertex||b.push(d)}c=b.length;for(d=0;d<c;d++)a.kq(b[d]);D.Aa(b)}
va.prototype.splitIntoSubNetworks=va.prototype.mK=function(){this.deleteArtificialVertexes();us(this);this.Ax();for(var a=new K(va),b=!0;b;)for(var b=!1,c=this.vertexes.j;c.next();){var d=c.value;if(0<d.Ve.count||0<d.Pe.count){b=this.Vb.createNetwork();a.add(b);vs(this,b,d);b=!0;break}}a.sort(function(a,b){return null===a||null===b||a===b?0:b.vertexes.count-a.vertexes.count});return a};
function vs(a,b,c){if(null!==c&&c.network!==b){ss(a,c);b.Xl(c);for(var d=c.sc;d.next();){var e=d.value;e.network!==b&&(ts(a,e),b.Yp(e),vs(a,b,e.fromVertex))}for(d=c.pc;d.next();)c=d.value,c.network!==b&&(ts(a,c),b.Yp(c),vs(a,b,c.toVertex))}}va.prototype.findAllParts=function(){for(var a=new L(F),b=this.vertexes.j;b.next();)a.add(b.value.Vc);for(b=this.edges.j;b.next();)a.add(b.value.link);return a};
function wa(){D.tc(this);this.network=null;this.R=(new B(0,0,10,10)).freeze();this.W=(new O(5,5)).freeze();this.Bd=this.Nd=null;this.Ve=new K(xa);this.Pe=new K(xa)}D.ja("LayoutVertex",wa);wa.prototype.clear=function(){this.Bd=this.Nd=null;this.Ve=new K(xa);this.Pe=new K(xa)};
wa.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutVertex#"+D.Fd(this);if(0<a&&(b+=null!==this.Vc?"("+this.Vc.toString()+")":"",1<a)){a="";for(var c=!0,d=this.Ve.j;d.next();){var e=d.value;c?c=!1:a+=",";a+=e.toString(0)}e="";c=!0;for(d=this.Pe.j;d.next();){var g=d.value;c?c=!1:e+=",";e+=g.toString(0)}b+=" sources: "+a+" destinations: "+e}return b};
D.defineProperty(wa,{data:"data"},function(){return this.Nd},function(a){this.Nd=a;if(null!==a){var b=a.bounds;a=b.x;var c=b.y,d=b.width,b=b.height;this.W.m(d/2,b/2);this.R.m(a,c,d,b)}});
D.defineProperty(wa,{Vc:"node"},function(){return this.Bd},function(a){if(this.Bd!==a){v&&null!==a&&D.l(a,G,wa,"node");this.Bd=a;a.hf();var b=a.$,c=b.x,d=b.y,e=b.width,b=b.height;isNaN(c)&&(c=0);isNaN(d)&&(d=0);this.R.m(c,d,e,b);if(!(a instanceof I)&&(a=a.uf.eb(gc),a.F())){this.W.m(a.x-c,a.y-d);return}this.W.m(e/2,b/2)}});D.defineProperty(wa,{sb:"bounds"},function(){return this.R},function(a){this.R.O(a)||(v&&D.l(a,B,wa,"bounds"),this.R.assign(a))});
D.defineProperty(wa,{focus:"focus"},function(){return this.W},function(a){this.W.O(a)||(v&&D.l(a,O,wa,"focus"),this.W.assign(a))});D.defineProperty(wa,{na:"centerX"},function(){return this.R.x+this.W.x},function(a){var b=this.R;b.x+this.W.x!==a&&(v&&D.p(a,wa,"centerX"),b.Ya(),b.x=a-this.W.x,b.freeze())});D.defineProperty(wa,{va:"centerY"},function(){return this.R.y+this.W.y},function(a){var b=this.R;b.y+this.W.y!==a&&(v&&D.p(a,wa,"centerY"),b.Ya(),b.y=a-this.W.y,b.freeze())});
D.defineProperty(wa,{lu:"focusX"},function(){return this.W.x},function(a){var b=this.W;b.x!==a&&(b.Ya(),b.x=a,b.freeze())});D.defineProperty(wa,{mu:"focusY"},function(){return this.W.y},function(a){var b=this.W;b.y!==a&&(b.Ya(),b.y=a,b.freeze())});D.defineProperty(wa,{x:"x"},function(){return this.R.x},function(a){var b=this.R;b.x!==a&&(b.Ya(),b.x=a,b.freeze())});D.defineProperty(wa,{y:"y"},function(){return this.R.y},function(a){var b=this.R;b.y!==a&&(b.Ya(),b.y=a,b.freeze())});
D.defineProperty(wa,{width:"width"},function(){return this.R.width},function(a){var b=this.R;b.width!==a&&(b.Ya(),b.width=a,b.freeze())});D.defineProperty(wa,{height:"height"},function(){return this.R.height},function(a){var b=this.R;b.height!==a&&(b.Ya(),b.height=a,b.freeze())});
wa.prototype.commit=function(){var a=this.Nd;if(null!==a){var b=this.sb,c=a.bounds;D.Ta(c)?(c.x=b.x,c.y=b.y,c.width=b.width,c.height=b.height):a.bounds=b.copy()}else if(a=this.Vc,null!==a){b=this.sb;if(!(a instanceof I)){var c=a.$,d=a.uf.eb(gc);if(c.F()&&d.F()){a.moveTo(b.x+this.lu-(d.x-c.x),b.y+this.mu-(d.y-c.y));return}}a.moveTo(b.x,b.y)}};wa.prototype.addSourceEdge=wa.prototype.DE=function(a){null!==a&&(v&&D.l(a,xa,wa,"addSourceEdge:edge"),this.Ve.contains(a)||this.Ve.add(a))};
wa.prototype.deleteSourceEdge=wa.prototype.$E=function(a){null!==a&&(v&&D.l(a,xa,wa,"deleteSourceEdge:edge"),this.Ve.remove(a))};wa.prototype.addDestinationEdge=wa.prototype.BE=function(a){null!==a&&(v&&D.l(a,xa,wa,"addDestinationEdge:edge"),this.Pe.contains(a)||this.Pe.add(a))};wa.prototype.deleteDestinationEdge=wa.prototype.ZE=function(a){null!==a&&(v&&D.l(a,xa,wa,"deleteDestinationEdge:edge"),this.Pe.remove(a))};
D.w(wa,{lK:"sourceVertexes"},function(){for(var a=new L(wa),b=this.sc;b.next();)a.add(b.value.fromVertex);return a.j});D.w(wa,{qI:"destinationVertexes"},function(){for(var a=new L(wa),b=this.pc;b.next();)a.add(b.value.toVertex);return a.j});D.w(wa,{vertexes:"vertexes"},function(){for(var a=new L(wa),b=this.sc;b.next();)a.add(b.value.fromVertex);for(b=this.pc;b.next();)a.add(b.value.toVertex);return a.j});D.w(wa,{sc:"sourceEdges"},function(){return this.Ve.j});D.w(wa,{pc:"destinationEdges"},function(){return this.Pe.j});
D.w(wa,{edges:"edges"},function(){for(var a=new K(xa),b=this.sc;b.next();)a.add(b.value);for(b=this.pc;b.next();)a.add(b.value);return a.j});D.w(wa,{BI:"edgesCount"},function(){return this.Ve.count+this.Pe.count});var ws;wa.standardComparer=ws=function(a,b){v&&D.l(a,wa,wa,"standardComparer:m");v&&D.l(b,wa,wa,"standardComparer:n");var c=a.Bd,d=b.Bd;return c?d?(c=c.text,d=d.text,c<d?-1:c>d?1:0):1:null!==d?-1:0};
wa.smartComparer=function(a,b){v&&D.l(a,wa,wa,"smartComparer:m");v&&D.l(b,wa,wa,"smartComparer:n");if(null!==a){if(null!==b){var c=a.Bd,d=b.Bd;if(null!==c){if(null!==d){for(var c=c.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/),d=d.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/),e=0;e<c.length;e++)if(""!==d[e]&&void 0!==d[e]){var g=parseFloat(c[e]),h=parseFloat(d[e]);if(isNaN(g)){if(!isNaN(h))return 1;if(0!==c[e].localeCompare(d[e]))return c[e].localeCompare(d[e])}else{if(isNaN(h))return-1;
if(0!==g-h)return g-h}}else if(""!==c[e])return 1;return""!==d[e]&&void 0!==d[e]?-1:0}return 1}return null!==d?-1:0}return 1}return null!==b?-1:0};function xa(){D.tc(this);this.toVertex=this.fromVertex=this.link=this.data=this.network=null}D.ja("LayoutEdge",xa);xa.prototype.clear=function(){this.toVertex=this.fromVertex=this.link=this.data=null};
xa.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutEdge#"+D.Fd(this);0<a&&(b+=null!==this.link?"("+this.link.toString()+")":"",1<a&&(b+=" "+(this.fromVertex?this.fromVertex.toString():"null")+" --\x3e "+(this.toVertex?this.toVertex.toString():"null")));return b};xa.prototype.zy=function(){var a=this.fromVertex;this.fromVertex=this.toVertex;this.toVertex=a};xa.prototype.commit=function(){};
xa.prototype.getOtherVertex=xa.prototype.LI=function(a){v&&D.l(a,wa,xa,"getOtherVertex:v");return this.toVertex===a?this.fromVertex:this.fromVertex===a?this.toVertex:null};function Tn(){0<arguments.length&&D.td(Tn);Tg.call(this);this.Zx=!0;this.Mt=this.Nt=NaN;this.bk=(new Ca(NaN,NaN)).freeze();this.ri=(new Ca(10,10)).freeze();this.re=xs;this.vd=ys;this.qi=zs;this.Zh=As}D.Sa(Tn,Tg);D.ja("GridLayout",Tn);
Tn.prototype.cloneProtected=function(a){Tg.prototype.cloneProtected.call(this,a);a.Nt=this.Nt;a.Mt=this.Mt;a.bk.assign(this.bk);a.ri.assign(this.ri);a.re=this.re;a.vd=this.vd;a.qi=this.qi;a.Zh=this.Zh};Tn.prototype.nc=function(a){a.Ne===Tn?a===zs||a===Bs||a===Cs||a===Ds?this.sorting=a:a===ys||a===Es?this.$f=a:a===xs||a===Fs?this.alignment=a:D.k("Unknown enum value: "+a):Tg.prototype.nc.call(this,a)};
Tn.prototype.doLayout=function(a){null===a&&D.k("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");this.Ae=this.initialOrigin(this.Ae);var b=this.g;a=this.ZH(a);for(var c=a.copy().j;c.next();){var d=c.value;if(d instanceof J){var e=d;if(null!==e.aa||null!==e.da){a.remove(e);continue}}d.hf();if(d instanceof I)for(d=d.Mc;d.next();)a.remove(d.value)}e=a.lc();if(0!==e.length){switch(this.sorting){case Ds:e.reverse();break;case zs:e.sort(this.comparer);
break;case Bs:e.sort(this.comparer),e.reverse()}var g=this.BK;isNaN(g)&&(g=0);var h=this.lH,h=isNaN(h)&&null!==b?Math.max(b.xb.width-b.padding.left-b.padding.right,0):Math.max(this.lH,0);0>=g&&0>=h&&(g=1);a=this.spacing.width;isFinite(a)||(a=0);c=this.spacing.height;isFinite(c)||(c=0);null!==b&&b.$b("Layout");d=[];switch(this.alignment){case Fs:var k=a,l=c,m=Math.max(this.bq.width,1);if(!isFinite(m))for(var n=m=0;n<e.length;n++)var p=e[n],q=p.Fa,m=Math.max(m,q.width);var m=Math.max(m+k,1),r=Math.max(this.bq.height,
1);if(!isFinite(r))for(n=r=0;n<e.length;n++)p=e[n],q=p.Fa,r=Math.max(r,q.height);for(var r=Math.max(r+l,1),s=this.$f,u=this.Ae.x,t=u,y=this.Ae.y,w=0,C=0,n=0;n<e.length;n++){var p=e[n],q=p.Fa,A=Math.ceil((q.width+k)/m)*m,N=Math.ceil((q.height+l)/r)*r,H=0;switch(s){case Es:H=Math.abs(t-q.width);break;default:H=t+q.width}if(0<g&&w>g-1||0<h&&0<w&&H>h)d.push(new B(0,y,h+k,C)),w=0,t=u,y+=C,C=0;C=Math.max(C,N);N=0;switch(s){case Es:N=-q.width;break;default:N=0}p.moveTo(t+N,y);switch(s){case Es:t-=A;break;
default:t+=A}w++}d.push(new B(0,y,h+k,C));break;case xs:k=g;l=a;m=c;n=Math.max(this.bq.width,1);p=y=A=0;q=D.P();for(g=0;g<e.length;g++)r=e[g],s=r.Fa,u=ir(r,r.uf,r.Kf,q),A=Math.max(A,u.x),y=Math.max(y,s.width-u.x),p=Math.max(p,u.y);t=this.$f;switch(t){case Es:A+=l;break;default:y+=l}var n=isFinite(n)?Math.max(n+l,1):Math.max(A+y,1),W=y=this.Ae.x,w=this.Ae.y,C=0;h>=A&&(h-=A);for(var A=N=0,H=Math.max(this.bq.height,1),fa=p=0,S=!0,ba=D.P(),g=0;g<e.length;g++){r=e[g];s=r.Fa;u=ir(r,r.uf,r.Kf,q);if(0<C)switch(t){case Es:W=
(W-y-(s.width-u.x))/n;W=yb(Math.round(W),W)?Math.round(W):Math.floor(W);W=W*n+y;break;default:W=(W-y+u.x)/n,W=yb(Math.round(W),W)?Math.round(W):Math.ceil(W),W=W*n+y}else switch(t){case Es:N=W+u.x+s.width;break;default:N=W-u.x}var ia=0;switch(t){case Es:ia=-(W+u.x)+N;break;default:ia=W+s.width-u.x-N}if(0<k&&C>k-1||0<h&&0<C&&ia>h){d.push(new B(0,S?w-p:w,h+l,fa+p+m));for(W=0;W<C&&g!==C;W++){var ia=e[g-C+W],U=ir(ia,ia.uf,ia.Kf,ba);ia.moveTo(ia.position.x,ia.position.y+p-U.y)}fa+=m;w=S?w+fa:w+(fa+p);C=
fa=p=0;W=y;S=!1}W===y&&(A=t===Es?Math.max(A,s.width-u.x):Math.min(A,-u.x));p=Math.max(p,u.y);fa=Math.max(fa,s.height-u.y);isFinite(H)&&(fa=Math.max(fa,Math.max(s.height,H)-u.y));S?r.moveTo(W-u.x,w-u.y):r.moveTo(W-u.x,w);switch(t){case Es:W-=u.x+l;break;default:W+=s.width-u.x+l}C++}d.push(new B(0,w,h+l,(S?fa:fa+p)+m));for(W=0;W<C&&g!==C;W++)ia=e[g-C+W],U=ir(ia,ia.uf,ia.Kf,q),ia.moveTo(ia.position.x,ia.position.y+p-U.y);D.A(q);D.A(ba);if(t===Es)for(g=0;g<d.length;g++)e=d[g],e.width+=A,e.x-=A;else for(g=
0;g<d.length;g++)e=d[g],e.x>A&&(e.width+=e.x-A,e.x=A)}for(k=g=h=e=0;k<d.length;k++)l=d[k],e=Math.min(e,l.x),h=Math.min(h,l.y),g=Math.max(g,l.x+l.width);this.$f===Es?this.commitLayers(d,new O(e+a/2-(g+e),h-c/2)):this.commitLayers(d,new O(e-a/2,h-c/2));null!==b&&b.Td("Layout");this.Hf=!0}};Tn.prototype.commitLayers=function(){};
D.defineProperty(Tn,{lH:"wrappingWidth"},function(){return this.Nt},function(a){this.Nt!==a&&(D.h(a,"number",Tn,"wrappingWidth"),0<a||isNaN(a))&&(this.Nt=a,this.Zx=isNaN(a),this.N())});D.defineProperty(Tn,{BK:"wrappingColumn"},function(){return this.Mt},function(a){this.Mt!==a&&(D.h(a,"number",Tn,"wrappingColumn"),0<a||isNaN(a))&&(this.Mt=a,this.N())});D.defineProperty(Tn,{bq:"cellSize"},function(){return this.bk},function(a){D.l(a,Ca,Tn,"cellSize");this.bk.O(a)||(this.bk.assign(a),this.N())});
D.defineProperty(Tn,{spacing:"spacing"},function(){return this.ri},function(a){D.l(a,Ca,Tn,"spacing");this.ri.O(a)||(this.ri.assign(a),this.N())});D.defineProperty(Tn,{alignment:"alignment"},function(){return this.re},function(a){this.re!==a&&(D.Ca(a,Tn,Tn,"alignment"),a===xs||a===Fs)&&(this.re=a,this.N())});D.defineProperty(Tn,{$f:"arrangement"},function(){return this.vd},function(a){this.vd!==a&&(D.Ca(a,Tn,Tn,"arrangement"),a===ys||a===Es)&&(this.vd=a,this.N())});
D.defineProperty(Tn,{sorting:"sorting"},function(){return this.qi},function(a){this.qi!==a&&(D.Ca(a,Tn,Tn,"sorting"),a===Cs||a===Ds||a===zs||a===Bs)&&(this.qi=a,this.N())});D.defineProperty(Tn,{comparer:"comparer"},function(){return this.Zh},function(a){this.Zh!==a&&(D.h(a,"function",Tn,"comparer"),this.Zh=a,this.N())});var As;Tn.standardComparer=As=function(a,b){v&&D.l(a,F,Tn,"standardComparer:a");v&&D.l(b,F,Tn,"standardComparer:b");var c=a.text,d=b.text;return c<d?-1:c>d?1:0};
Tn.smartComparer=function(a,b){v&&D.l(a,F,Tn,"standardComparer:a");v&&D.l(b,F,Tn,"standardComparer:b");if(null!==a){if(null!==b){for(var c=a.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/),d=b.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/),e=0;e<c.length;e++)if(""!==d[e]&&void 0!==d[e]){var g=parseFloat(c[e]),h=parseFloat(d[e]);if(isNaN(g)){if(!isNaN(h))return 1;if(0!==c[e].localeCompare(d[e]))return c[e].localeCompare(d[e])}else{if(isNaN(h))return-1;
if(0!==g-h)return g-h}}else if(""!==c[e])return 1;return""!==d[e]&&void 0!==d[e]?-1:0}return 1}return null!==b?-1:0};var Fs;Tn.Position=Fs=D.s(Tn,"Position",0);var xs;Tn.Location=xs=D.s(Tn,"Location",1);var ys;Tn.LeftToRight=ys=D.s(Tn,"LeftToRight",2);var Es;Tn.RightToLeft=Es=D.s(Tn,"RightToLeft",3);var Cs;Tn.Forward=Cs=D.s(Tn,"Forward",4);var Ds;Tn.Reverse=Ds=D.s(Tn,"Reverse",5);var zs;Tn.Ascending=zs=D.s(Tn,"Ascending",6);var Bs;Tn.Descending=Bs=D.s(Tn,"Descending",7);
function Gs(){0<arguments.length&&D.td(Gs);Tg.call(this);this.vz=this.Zo=this.fe=0;this.Nr=360;this.uz=Hs;this.tl=0;this.YC=Hs;this.Dv=this.Rg=this.oE=0;this.ex=new Is;this.Ev=this.hn=0;this.yH=600;this.Zs=NaN;this.ir=1;this.zt=0;this.Ct=360;this.vd=Hs;this.fa=Js;this.qi=Ks;this.Zh=ws;this.ri=6;this.Os=Ls}D.Sa(Gs,Tg);D.ja("CircularLayout",Gs);
Gs.prototype.cloneProtected=function(a){Tg.prototype.cloneProtected.call(this,a);a.Zs=this.Zs;a.ir=this.ir;a.zt=this.zt;a.Ct=this.Ct;a.vd=this.vd;a.fa=this.fa;a.qi=this.qi;a.Zh=this.Zh;a.ri=this.ri;a.Os=this.Os};Gs.prototype.nc=function(a){if(a.Ne===Gs)if(a===Ms||a===Ns||a===Os||a===Ps||a===Ks)this.sorting=a;else if(a===Qs||a===Rs||a===Js||a===Ss)this.direction=a;else if(a===Ts||a===Us||a===Hs||a===Vs)this.$f=a;else{if(a===Ws||a===Ls)this.jy=a}else Tg.prototype.nc.call(this,a)};
Gs.prototype.createNetwork=function(){return new Xs};
Gs.prototype.doLayout=function(a){null===a&&D.k("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));a=this.network.vertexes;if(1>=a.count)1===a.count&&(a=a.first(),a.na=0,a.va=0);else{var b=new K(Ys);b.Rc(a.j);a=new K(Ys);var c=new K(Ys),d;d=this.sort(b);var e=this.uz,g=this.YC,h=this.fe,k=this.Zo,l=this.vz,m=this.Nr,b=this.tl,n=this.oE,p=this.Rg,q=this.Dv,e=this.$f,g=this.jy,h=this.RJ;if(!isFinite(h)||
0>=h)h=NaN;k=this.SH;if(!isFinite(k)||0>=k)k=1;l=this.Le;isFinite(l)||(l=0);m=this.xf;if(!isFinite(m)||360<m||1>m)m=360;b=this.spacing;isFinite(b)||(b=NaN);e===Vs&&g===Ws?e=Hs:e===Vs&&g!==Ws&&(g=Ws,e=this.$f);if((this.direction===Qs||this.direction===Rs)&&this.sorting!==Ks){for(var r=0;!(r>=d.length);r+=2){a.add(d.ea(r));if(r+1>=d.length)break;c.add(d.ea(r+1))}this.direction===Qs?(this.$f===Vs&&a.reverse(),d=new K(Ys),d.Rc(a),d.Rc(c)):(this.$f===Vs&&c.reverse(),d=new K(Ys),d.Rc(c),d.Rc(a))}for(var s=
d.length,u=n=0,r=0;r<d.length;r++){var p=l+m*u*(this.direction===Js?1:-1)/s,t=d.ea(r).diameter;isNaN(t)&&(t=Zs(d.ea(r),p));360>m&&(0===r||r===d.length-1)&&(t/=2);n+=t;u++}if(isNaN(h)||e===Vs){isNaN(b)&&(b=6);if(e!==Hs&&e!==Vs){t=-Infinity;for(r=0;r<s;r++){var q=d.ea(r),y=d.ea(r===s-1?0:r+1);isNaN(q.diameter)&&Zs(q,0);isNaN(y.diameter)&&Zs(y,0);t=Math.max(t,(q.diameter+y.diameter)/2)}q=t+b;e===Ts?(p=2*Math.PI/s,h=(t+b)/p):h=$s(this,q*(360<=m?s:s-1),k,l*Math.PI/180,m*Math.PI/180)}else h=$s(this,n+(360<=
m?s:s-1)*(e!==Vs?b:1.6*b),k,l*Math.PI/180,m*Math.PI/180);p=h*k}else if(p=h*k,u=at(this,h,p,l*Math.PI/180,m*Math.PI/180),isNaN(b)){if(e===Hs||e===Vs)b=(u-n)/(360<=m?s:s-1)}else if(e===Hs||e===Vs)r=(u-n)/(360<=m?s:s-1),r<b?(h=$s(this,n+b*(360<=m?s:s-1),k,l*Math.PI/180,m*Math.PI/180),p=h*k):b=r;else{t=-Infinity;for(r=0;r<s;r++)q=d.ea(r),y=d.ea(r===s-1?0:r+1),isNaN(q.diameter)&&Zs(q,0),isNaN(y.diameter)&&Zs(y,0),t=Math.max(t,(q.diameter+y.diameter)/2);q=t+b;r=$s(this,q*(360<=m?s:s-1),k,l*Math.PI/180,
m*Math.PI/180);r>h?(h=r,p=h*k):q=u/(360<=m?s:s-1)}this.uz=e;this.YC=g;this.fe=h;this.Zo=k;this.vz=l;this.Nr=m;this.tl=b;this.oE=n;this.Rg=p;this.Dv=q;b=d;d=this.uz;e=this.fe;g=this.vz;k=this.Nr;l=this.tl;m=this.Rg;n=this.Dv;if(this.direction!==Qs&&this.direction!==Rs||d!==Vs)if(this.direction===Qs||this.direction===Rs){h=0;switch(d){case Us:h=180*bt(this,e,m,g,n)/Math.PI;break;case Hs:n=b=0;h=a.first();null!==h&&(b=Zs(h,Math.PI/2));h=c.first();null!==h&&(n=Zs(h,Math.PI/2));h=180*bt(this,e,m,g,l+(b+
n)/2)/Math.PI;break;case Ts:h=k/b.length}if(this.direction===Qs){switch(d){case Us:ct(this,a,g,Ss);break;case Hs:dt(this,a,g,Ss);break;case Ts:et(this,a,k/2,g,Ss)}switch(d){case Us:ct(this,c,g+h,Js);break;case Hs:dt(this,c,g+h,Js);break;case Ts:et(this,c,k/2,g+h,Js)}}else{switch(d){case Us:ct(this,c,g,Ss);break;case Hs:dt(this,c,g,Ss);break;case Ts:et(this,c,k/2,g,Ss)}switch(d){case Us:ct(this,a,g+h,Js);break;case Hs:dt(this,a,g+h,Js);break;case Ts:et(this,a,k/2,g+h,Js)}}}else switch(d){case Us:ct(this,
b,g,this.direction);break;case Hs:dt(this,b,g,this.direction);break;case Ts:et(this,b,k,g,this.direction);break;case Vs:ft(this,b,k,g,this.direction)}else ft(this,b,k,g-k/2,Js)}this.updateParts();this.network=null;this.Hf=!0};
function et(a,b,c,d,e){var g=a.Nr,h=a.fe;a=a.Rg;d=d*Math.PI/180;c=c*Math.PI/180;for(var k=b.length,l=0;l<k;l++){var m=d+(e===Js?l*c/(360<=g?k:k-1):-(l*c)/k),n=b.ea(l),p=h*Math.tan(m)/a,p=Math.sqrt((h*h+a*a*p*p)/(1+p*p));n.na=p*Math.cos(m);n.va=p*Math.sin(m);n.actualAngle=180*m/Math.PI}}
function dt(a,b,c,d){var e=a.fe,g=a.Rg,h=a.tl;c=c*Math.PI/180;for(var k=b.length,l=0;l<k;l++){var m=b.ea(l),n=b.ea(l===k-1?0:l+1),p=g*Math.sin(c);m.na=e*Math.cos(c);m.va=p;m.actualAngle=180*c/Math.PI;isNaN(m.diameter)&&Zs(m,0);isNaN(n.diameter)&&Zs(n,0);m=bt(a,e,g,d===Js?c:-c,(m.diameter+n.diameter)/2+h);c+=d===Js?m:-m}}
function ct(a,b,c,d){var e=a.fe,g=a.Rg,h=a.Dv;c=c*Math.PI/180;for(var k=b.length,l=0;l<k;l++){var m=b.ea(l);m.na=e*Math.cos(c);m.va=g*Math.sin(c);m.actualAngle=180*c/Math.PI;m=bt(a,e,g,d===Js?c:-c,h);c+=d===Js?m:-m}}function ft(a,b,c,d,e){var g=a.Ev,g=a.Nr;a.hn=0;a.ex=new Is;if(360>c){for(g=d+(e===Js?g:-g);0>g;)g+=360;g%=360;180<g&&(g-=360);g*=Math.PI/180;a.Ev=g;gt(a,b,c,d,e)}else ht(a,b,c,d,e);a.ex.commit(b)}
function ht(a,b,c,d,e){var g=a.fe,h=a.tl,k=a.Zo,l=g*Math.cos(d*Math.PI/180),m=a.Rg*Math.sin(d*Math.PI/180),n=b.lc();if(3===n.length)n[0].na=g,n[0].va=0,n[1].na=n[0].na-n[0].width/2-n[1].width/2-h,n[1].y=n[0].y,n[2].na=(n[0].na+n[1].na)/2,n[2].y=n[0].y-n[2].height-h;else if(4===n.length)n[0].na=g,n[0].va=0,n[2].na=-n[0].na,n[2].va=n[0].va,n[1].na=0,n[1].y=Math.min(n[0].y,n[2].y)-n[1].height-h,n[3].na=0,n[3].y=Math.max(n[0].y+n[0].height+h,n[2].y+n[2].height+h);else{for(var g=D.P(),p=0;p<n.length;p++){n[p].na=
l;n[p].va=m;if(p>=n.length-1)break;it(a,l,m,n,p,e,g)||jt(a,l,m,n,p,e,g);l=g.x;m=g.y}D.A(g);a.hn++;if(!(23<a.hn)){var l=n[0].na,m=n[0].va,g=n[n.length-1].na,p=n[n.length-1].va,q=Math.abs(l-g)-((n[0].width+n[n.length-1].width)/2+h),r=Math.abs(m-p)-((n[0].height+n[n.length-1].height)/2+h),h=0;1>Math.abs(r)?Math.abs(l-g)<(n[0].width+n[n.length-1].width)/2&&(h=0):h=0<r?r:1>Math.abs(q)?0:q;q=!1;q=Math.abs(g)>Math.abs(p)?0<g!==m>p:0<p!==l<g;if(q=e===Js?q:!q)h=-Math.abs(h),h=Math.min(h,-n[n.length-1].width),
h=Math.min(h,-n[n.length-1].height);a.ex.compare(h,n);1<Math.abs(h)&&(a.fe=8>a.hn?a.fe-h/(2*Math.PI):5>n.length&&10<h?a.fe/2:a.fe-(0<h?1.7:-2.3),a.Rg=a.fe*k,ht(a,b,c,d,e))}}}
function gt(a,b,c,d,e){for(var g=a.fe,h=a.Rg,k=a.Zo,l=g*Math.cos(d*Math.PI/180),m=h*Math.sin(d*Math.PI/180),n=D.P(),p=b.lc(),q=0;q<p.length;q++){p[q].na=l;p[q].va=m;if(q>=p.length-1)break;it(a,l,m,p,q,e,n)||jt(a,l,m,p,q,e,n);l=n.x;m=n.y}D.A(n);a.hn++;if(!(23<a.hn)){l=Math.atan2(m,l);l=e===Js?a.Ev-l:l-a.Ev;l=Math.abs(l)<Math.abs(l-2*Math.PI)?l:l-2*Math.PI;g=l*(g+h)/2;h=a.ex;if(Math.abs(g)<Math.abs(h.qq))for(h.qq=g,h.Ao=[],h.Xq=[],l=0;l<p.length;l++)h.Ao[l]=p[l].sb.x,h.Xq[l]=p[l].sb.y;1<Math.abs(g)&&
(a.fe=8>a.hn?a.fe-g/(2*Math.PI):a.fe-(0<g?1.7:-2.3),a.Rg=a.fe*k,gt(a,b,c,d,e))}}function it(a,b,c,d,e,g,h){var k=a.fe,l=a.Rg,m=0,n=0;a=(d[e].width+d[e+1].width)/2+a.tl;var p=!1;if(0<=c!==(g===Js)){if(m=b+a,m>k){m=b-a;if(m<-k)return h.x=m,h.y=n,!1;p=!0}}else if(m=b-a,m<-k){m=b+a;if(m>k)return h.x=m,h.y=n,!1;p=!0}n=Math.sqrt(1-Math.min(1,m*m/(k*k)))*l;0>c!==p&&(n=-n);if(Math.abs(c-n)>(d[e].height+d[e+1].height)/2)return h.x=m,h.y=n,!1;h.x=m;h.y=n;return!0}
function jt(a,b,c,d,e,g,h){var k=a.fe,l=a.Rg,m=0,n=0;a=(d[e].height+d[e+1].height)/2+a.tl;d=!1;if(0<=b!==(g===Js)){if(n=c-a,n<-l){n=c+a;if(n>l){h.x=m;h.y=n;return}d=!0}}else if(n=c+a,n>l){n=c-a;if(n<-l){h.x=m;h.y=n;return}d=!0}m=Math.sqrt(1-Math.min(1,n*n/(l*l)))*k;0>b!==d&&(m=-m);h.x=m;h.y=n}Gs.prototype.commitLayout=function(){this.commitNodes();this.zu&&this.commitLinks()};
Gs.prototype.commitNodes=function(){for(var a=this.HH,b=this.network.vertexes.j;b.next();){var c=b.value;c.x+=a.x;c.y+=a.y;c.commit()}};Gs.prototype.commitLinks=function(){for(var a=this.network.edges.j;a.next();)a.value.commit()};
function at(a,b,c,d,e){var g=a.yH;if(.001>Math.abs(a.Zo-1))return void 0!==d&&void 0!==e?e*b:2*Math.PI*b;a=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c;for(var h=0,k=0,k=void 0!==d&&void 0!==e?e/(g+1):Math.PI/(2*(g+1)),l=0,m=0;m<=g;m++)l=void 0!==d&&void 0!==e?d+m*e/g:m*Math.PI/(2*g),l=Math.sin(l),h+=Math.sqrt(1-a*a*l*l)*k;return void 0!==d&&void 0!==e?(b>c?b:c)*h:4*(b>c?b:c)*h}function $s(a,b,c,d,e){var g=0,g=void 0!==d&&void 0!==e?at(a,1,c,d,e):at(a,1,c);return b/g}
function bt(a,b,c,d,e){if(.001>Math.abs(a.Zo-1))return e/b;var g=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c,h=0;a=2*Math.PI/(700*a.network.vertexes.count);b>c&&(d+=Math.PI/2);for(var k=0;;k++){var l=Math.sin(d+k*a),h=h+(b>c?b:c)*Math.sqrt(1-g*g*l*l)*a;if(h>=e)return k*a}}
Gs.prototype.sort=function(a){switch(this.sorting){case Os:break;case Ps:a.reverse();break;case Ms:a.sort(this.comparer);break;case Ns:a.sort(this.comparer);a.reverse();break;case Ks:for(var b=[],c=0;c<a.length;c++)b.push(0);for(var d=new K(Ys),c=0;c<a.length;c++){var e=-1,g=-1;if(0===c)for(var h=0;h<a.length;h++){var k=a.ea(h).BI;k>e&&(e=k,g=h)}else for(h=0;h<a.length;h++)k=b[h],k>e&&(e=k,g=h);d.add(a.ea(g));b[g]=-1;g=a.ea(g);e=0;for(h=g.sc;h.next();)e=a.indexOf(h.value.fromVertex),0>e||0<=b[e]&&
b[e]++;for(g=g.pc;g.next();)e=a.indexOf(g.value.toVertex),0>e||0<=b[e]&&b[e]++}a=[];for(g=0;g<d.length;g++){b=d.ea(g);a[g]=[];for(var l=0,c=b.pc;c.next();)l=d.indexOf(c.value.toVertex),l!==g&&0>a[g].indexOf(l)&&a[g].push(l);for(b=b.sc;b.next();)l=d.indexOf(b.value.fromVertex),l!==g&&0>a[g].indexOf(l)&&a[g].push(l)}h=[];for(g=0;g<a.length;g++)h[g]=0;for(var b=[],k=[],m=[],c=[],e=new K(Ys),n=0,g=0;g<a.length;g++){var p=a[g].length;if(1===p)c.push(g);else if(0===p)e.add(d.ea(g));else{if(0===n)b.push(g);
else{for(var q=Infinity,r=Infinity,s=-1,u=[],p=0;p<b.length;p++)0>a[b[p]].indexOf(b[p===b.length-1?0:p+1])&&u.push(p===b.length-1?0:p+1);if(0===u.length)for(p=0;p<b.length;p++)u.push(p);for(p=0;p<u.length;p++){var t=u[p],y,l=a[g];y=k;for(var w=m,C=h,A=t,N=b,H=0,W=0;W<y.length;W++){var fa=C[y[W]],S=C[w[W]],ba=0,ia=0;fa<S?(ba=fa,ia=S):(ba=S,ia=fa);if(ba<A&&A<=ia)for(fa=0;fa<l.length;fa++)S=l[fa],0>N.indexOf(S)||ba<C[S]&&C[S]<ia||ba===C[S]||ia===C[S]||H++;else for(fa=0;fa<l.length;fa++)S=l[fa],0>N.indexOf(S)||
ba<C[S]&&C[S]<ia&&ba!==C[S]&&ia!==C[S]&&H++}y=H;for(C=w=0;C<a[g].length;C++)l=b.indexOf(a[g][C]),0<=l&&(l=Math.abs(t-(l>=t?l+1:l)),w+=l<b.length+1-l?l:b.length+1-l);for(C=0;C<k.length;C++)l=h[k[C]],A=h[m[C]],l>=t&&l++,A>=t&&A++,l>A&&(N=A,A=l,l=N),A-l<(b.length+2)/2===(l<t&&t<=A)&&w++;if(y<q||y===q&&w<r)q=y,r=w,s=t}b.splice(s,0,g);for(p=0;p<b.length;p++)h[b[p]]=p;for(p=0;p<a[g].length;p++)q=a[g][p],0<=b.indexOf(q)&&(k.push(g),m.push(q))}n++}}g=!1;for(h=b.length;;){g=!0;for(k=0;k<c.length;k++)if(m=
c[k],n=a[m][0],l=b.indexOf(n),0<=l){for(r=p=0;r<a[n].length;r++)q=a[n][r],q=b.indexOf(q),0>q||q===l||(s=q>l?q-l:l-q,p+=q<l!==s>h-s?1:-1);b.splice(0>p?l:l+1,0,m);c.splice(k,1);k--}else g=!1;if(g)break;else b.push(c[0]),c.splice(0,1)}for(g=0;g<b.length;g++)e.add(d.ea(b[g]));return e;default:D.k("Invalid sorting type.")}return a};D.defineProperty(Gs,{RJ:"radius"},function(){return this.Zs},function(a){this.Zs!==a&&(D.h(a,"number",Gs,"radius"),0<a||isNaN(a))&&(this.Zs=a,this.N())});
D.defineProperty(Gs,{SH:"aspectRatio"},function(){return this.ir},function(a){this.ir!==a&&(D.h(a,"number",Gs,"aspectRatio"),0<a&&(this.ir=a,this.N()))});D.defineProperty(Gs,{Le:"startAngle"},function(){return this.zt},function(a){this.zt!==a&&(D.h(a,"number",Gs,"startAngle"),this.zt=a,this.N())});D.defineProperty(Gs,{xf:"sweepAngle"},function(){return this.Ct},function(a){this.Ct!==a&&(D.h(a,"number",Gs,"sweepAngle"),this.Ct=0<a&&360>=a?a:360,this.N())});
D.defineProperty(Gs,{$f:"arrangement"},function(){return this.vd},function(a){this.vd!==a&&(D.Ca(a,Gs,Gs,"arrangement"),a===Vs||a===Hs||a===Us||a===Ts)&&(this.vd=a,this.N())});D.defineProperty(Gs,{direction:"direction"},function(){return this.fa},function(a){this.fa!==a&&(D.Ca(a,Gs,Gs,"direction"),a===Js||a===Ss||a===Qs||a===Rs)&&(this.fa=a,this.N())});
D.defineProperty(Gs,{sorting:"sorting"},function(){return this.qi},function(a){this.qi!==a&&(D.Ca(a,Gs,Gs,"sorting"),a===Os||a===Ps||a===Ms||Ns||a===Ks)&&(this.qi=a,this.N())});D.defineProperty(Gs,{comparer:"comparer"},function(){return this.Zh},function(a){this.Zh!==a&&(D.h(a,"function",Gs,"comparer"),this.Zh=a,this.N())});D.defineProperty(Gs,{spacing:"spacing"},function(){return this.ri},function(a){this.ri!==a&&(D.h(a,"number",Gs,"spacing"),this.ri=a,this.N())});
D.defineProperty(Gs,{jy:"nodeDiameterFormula"},function(){return this.Os},function(a){this.Os!==a&&(D.Ca(a,Gs,Gs,"nodeDiameterFormula"),a===Ls||a===Ws)&&(this.Os=a,this.N())});D.w(Gs,{IH:"actualXRadius"},function(){return this.fe});D.w(Gs,{JH:"actualYRadius"},function(){return this.Rg});D.w(Gs,{DK:"actualSpacing"},function(){return this.tl});D.w(Gs,{HH:"actualCenter"},function(){return isNaN(this.Ae.x)||isNaN(this.Ae.y)?new O(0,0):new O(this.Ae.x+this.IH,this.Ae.y+this.JH)});var Hs;
Gs.ConstantSpacing=Hs=D.s(Gs,"ConstantSpacing",0);var Us;Gs.ConstantDistance=Us=D.s(Gs,"ConstantDistance",1);var Ts;Gs.ConstantAngle=Ts=D.s(Gs,"ConstantAngle",2);var Vs;Gs.Packed=Vs=D.s(Gs,"Packed",3);var Js;Gs.Clockwise=Js=D.s(Gs,"Clockwise",4);var Ss;Gs.Counterclockwise=Ss=D.s(Gs,"Counterclockwise",5);var Qs;Gs.BidirectionalLeft=Qs=D.s(Gs,"BidirectionalLeft",6);var Rs;Gs.BidirectionalRight=Rs=D.s(Gs,"BidirectionalRight",7);var Os;Gs.Forwards=Os=D.s(Gs,"Forwards",8);var Ps;
Gs.Reverse=Ps=D.s(Gs,"Reverse",9);var Ms;Gs.Ascending=Ms=D.s(Gs,"Ascending",10);var Ns;Gs.Descending=Ns=D.s(Gs,"Descending",11);var Ks;Gs.Optimized=Ks=D.s(Gs,"Optimized",12);var Ls;Gs.Pythagorean=Ls=D.s(Gs,"Pythagorean",13);var Ws;Gs.Circular=Ws=D.s(Gs,"Circular",14);function Is(){this.qq=-Infinity;this.Xq=this.Ao=null}
Is.prototype.compare=function(a,b){if(0<a&&0>this.qq||Math.abs(a)<Math.abs(this.qq)&&!(0>a&&0<this.qq)){this.qq=a;this.Ao=[];this.Xq=[];for(var c=0;c<b.length;c++)this.Ao[c]=b[c].sb.x,this.Xq[c]=b[c].sb.y}};Is.prototype.commit=function(a){if(null!==this.Ao&&null!==this.Xq)for(var b=0;b<this.Ao.length;b++){var c=a.ea(b);c.x=this.Ao[b];c.y=this.Xq[b]}};function Xs(){va.call(this)}D.Sa(Xs,va);D.ja("CircularNetwork",Xs);Xs.prototype.createVertex=function(){return new Ys};Xs.prototype.createEdge=function(){return new kt};
function Ys(){wa.call(this);this.actualAngle=this.diameter=NaN}D.Sa(Ys,wa);D.ja("CircularVertex",Ys);
function Zs(a,b){var c=a.network;if(null===c)return NaN;c=c.Vb;if(null===c)return NaN;if(c.$f===Vs)if(c.jy===Ws)a.diameter=Math.max(a.width,a.height);else{var c=Math.abs(Math.sin(b)),d=Math.abs(Math.cos(b));if(0===c)return a.width;if(0===d)return a.height;a.diameter=Math.min(a.height/c,a.width/d)}else a.diameter=c.jy===Ws?Math.max(a.width,a.height):Math.sqrt(a.width*a.width+a.height*a.height);return a.diameter}function kt(){xa.call(this)}D.Sa(kt,xa);D.ja("CircularEdge",kt);
function lt(){0<arguments.length&&D.td(lt);Tg.call(this);this.Qg=null;this.os=0;this.sg=(new Ca(100,100)).freeze();this.hr=!1;this.pi=!0;this.Yh=!1;this.zp=100;this.Rr=1;this.di=1E3;this.$s=Math;this.Vo=.05;this.Uo=50;this.So=150;this.To=0;this.Fr=10;this.Er=5}D.Sa(lt,Tg);D.ja("ForceDirectedLayout",lt);
lt.prototype.cloneProtected=function(a){Tg.prototype.cloneProtected.call(this,a);a.sg.assign(this.sg);a.hr=this.hr;a.pi=this.pi;a.Yh=this.Yh;a.zp=this.zp;a.Rr=this.Rr;a.di=this.di;a.$s=this.$s;a.Vo=this.Vo;a.Uo=this.Uo;a.So=this.So;a.To=this.To;a.Fr=this.Fr;a.Er=this.Er};lt.prototype.createNetwork=function(){return new vt};
lt.prototype.doLayout=function(a){null===a&&D.k("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));a=this.fB;if(0<this.network.vertexes.count){this.network.Ax();for(var b=this.network.vertexes.j;b.next();){var c=b.value;c.charge=this.electricalCharge(c);c.mass=this.gravitationalMass(c)}for(b=this.network.edges.j;b.next();)c=b.value,c.stiffness=this.springStiffness(c),c.length=this.springLength(c);
this.oA();this.os=0;if(this.needsClusterLayout()){b=this.network;for(c=b.mK().j;c.next();){this.network=c.value;for(var d=this.network.vertexes.j;d.next();){var e=d.value;e.og=e.vertexes.count;e.Zk=1;e.Gn=null;e.Uh=null}cu(this,0,a)}this.network=b;c.reset();v&&D.l(b,vt,lt,"arrangeConnectedGraphs:singletons");for(var d=this.IE,g=c.count,h=!0,k=e=0,l=D.tb(),m=0;m<g+b.vertexes.count+2;m++)l[m]=null;g=0;c.reset();for(var n=D.Nf();c.next();)if(m=c.value,this.Kh(m,n),h)h=!1,e=n.x+n.width/2,k=n.y+n.height/
2,l[0]=new O(n.x+n.width+d.width,n.y),l[1]=new O(n.x,n.y+n.height+d.height),g=2;else{var p=du(l,g,e,k,n.width,n.height,d),q=l[p],r=new O(q.x+n.width+d.width,q.y),s=new O(q.x,q.y+n.height+d.height);p+1<g&&l.splice(p+1,0,null);l[p]=r;l[p+1]=s;g++;p=q.x-n.x;q=q.y-n.y;for(m=m.vertexes.j;m.next();)r=m.value,r.na+=p,r.va+=q}D.Mb(n);for(m=b.vertexes.j;m.next();)h=m.value,n=h.sb,2>g?(e=n.x+n.width/2,k=n.y+n.height/2,l[0]=new O(n.x+n.width+d.width,n.y),l[1]=new O(n.x,n.y+n.height+d.height),g=2):(p=du(l,g,
e,k,n.width,n.height,d),q=l[p],r=new O(q.x+n.width+d.width,q.y),s=new O(q.x,q.y+n.height+d.height),p+1<g&&l.splice(p+1,0,null),l[p]=r,l[p+1]=s,g++,h.na=q.x+h.width/2,h.va=q.y+h.height/2);D.Aa(l);for(c.reset();c.next();){d=c.value;for(e=d.vertexes.j;e.next();)b.Xl(e.value);for(d=d.edges.j;d.next();)b.Yp(d.value)}}eu(this,a);this.updateParts()}this.zp=a;this.network=null;this.Hf=!0};
lt.prototype.needsClusterLayout=function(){if(3>this.network.vertexes.count)return!1;for(var a=0,b=0,c=this.network.vertexes.first().sb,d=this.network.vertexes.j;d.next();){if(d.value.sb.Wg(c)&&(a++,2<a))return!0;if(10<b)break;b++}return!1};lt.prototype.Kh=function(a,b){for(var c=!0,d=a.vertexes.j;d.next();){var e=d.value;c?(c=!1,b.set(e.sb)):b.Wh(e.sb)}return b};
function fu(a,b,c){v&&(D.p(b,lt,"computeClusterLayoutIterations:level"),D.p(c,lt,"computeClusterLayoutIterations:maxiter"));return Math.max(Math.min(a.network.vertexes.count,c*(b+1)/11),10)}
function cu(a,b,c){v&&(D.p(b,lt,"layoutClusters:level"),D.p(c,lt,"layoutClusters:maxiter"));if(gu(a,b)){var d=a.di;a.di*=1+1/(b+1);var e=hu(a,b),g=Math.max(0,fu(a,b,c));a.fB+=g;cu(a,b+1,c);eu(a,g);iu(a,e,b);c=a.Qg;null===c?c=new K(ju):c.clear();c.Rc(e.vertexes);c.sort(function(a,b){return null===a||null===b||a===b?0:b.og-a.og});for(e=c.j;e.next();)ku(a,e.value,b);a.di=d}}
function gu(a,b){v&&D.p(b,lt,"hasClusters:level");if(10<b||3>a.network.vertexes.count)return!1;null===a.Qg?a.Qg=new K(ju):a.Qg.clear();a.Qg.Rc(a.network.vertexes);var c=a.Qg;c.sort(function(a,b){return null===a||null===b||a===b?0:b.og-a.og});for(var d=c.count-1;0<=d&&1>=c.ea(d).og;)d--;return 1<c.count-d}
function hu(a,b){v&&D.p(b,lt,"pushSubNetwork:level");for(var c=a.network,d=new vt,e=a.Qg.j;e.next();){var g=e.value;if(1<g.og){d.Xl(g);var h=new lu;h.Py=g.og;h.Qy=g.width;h.Oy=g.height;h.dC=g.W.x;h.eC=g.W.y;null===g.Uh&&(g.Uh=new K(lu));g.Uh.add(h);g.xB=g.Uh.count-1}else break}for(var k=c.edges.j;k.next();)if(h=k.value,e=h.fromVertex,g=h.toVertex,e.network===d&&g.network===d)d.Yp(h);else if(e.network===d){var l=e.Gn;null===l&&(l=new K(ju),e.Gn=l);l.add(g);e.og--;e.Zk+=g.Zk}else g.network===d&&(l=
g.Gn,null===l&&(l=new K(ju),g.Gn=l),l.add(e),g.og--,g.Zk+=e.Zk);for(e=d.edges.j;e.next();)g=e.value,g.length*=Math.max(1,te((g.fromVertex.Zk+g.toVertex.Zk)/(4*b+1)));for(e=d.vertexes.j;e.next();)if(g=e.value,l=g.Gn,null!==l&&0<l.count&&(h=g.Uh.ea(g.Uh.count-1),h=h.Py-g.og,!(0>=h))){for(var m=0,n=0,p=l.count-h;p<l.count;p++){for(var q=l.ea(p),r=null,k=q.edges.j;k.next();){var s=k.value;if(s.LI(q)===g){r=s;break}}null!==r&&(n+=r.length,m+=q.width*q.height)}k=g.na;l=g.va;p=g.width;q=g.height;r=g.W;s=
p*q;1>s&&(s=1);m=te((m+s+n*n*4/(h*h))/s);h=(m-1)*p/2;m=(m-1)*q/2;g.sb=new B(k-r.x-h,l-r.y-m,p+2*h,q+2*m);g.focus=new O(r.x+h,r.y+m)}a.network=d;return c}function iu(a,b,c){v&&(D.l(b,vt,lt,"popNetwork:oldnet"),D.p(c,lt,"popNetwork:level"));for(c=a.network.vertexes.j;c.next();){var d=c.value;d.network=b;if(null!==d.Uh){var e=d.Uh.ea(d.xB);d.og=e.Py;var g=e.dC,h=e.eC;d.sb=new B(d.na-g,d.va-h,e.Qy,e.Oy);d.focus=new O(g,h);d.xB--}}for(c=a.network.edges.j;c.next();)c.value.network=b;a.network=b}
function ku(a,b,c){v&&(D.l(b,ju,lt,"surroundNode:oldnet"),D.p(c,lt,"surroundNode:level"));var d=b.Gn;if(null!==d&&0!==d.count){c=b.na;var e=b.va,g=b.width,h=b.height;null!==b.Uh&&0<b.Uh.count&&(h=b.Uh.ea(0),g=h.Qy,h=h.Oy);for(var g=te(g*g+h*h)/2,k=!1,l=h=0,m=0,n=b.vertexes.j;n.next();){var p=n.value;1>=p.og?l++:(k=!0,m++,h+=Math.atan2(b.va-p.va,b.na-p.na))}if(0!==l)for(0<m&&(h/=m),m=b=0,b=k?2*Math.PI/(l+1):2*Math.PI/l,0===l%2&&(m=b/2),1<d.count&&d.sort(function(a,b){return null===a||null===b||a===
b?0:b.width*b.height-a.width*a.height}),k=0===l%2?0:1,d=d.j;d.next();)if(l=d.value,!(1<l.og||a.isFixed(l))){n=null;for(p=l.edges.j;p.next();){n=p.value;break}var p=l.width,q=l.height,p=te(p*p+q*q)/2,n=g+n.length+p,p=h+(b*(k/2>>1)+m)*(0===k%2?1:-1);l.na=c+n*Math.cos(p);l.va=e+n*Math.sin(p);k++}}}
function du(a,b,c,d,e,g,h){var k=9E19,l=-1,m=0;a:for(;m<b;m++){var n=a[m],p=n.x-c,q=n.y-d,p=p*p+q*q;if(p<k){for(q=m-1;0<=q;q--)if(a[q].y>n.y&&a[q].x-n.x<e+h.width)continue a;for(q=m+1;q<b;q++)if(a[q].x>n.x&&a[q].y-n.y<g+h.height)continue a;l=m;k=p}}return l}lt.prototype.oA=function(){if(this.comments)for(var a=this.network.vertexes.j;a.next();)this.addComments(a.value)};
lt.prototype.addComments=function(a){var b=a.Vc;if(null!==b)for(b=b.mF();b.next();){var c=b.value;if("Comment"===c.Dd&&c.isVisible()){var d=this.network.Qn(c);null===d&&(d=this.network.Rt(c));d.charge=this.mI;for(var c=null,e=d.pc;e.next();){var g=e.value;if(g.toVertex===a){c=g;break}}if(null===c)for(e=d.sc;e.next();)if(g=e.value,g.fromVertex===a){c=g;break}null===c&&(c=this.network.Cq(a,d,null));c.length=this.nI}}};
function mu(a,b){v&&(D.l(a,ju,lt,"getNodeDistance:vertexA"),D.l(b,ju,lt,"getNodeDistance:vertexB"));var c=a.R,d=c.x,e=c.y,g=c.width,c=c.height,h=b.R,k=h.x,l=h.y,m=h.width,h=h.height;return d+g<k?e>l+h?(d=d+g-k,e=e-l-h,te(d*d+e*e)):e+c<l?(d=d+g-k,e=e+c-l,te(d*d+e*e)):k-(d+g):d>k+m?e>l+h?(d=d-k-m,e=e-l-h,te(d*d+e*e)):e+c<l?(d=d-k-m,e=e+c-l,te(d*d+e*e)):d-(k+m):e>l+h?e-(l+h):e+c<l?l-(e+c):.1}
function eu(a,b){v&&D.p(b,lt,"performIterations:num");a.Qg=null;for(var c=a.os+b;a.os<c&&(a.os++,nu(a)););a.Qg=null}
function nu(a){null===a.Qg&&(a.Qg=new K(ju),a.Qg.Rc(a.network.vertexes));var b=a.Qg.o;if(0>=b.length)return!1;var c=b[0];c.forceX=0;c.forceY=0;for(var d=c.na,e=d,g=c.va,h=g,c=1;c<b.length;c++){var k=b[c];k.forceX=0;k.forceY=0;var l=k.na,k=k.va,d=Math.min(d,l),e=Math.max(e,l),g=Math.min(g,k),h=Math.max(h,k)}(g=e-d>h-g)?b.sort(function(a,b){return null===a||null===b||a===b?0:a.na-b.na}):b.sort(function(a,b){return null===a||null===b||a===b?0:a.va-b.va});for(var h=a.di,m=0,n=0,p=0,c=0;c<b.length;c++){var k=
b[c],l=k.R,q=k.W,d=l.x+q.x,l=l.y+q.y,n=k.charge*a.electricalFieldX(d,l),p=k.charge*a.electricalFieldY(d,l),n=n+k.mass*a.gravitationalFieldX(d,l),p=p+k.mass*a.gravitationalFieldY(d,l);k.forceX+=n;k.forceY+=p;for(q=c+1;q<b.length;q++)if(e=b[q],e!==k){var r=e.R,n=e.W,p=r.x+n.x,r=r.y+n.y;if(d-p>h||p-d>h){if(g)break}else if(l-r>h||r-l>h){if(!g)break}else{var s=mu(k,e);1>s?(n=a.ty,null===n&&(a.ty=n=new Ia(0)),m=n.random(),s=n.random(),d>p?(n=Math.abs(e.R.right-k.R.x),n=(1+n)*m):d<p?(n=Math.abs(e.R.x-k.R.right),
n=-(1+n)*m):(n=Math.max(e.width,k.width),n=(1+n)*m-n/2),l>r?(p=Math.abs(e.R.bottom-k.R.y),p=(1+p)*s):d<p?(p=Math.abs(e.R.y-k.R.bottom),p=-(1+p)*s):(p=Math.max(e.height,k.height),p=(1+p)*s-p/2)):(m=-(k.charge*e.charge)/(s*s),n=(p-d)/s*m,p=(r-l)/s*m);k.forceX+=n;k.forceY+=p;e.forceX-=n;e.forceY-=p}}}for(c=a.network.edges.j;c.next();)g=c.value,k=g.fromVertex,e=g.toVertex,l=k.R,q=k.W,d=l.x+q.x,l=l.y+q.y,r=e.R,n=e.W,p=r.x+n.x,r=r.y+n.y,s=mu(k,e),1>s?(n=a.ty,null===n&&(a.ty=n=new Ia(0)),m=n.random(),s=
n.random(),n=(d>p?1:-1)*(1+(e.width>k.width?e.width:k.width))*m,p=(l>r?1:-1)*(1+(e.height>k.height?e.height:k.height))*s):(m=g.stiffness*(s-g.length),n=(p-d)/s*m,p=(r-l)/s*m),k.forceX+=n,k.forceY+=p,e.forceX-=n,e.forceY-=p;c=0;d=Math.max(a.di/20,50);for(e=0;e<b.length;e++)k=b[e],a.isFixed(k)?a.moveFixedVertex(k):(g=k.forceX,h=k.forceY,g<-d?g=-d:g>d&&(g=d),h<-d?h=-d:h>d&&(h=d),k.na+=g,k.va+=h,c=Math.max(c,g*g+h*h));return c>a.jF*a.jF}lt.prototype.moveFixedVertex=function(){};
lt.prototype.commitLayout=function(){this.EB();this.commitNodes();this.zu&&this.commitLinks()};lt.prototype.EB=function(){if(this.Rq)for(var a=this.network.edges.j;a.next();){var b=a.value.link;null!==b&&(b.Gb=Tc,b.Hb=Tc)}};lt.prototype.commitNodes=function(){var a=0,b=0;if(this.RH){var c=D.Nf();this.Kh(this.network,c);b=this.Ae;a=b.x-c.x;b=b.y-c.y;D.Mb(c)}for(var c=D.Nf(),d=this.network.vertexes.j;d.next();){var e=d.value;if(0!==a||0!==b)c.assign(e.sb),c.x+=a,c.y+=b,e.sb=c;e.commit()}D.Mb(c)};
lt.prototype.commitLinks=function(){for(var a=this.network.edges.j;a.next();)a.value.commit()};lt.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.Vo:a};lt.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.Uo:a};lt.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.So:a};lt.prototype.electricalFieldX=function(){return 0};lt.prototype.electricalFieldY=function(){return 0};
lt.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.To:a};lt.prototype.gravitationalFieldX=function(){return 0};lt.prototype.gravitationalFieldY=function(){return 0};lt.prototype.isFixed=function(a){return a.isFixed};D.w(lt,{gL:"currentIteration"},function(){return this.os});D.defineProperty(lt,{IE:"arrangementSpacing"},function(){return this.sg},function(a){D.l(a,Ca,lt,"arrangementSpacing");this.sg.O(a)||(this.sg.assign(a),this.N())});
D.defineProperty(lt,{RH:"arrangesToOrigin"},function(){return this.hr},function(a){this.hr!==a&&(D.h(a,"boolean",lt,"arrangesToOrigin"),this.hr=a,this.N())});D.defineProperty(lt,{Rq:"setsPortSpots"},function(){return this.pi},function(a){this.pi!==a&&(D.h(a,"boolean",lt,"setsPortSpots"),this.pi=a,this.N())});D.defineProperty(lt,{comments:"comments"},function(){return this.Yh},function(a){this.Yh!==a&&(D.h(a,"boolean",lt,"comments"),this.Yh=a,this.N())});
D.defineProperty(lt,{fB:"maxIterations"},function(){return this.zp},function(a){this.zp!==a&&(D.h(a,"number",lt,"maxIterations"),0<=a&&(this.zp=a,this.N()))});D.defineProperty(lt,{jF:"epsilonDistance"},function(){return this.Rr},function(a){this.Rr!==a&&(D.h(a,"number",lt,"epsilonDistance"),0<a&&(this.Rr=a,this.N()))});D.defineProperty(lt,{EL:"infinityDistance"},function(){return this.di},function(a){this.di!==a&&(D.h(a,"number",lt,"infinityDistance"),1<a&&(this.di=a,this.N()))});
D.defineProperty(lt,{ty:"randomNumberGenerator"},function(){return this.$s},function(a){this.$s!==a&&(null!==a&&"function"!==typeof a.random&&D.k('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+a),this.$s=a)});D.defineProperty(lt,{sL:"defaultSpringStiffness"},function(){return this.Vo},function(a){this.Vo!==a&&(D.h(a,"number",lt,"defaultSpringStiffness"),this.Vo=a,this.N())});
D.defineProperty(lt,{rL:"defaultSpringLength"},function(){return this.Uo},function(a){this.Uo!==a&&(D.h(a,"number",lt,"defaultSpringLength"),this.Uo=a,this.N())});D.defineProperty(lt,{lL:"defaultElectricalCharge"},function(){return this.So},function(a){this.So!==a&&(D.h(a,"number",lt,"defaultElectricalCharge"),this.So=a,this.N())});D.defineProperty(lt,{mL:"defaultGravitationalMass"},function(){return this.To},function(a){this.To!==a&&(D.h(a,"number",lt,"defaultGravitationalMass"),this.To=a,this.N())});
D.defineProperty(lt,{nI:"defaultCommentSpringLength"},function(){return this.Fr},function(a){this.Fr!==a&&(D.h(a,"number",lt,"defaultCommentSpringLength"),this.Fr=a,this.N())});D.defineProperty(lt,{mI:"defaultCommentElectricalCharge"},function(){return this.Er},function(a){this.Er!==a&&(D.h(a,"number",lt,"defaultCommentElectricalCharge"),this.Er=a,this.N())});function lu(){this.eC=this.dC=this.Oy=this.Qy=this.Py=0}function vt(){va.call(this)}D.Sa(vt,va);D.ja("ForceDirectedNetwork",vt);
vt.prototype.createVertex=function(){return new ju};vt.prototype.createEdge=function(){return new ou};function ju(){wa.call(this);this.isFixed=!1;this.mass=this.charge=NaN;this.Zk=this.og=this.forceY=this.forceX=0;this.Uh=this.Gn=null;this.xB=0}D.Sa(ju,wa);D.ja("ForceDirectedVertex",ju);function ou(){xa.call(this);this.length=this.stiffness=NaN}D.Sa(ou,xa);D.ja("ForceDirectedEdge",ou);
function pu(){0<arguments.length&&D.td(pu);Tg.call(this);this.ee=this.Zm=25;this.fa=0;this.Ro=qu;this.vp=ru;this.jp=su;this.Xm=4;this.Eo=tu;this.oj=uu;this.pi=!0;this.ts=4;this.Pb=this.ow=this.yb=-1;this.Uf=this.Cs=0;this.Ub=this.Sf=this.Tf=this.Fg=this.se=null;this.Ks=0;this.Js=this.dn=null;this.Hg=0;this.Ls=null;this.nC=new O;this.xh=[];this.xh.length=100}D.Sa(pu,Tg);D.ja("LayeredDigraphLayout",pu);
pu.prototype.cloneProtected=function(a){Tg.prototype.cloneProtected.call(this,a);a.Zm=this.Zm;a.ee=this.ee;a.fa=this.fa;a.Ro=this.Ro;a.vp=this.vp;a.jp=this.jp;a.Xm=this.Xm;a.Eo=this.Eo;a.oj=this.oj;a.pi=this.pi;a.ts=this.ts};pu.prototype.nc=function(a){a.Ne===pu?0===a.name.indexOf("Aggressive")?this.PH=a:0===a.name.indexOf("Cycle")?this.lI=a:0===a.name.indexOf("Init")?this.cJ=a:0===a.name.indexOf("Layer")?this.pJ=a:D.k("Unknown enum value: "+a):Tg.prototype.nc.call(this,a)};
pu.prototype.createNetwork=function(){return new vu};
pu.prototype.doLayout=function(a){null===a&&D.k("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));this.Ae=this.initialOrigin(this.Ae);this.ow=-1;this.Uf=this.Cs=0;this.Ls=this.Js=this.dn=null;for(a=0;a<this.xh.length;a++)this.xh[a]=null;if(0<this.network.vertexes.count){this.network.Ax();for(a=this.network.edges.j;a.next();)a.value.rev=!1;switch(this.Ro){default:case wu:a=this.network;var b=
0,c=a.vertexes.count-1,d=[];d.length=c+1;for(var e=a.vertexes.j;e.next();)e.value.valid=!0;for(;null!==xu(a);){for(e=yu(a);null!==e;)d[c]=e,c--,e.valid=!1,e=yu(a);for(e=zu(a);null!==e;)d[b]=e,b++,e.valid=!1,e=zu(a);for(var e=null,g=0,h=this.network.vertexes.j;h.next();){var k=h.value;if(k.valid){for(var l=0,m=k.pc;m.next();)m.value.toVertex.valid&&l++;for(var m=0,n=k.sc;n.next();)n.value.fromVertex.valid&&m++;if(null===e||g<l-m)e=k,g=l-m}}null!==e&&(d[b]=e,b++,e.valid=!1)}for(b=0;b<a.vertexes.count;b++)d[b].index=
b;for(d=a.edges.j;d.next();)b=d.value,b.fromVertex.index>b.toVertex.index&&(a.zy(b),b.rev=!0);break;case qu:for(d=this.network.vertexes.j;d.next();)a=d.value,a.lq=-1,a.finish=-1;for(a=this.network.edges.j;a.next();)a.value.forest=!1;this.Ks=0;for(d.reset();d.next();)b=d.value,0===b.sc.count&&Au(this,b);for(d.reset();d.next();)b=d.value,-1===b.lq&&Au(this,b);for(a.reset();a.next();)d=a.value,d.forest||(b=d.fromVertex,c=b.finish,e=d.toVertex,g=e.finish,e.lq<b.lq&&c<g&&(this.network.zy(d),d.rev=!0))}for(a=
this.network.vertexes.j;a.next();)a.value.layer=-1;this.yb=-1;this.assignLayers();for(a.reset();a.next();)this.yb=Math.max(this.yb,a.value.layer);a=this.network;d=[];for(c=a.edges.j;c.next();)b=c.value,b.valid=!1,d.push(b);for(c=0;c<d.length;c++)if(b=d[c],g=b.fromVertex,e=b.toVertex,!b.valid&&(null!==g.Bd&&null!==e.Bd||g.layer!==e.layer)){m=k=l=h=0;if(null!==b.link){l=b.link;if(null===l)continue;var p=g.Bd,h=e.Bd;if(null===p||null===h)continue;var q=l.aa,k=l.da,r=l.dd,m=l.Ld;b.rev&&(l=q,n=r,q=k,r=
m,k=l,m=n);var s=g.W,l=e.W,u=b.rev?e.R:g.R,n=D.P();u.F()?(ir(q,r,gc,n),n.F()||n.assign(s)):n.assign(s);p!==q&&u.F()&&q.isVisible()&&(p=g.R,p.F()&&(n.x+=u.x-p.x,n.y+=u.y-p.y));q=b.rev?g.R:e.R;p=D.P();q.F()?(ir(k,m,gc,p),p.F()||p.assign(l)):p.assign(l);h!==k&&q.F()&&k.isVisible()&&(h=e.R,h.F()&&(p.x+=q.x-h.x,p.y+=q.y-h.y));90===this.fa||270===this.fa?(h=Math.round((n.x-s.x)/this.ee),k=n.x,l=Math.round((p.x-l.x)/this.ee),m=p.x):(h=Math.round((n.y-s.y)/this.ee),k=n.y,l=Math.round((p.y-l.y)/this.ee),m=
p.y);D.A(n);D.A(p);b.portFromColOffset=h;b.portFromPos=k;b.portToColOffset=l;b.portToPos=m}else b.portFromColOffset=0,b.portFromPos=0,b.portToColOffset=0,b.portToPos=0;n=g.layer;s=e.layer;a:if(p=b,q=0,u=p.link,null!==u){var t=u.dd,y=u.Ld;if(null!==t&&null!==y){var w=u.aa,r=u.da;if(null!==w&&null!==r){var C=t.Gb,A=y.Hb;this.Rq||(u.Gb.ed()||(C=u.Gb),u.Hb.ed()||(A=u.Hb));var N=u.qc,H=Bu(this,!0);if(C.ed()||C===bc)C=H;var W=Bu(this,!1);if(A.ed()||A===bc)A=W;if(C.Kj()&&C.Ij(W)&&A.Kj()&&A.Ij(H)){q=0;break a}H=
u.getLinkPoint(w,t,C,!0,N,r,y,D.P());C=u.getLinkDirection(w,t,H,C,!0,N,r,y);D.A(H);C===Cu(this,p,!0)?q+=1:this.Rq&&null!==w&&1===w.ports.count&&p.rev&&(q+=1);C=u.getLinkPoint(r,y,A,!1,N,w,t,D.P());u=u.getLinkDirection(r,y,C,A,!1,N,w,t);D.A(C);u===Cu(this,p,!1)?q+=2:this.Rq&&null!==r&&1===r.ports.count&&p.rev&&(q+=2)}}}p=1===q||3===q?!0:!1;if(q=2===q||3===q?!0:!1)r=a.createVertex(),r.Bd=null,r.Dn=1,r.layer=n,r.near=g,a.Xl(r),g=a.Cq(g,r,b.link),g.valid=!1,g.rev=b.rev,g.portFromColOffset=h,g.portToColOffset=
0,g.portFromPos=k,g.portToPos=0,g=r;u=1;p&&u--;if(n-s>u&&0<n){b.valid=!1;r=a.createVertex();r.Bd=null;r.Dn=2;r.layer=n-1;a.Xl(r);g=a.Cq(g,r,b.link);g.valid=!0;g.rev=b.rev;g.portFromColOffset=q?0:h;g.portToColOffset=0;g.portFromPos=q?0:k;g.portToPos=0;g=r;for(n--;n-s>u&&0<n;)r=a.createVertex(),r.Bd=null,r.Dn=3,r.layer=n-1,a.Xl(r),g=a.Cq(g,r,b.link),g.valid=!0,g.rev=b.rev,g.portFromColOffset=0,g.portToColOffset=0,g.portFromPos=0,g.portToPos=0,g=r,n--;g=a.Cq(r,e,b.link);g.valid=!p;p&&(r.near=e);g.rev=
b.rev;g.portFromColOffset=0;g.portToColOffset=l;g.portFromPos=0;g.portToPos=m}else b.valid=!0}d=this.se=[];for(b=0;b<=this.yb;b++)d[b]=0;for(a=this.network.vertexes.j;a.next();)a.value.index=-1;this.initializeIndices();this.ow=-1;for(b=this.Uf=this.Cs=0;b<=this.yb;b++)d[b]>d[this.Uf]&&(this.ow=d[b]-1,this.Uf=b),d[b]<d[this.Cs]&&(this.Cs=b);this.Ls=[];for(b=0;b<d.length;b++)this.Ls[b]=[];for(a.reset();a.next();)d=a.value,this.Ls[d.layer][d.index]=d;this.Pb=-1;for(a=0;a<=this.yb;a++){d=Du(this,a);b=
0;c=this.se[a];for(e=0;e<c;e++)g=d[e],b+=this.nodeMinColumnSpace(g,!0),g.column=b,b+=1,b+=this.nodeMinColumnSpace(g,!1);this.Pb=Math.max(this.Pb,b-1);Eu(this,a,d)}this.reduceCrossings();this.straightenAndPack();this.updateParts()}this.network=null;this.Hf=!0};pu.prototype.linkMinLength=function(){return 1};function Fu(a){var b=a.fromVertex.Bd;a=a.toVertex.Bd;return null===b&&null===a?8:null===b||null===a?4:1}
pu.prototype.nodeMinLayerSpace=function(a,b){return null===a.Bd?0:90===this.fa||270===this.fa?b?a.W.y+10:a.R.height-a.W.y+10:b?a.W.x+10:a.R.width-a.W.x+10};pu.prototype.nodeMinColumnSpace=function(a,b){if(null===a.Bd)return 0;var c=b?a.nB:a.mB;if(null!==c)return c;c=this.fa;return 90===c||270===c?b?a.nB=a.W.x/this.ee+1|0:a.mB=(a.R.width-a.W.x)/this.ee+1|0:b?a.nB=a.W.y/this.ee+1|0:a.mB=(a.R.height-a.W.y)/this.ee+1|0};
function Gu(a){null===a.dn&&(a.dn=[]);for(var b=0,c=a.network.vertexes.j;c.next();){var d=c.value;a.dn[b]=d.layer;b++;a.dn[b]=d.column;b++;a.dn[b]=d.index;b++}return a.dn}function Hu(a,b){for(var c=0,d=a.network.vertexes.j;d.next();){var e=d.value;e.layer=b[c];c++;e.column=b[c];c++;e.index=b[c];c++}}
function Iu(a,b,c){v&&(D.p(b,pu,"crossingMatrix:unfixedLayer"),D.p(c,pu,"crossingMatrix:direction"));var d=Du(a,b),e=a.se[b];if(null===a.Js||a.Js.length<e*e)a.Js=[];for(var g=a.Js,h=0;h<e;h++){var k=0,l=d[h],m=l.near,n=0;if(null!==m&&m.layer===l.layer)if(n=m.index,n>h)for(var p=h+1;p<n;p++)l=d[p],l.near===m&&l.Dn===m.Dn||k++;else for(p=h-1;p>n;p--)l=d[p],l.near===m&&l.Dn===m.Dn||k++;var m=0,q,r=q=p=l=0,s,u=0,t=0;s=0;var y;if(0<=c)for(n=d[h].Ve,m=0;m<n.count;m++)if(q=n.o[m],q.valid&&q.fromVertex.layer!==
b)for(l=q.fromVertex.index,p=q.portToPos,q=q.portFromPos,r=m+1;r<n.count;r++)s=n.o[r],s.valid&&s.fromVertex.layer!==b&&(u=s.fromVertex.index,t=s.portToPos,s=s.portFromPos,p<t&&(l>u||l===u&&q>s)&&k++,t<p&&(u>l||u===l&&s>q)&&k++);if(0>=c)for(n=d[h].Pe,m=0;m<n.count;m++)if(q=n.o[m],q.valid&&q.toVertex.layer!==b)for(l=q.toVertex.index,p=q.portToPos,q=q.portFromPos,r=m+1;r<n.count;r++)s=n.o[r],s.valid&&s.toVertex.layer!==b&&(u=s.toVertex.index,t=s.portToPos,s=s.portFromPos,q<s&&(l>u||l===u&&p>t)&&k++,
s<q&&(u>l||u===l&&t>p)&&k++);g[h*e+h]=k;for(n=h+1;n<e;n++){var w=0,C=0;if(0<=c)for(k=d[h].Ve,y=d[n].Ve,m=0;m<k.count;m++)if(q=k.o[m],q.valid&&q.fromVertex.layer!==b)for(l=q.fromVertex.index,q=q.portFromPos,r=0;r<y.count;r++)s=y.o[r],s.valid&&s.fromVertex.layer!==b&&(u=s.fromVertex.index,s=s.portFromPos,(l<u||l===u&&q<s)&&C++,(u<l||u===l&&s<q)&&w++);if(0>=c)for(k=d[h].Pe,y=d[n].Pe,m=0;m<k.count;m++)if(q=k.o[m],q.valid&&q.toVertex.layer!==b)for(l=q.toVertex.index,p=q.portToPos,r=0;r<y.count;r++)s=y.o[r],
s.valid&&s.toVertex.layer!==b&&(u=s.toVertex.index,t=s.portToPos,(l<u||l===u&&p<t)&&C++,(u<l||u===l&&t<p)&&w++);g[h*e+n]=w;g[n*e+h]=C}}Eu(a,b,d);return g}pu.prototype.countCrossings=function(){for(var a=0,b=0;b<=this.yb;b++)for(var c=Iu(this,b,1),d=this.se[b],e=0;e<d;e++)for(var g=e;g<d;g++)a+=c[e*d+g];return a};
function Ju(a){for(var b=0,c=0;c<=a.yb;c++){for(var d=a,e=c,g=Du(d,e),h=d.se[e],k=0,l=0;l<h;l++){var m=null,m=g[l].Pe,n,p=0,q=0;if(null!==m)for(var r=0;r<m.count;r++)n=m.o[r],n.valid&&n.toVertex.layer!==e&&(p=n.fromVertex.column+n.portFromColOffset,q=n.toVertex.column+n.portToColOffset,k+=(Math.abs(p-q)+1)*Fu(n))}Eu(d,e,g);b+=k}return b}
pu.prototype.normalize=function(){var a=Infinity;this.Pb=-1;for(var b=this.network.vertexes.j;b.next();){var c=b.value,a=Math.min(a,c.column-this.nodeMinColumnSpace(c,!0));this.Pb=Math.max(this.Pb,c.column+this.nodeMinColumnSpace(c,!1))}for(b.reset();b.next();)b.value.column-=a;this.Pb-=a};
function Ku(a,b,c){v&&(D.p(b,pu,"barycenters:unfixedLayer"),D.p(c,pu,"barycenters:direction"));for(var d=Du(a,b),e=a.se[b],g=[],h=0;h<e;h++){var k=d[h],l=null;0>=c&&(l=k.Ve);var m=null;0<=c&&(m=k.Pe);var n=0,p=0,q=k.near;null!==q&&q.layer===k.layer&&(n+=q.column-1,p++);if(null!==l)for(q=0;q<l.count;q++){var k=l.o[q],r=k.fromVertex;k.valid&&!k.rev&&r.layer!==b&&(n+=r.column,p++)}if(null!==m)for(l=0;l<m.count;l++)k=m.o[l],q=k.toVertex,k.valid&&!k.rev&&q.layer!==b&&(n+=q.column,p++);g[h]=0===p?-1:n/
p}Eu(a,b,d);return g}
function Lu(a,b,c){v&&(D.p(b,pu,"medians:unfixedLayer"),D.p(c,pu,"medians:direction"));for(var d=Du(a,b),e=a.se[b],g=[],h=0;h<e;h++){var k=d[h],l=null;0>=c&&(l=k.Ve);var m=null;0<=c&&(m=k.Pe);var n=0,p=[],q=k.near;null!==q&&q.layer===k.layer&&(p[n]=q.column-1,n++);if(null!==l)for(q=0;q<l.count;q++){var k=l.o[q],r=k.fromVertex;k.valid&&!k.rev&&r.layer!==b&&(p[n]=r.column+k.portFromColOffset,n++)}if(null!==m)for(l=0;l<m.count;l++)k=m.o[l],q=k.toVertex,k.valid&&!k.rev&&q.layer!==b&&(p[n]=q.column+k.portToColOffset,
n++);0===n?g[h]=-1:(p.sort(function(a,b){return a-b}),m=n>>1,g[h]=0!==(n&1)?p[m]:p[m-1]+p[m]>>1)}Eu(a,b,d);return g}function Mu(a,b,c,d,e,g){if(b.component===d){b.component=c;var h=0,k=0;if(e)for(var l=b.pc;l.next();){var k=l.value,m=k.toVertex,h=b.layer-m.layer,k=a.linkMinLength(k);h===k&&Mu(a,m,c,d,e,g)}if(g)for(l=b.sc;l.next();)k=l.value,m=k.fromVertex,h=m.layer-b.layer,k=a.linkMinLength(k),h===k&&Mu(a,m,c,d,e,g)}}
function Nu(a,b,c,d,e,g){if(b.component===d){b.component=c;if(e)for(var h=b.pc;h.next();)Nu(a,h.value.toVertex,c,d,e,g);if(g)for(b=b.sc;b.next();)Nu(a,b.value.fromVertex,c,d,e,g)}}function xu(a){for(a=a.vertexes.j;a.next();){var b=a.value;if(b.valid)return b}return null}function yu(a){for(a=a.vertexes.j;a.next();){var b=a.value;if(b.valid){for(var c=!0,d=b.pc;d.next();)if(d.value.toVertex.valid){c=!1;break}if(c)return b}}return null}
function zu(a){for(a=a.vertexes.j;a.next();){var b=a.value;if(b.valid){for(var c=!0,d=b.sc;d.next();)if(d.value.fromVertex.valid){c=!1;break}if(c)return b}}return null}function Au(a,b){b.lq=a.Ks;a.Ks++;for(var c=b.pc;c.next();){var d=c.value,e=d.toVertex;-1===e.lq&&(d.forest=!0,Au(a,e))}b.finish=a.Ks;a.Ks++}
pu.prototype.assignLayers=function(){switch(this.vp){case Ou:Pu(this);break;case Qu:for(var a=0,b=this.network.vertexes.j;b.next();)a=Ru(this,b.value),this.yb=Math.max(a,this.yb);for(b.reset();b.next();)a=b.value,a.layer=this.yb-a.layer;break;default:case ru:Pu(this);for(b=this.network.vertexes.j;b.next();)b.value.valid=!1;for(b.reset();b.next();)a=b.value,0===a.sc.count&&Su(this,a);a=Infinity;for(b.reset();b.next();)a=Math.min(a,b.value.layer);this.yb=-1;for(b.reset();b.next();){var c=b.value;c.layer-=
a;this.yb=Math.max(this.yb,c.layer)}}};function Pu(a){for(var b=a.network.vertexes.j;b.next();){var c=Tu(a,b.value);a.yb=Math.max(c,a.yb)}}function Tu(a,b){var c=0;if(-1===b.layer){for(var d=b.pc;d.next();)var e=d.value,g=e.toVertex,e=a.linkMinLength(e),c=Math.max(c,Tu(a,g)+e);b.layer=c}else c=b.layer;return c}function Ru(a,b){var c=0;if(-1===b.layer){for(var d=b.sc;d.next();)var e=d.value,g=e.fromVertex,e=a.linkMinLength(e),c=Math.max(c,Ru(a,g)+e);b.layer=c}else c=b.layer;return c}
function Su(a,b){if(!b.valid){b.valid=!0;for(var c=b.pc;c.next();)Su(a,c.value.toVertex);for(c=a.network.vertexes.j;c.next();)c.value.component=-1;for(var d=b.Ve.o,e=d.length,g=0;g<e;g++){var h=d[g],k=h.fromVertex,l=h.toVertex,h=a.linkMinLength(h);k.layer-l.layer>h&&Mu(a,k,0,-1,!0,!1)}for(Mu(a,b,1,-1,!0,!0);0!==b.component;){for(var k=0,d=Infinity,l=0,m=null,n=a.network.vertexes.j;n.next();){var p=n.value;if(1===p.component){for(var q=0,r=!1,s=p.Ve.o,e=s.length,g=0;g<e;g++){var h=s[g],u=h.fromVertex,
q=q+1;1!==u.component&&(k+=1,u=u.layer-p.layer,h=a.linkMinLength(h),d=Math.min(d,u-h))}h=p.Pe.o;e=h.length;for(g=0;g<e;g++)s=h[g].toVertex,q-=1,1!==s.component?k-=1:r=!0;(null===m||q<l)&&!r&&(m=p,l=q)}}if(0<k){for(c.reset();c.next();)e=c.value,1===e.component&&(e.layer+=d);b.component=0}else m.component=0}for(c=a.network.vertexes.j;c.next();)c.value.component=-1;for(Mu(a,b,1,-1,!0,!1);0!==b.component;){g=0;e=Infinity;d=0;h=null;for(k=a.network.vertexes.j;k.next();)if(l=k.value,1===l.component){m=
0;n=!1;r=l.Ve.o;p=r.length;for(q=0;q<p;q++)s=r[q].fromVertex,m+=1,1!==s.component?g+=1:n=!0;r=l.Pe.o;p=r.length;for(q=0;q<p;q++)s=r[q],u=s.toVertex,m-=1,1!==u.component&&(g-=1,u=l.layer-u.layer,s=a.linkMinLength(s),e=Math.min(e,u-s));(null===h||m>d)&&!n&&(h=l,d=m)}if(0>g){for(c.reset();c.next();)g=c.value,1===g.component&&(g.layer-=e);b.component=0}else h.component=0}}}
function Cu(a,b,c){return 90===a.fa?c&&!b.rev||!c&&b.rev?270:90:180===a.fa?c&&!b.rev||!c&&b.rev?0:180:270===a.fa?c&&!b.rev||!c&&b.rev?90:270:c&&!b.rev||!c&&b.rev?180:0}
pu.prototype.initializeIndices=function(){switch(this.jp){default:case Uu:for(var a=this.network.vertexes.j;a.next();){var b=a.value,c=b.layer;b.index=this.se[c];this.se[c]++}break;case su:a=this.network.vertexes.j;for(b=this.yb;0<=b;b--)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&Vu(this,c);break;case Wu:for(a=this.network.vertexes.j,b=0;b<=this.yb;b++)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&Xu(this,c)}};
function Vu(a,b){var c=b.layer;b.index=a.se[c];a.se[c]++;for(var c=b.Pe.lc(),d=!0;d;)for(var d=!1,e=0;e<c.length-1;e++){var g=c[e],h=c[e+1];g.portFromColOffset>h.portFromColOffset&&(d=!0,c[e]=h,c[e+1]=g)}for(e=0;e<c.length;e++)d=c[e],d.valid&&(d=d.toVertex,-1===d.index&&Vu(a,d))}
function Xu(a,b){var c=b.layer;b.index=a.se[c];a.se[c]++;for(var c=b.Ve.lc(),d=!0,e=0;d;)for(d=!1,e=0;e<c.length-1;e++){var g=c[e],h=c[e+1];g.portToColOffset>h.portToColOffset&&(d=!0,c[e]=h,c[e+1]=g)}for(e=0;e<c.length;e++)d=c[e],d.valid&&(d=d.fromVertex,-1===d.index&&Xu(a,d))}
pu.prototype.reduceCrossings=function(){for(var a=this.countCrossings(),b=Gu(this),c=0,d=0,e=0,c=0;c<this.Xm;c++){for(d=0;d<=this.yb;d++)Yu(this,d,1),Zu(this,d,1);e=this.countCrossings();e<a&&(a=e,b=Gu(this));for(d=this.yb;0<=d;d--)Yu(this,d,-1),Zu(this,d,-1);e=this.countCrossings();e<a&&(a=e,b=Gu(this))}Hu(this,b);for(c=0;c<this.Xm;c++){for(d=0;d<=this.yb;d++)Yu(this,d,0),Zu(this,d,0);e=this.countCrossings();e<a&&(a=e,b=Gu(this));for(d=this.yb;0<=d;d--)Yu(this,d,0),Zu(this,d,0);e=this.countCrossings();
e<a&&(a=e,b=Gu(this))}Hu(this,b);var g=!1,h=c=0,k=0,d=0;switch(this.Eo){case $u:break;case av:for(k=a+1;(d=this.countCrossings())<k;)for(k=d,c=this.yb;0<=c;c--)for(h=0;h<=c;h++){for(g=!0;g;)for(g=!1,d=c;d>=h;d--)g=Zu(this,d,-1)||g;e=this.countCrossings();e>=a?Hu(this,b):(a=e,b=Gu(this));for(g=!0;g;)for(g=!1,d=c;d>=h;d--)g=Zu(this,d,1)||g;e=this.countCrossings();e>=a?Hu(this,b):(a=e,b=Gu(this));for(g=!0;g;)for(g=!1,d=h;d<=c;d++)g=Zu(this,d,1)||g;e>=a?Hu(this,b):(a=e,b=Gu(this));for(g=!0;g;)for(g=!1,
d=h;d<=c;d++)g=Zu(this,d,-1)||g;e>=a?Hu(this,b):(a=e,b=Gu(this));for(g=!0;g;)for(g=!1,d=c;d>=h;d--)g=Zu(this,d,0)||g;e>=a?Hu(this,b):(a=e,b=Gu(this));for(g=!0;g;)for(g=!1,d=h;d<=c;d++)g=Zu(this,d,0)||g;e>=a?Hu(this,b):(a=e,b=Gu(this))}break;default:case tu:for(c=this.yb,h=0,k=a+1;(d=this.countCrossings())<k;){k=d;for(g=!0;g;)for(g=!1,d=c;d>=h;d--)g=Zu(this,d,-1)||g;e=this.countCrossings();e>=a?Hu(this,b):(a=e,b=Gu(this));for(g=!0;g;)for(g=!1,d=c;d>=h;d--)g=Zu(this,d,1)||g;e=this.countCrossings();
e>=a?Hu(this,b):(a=e,b=Gu(this));for(g=!0;g;)for(g=!1,d=h;d<=c;d++)g=Zu(this,d,1)||g;e>=a?Hu(this,b):(a=e,b=Gu(this));for(g=!0;g;)for(g=!1,d=h;d<=c;d++)g=Zu(this,d,-1)||g;e>=a?Hu(this,b):(a=e,b=Gu(this));for(g=!0;g;)for(g=!1,d=c;d>=h;d--)g=Zu(this,d,0)||g;e>=a?Hu(this,b):(a=e,b=Gu(this));for(g=!0;g;)for(g=!1,d=h;d<=c;d++)g=Zu(this,d,0)||g;e>=a?Hu(this,b):(a=e,b=Gu(this))}}Hu(this,b)};
function Yu(a,b,c){v&&(D.p(b,pu,"medianBarycenterCrossingReduction:unfixedLayer"),D.p(c,pu,"medianBarycenterCrossingReduction:direction"));var d=0,e=Du(a,b),g=a.se[b],h=Lu(a,b,c);c=Ku(a,b,c);for(d=0;d<g;d++)-1===c[d]&&(c[d]=e[d].column),-1===h[d]&&(h[d]=e[d].column);for(var k=!0,l;k;)for(k=!1,d=0;d<g-1;d++)if(h[d+1]<h[d]||h[d+1]===h[d]&&c[d+1]<c[d])k=!0,l=h[d],h[d]=h[d+1],h[d+1]=l,l=c[d],c[d]=c[d+1],c[d+1]=l,l=e[d],e[d]=e[d+1],e[d+1]=l;for(d=h=0;d<g;d++)l=e[d],l.index=d,h+=a.nodeMinColumnSpace(l,
!0),l.column=h,h+=1,h+=a.nodeMinColumnSpace(l,!1);Eu(a,b,e)}
function Zu(a,b,c){var d=Du(a,b),e=a.se[b];c=Iu(a,b,c);var g=0,h;h=[];for(g=0;g<e;g++)h[g]=-1;var k;k=[];for(g=0;g<e;g++)k[g]=-1;for(var l=!1,m=!0;m;)for(m=!1,g=0;g<e-1;g++){var n=c[d[g].index*e+d[g+1].index],p=c[d[g+1].index*e+d[g].index],q=0,r=0,s=d[g].column,u=d[g+1].column,t=a.nodeMinColumnSpace(d[g],!0),y=a.nodeMinColumnSpace(d[g],!1),w=a.nodeMinColumnSpace(d[g+1],!0),C=a.nodeMinColumnSpace(d[g+1],!1),t=s-t+w,y=u-y+C,w=w=0,A=d[g].sc.j;for(A.reset();A.next();)if(w=A.value,C=w.fromVertex,w.valid&&
C.layer===b){for(w=0;d[w]!==C;)w++;w<g&&(q+=2*(g-w),r+=2*(g+1-w));w===g+1&&(q+=1);w>g+1&&(q+=4*(w-g),r+=4*(w-(g+1)))}A=d[g].pc.j;for(A.reset();A.next();)if(w=A.value,C=w.toVertex,w.valid&&C.layer===b){for(w=0;d[w]!==C;)w++;w===g+1&&(r+=1)}A=d[g+1].sc.j;for(A.reset();A.next();)if(w=A.value,C=w.fromVertex,w.valid&&C.layer===b){for(w=0;d[w]!==C;)w++;w<g&&(q+=2*(g+1-w),r+=2*(g-w));w===g&&(r+=1);w>g+1&&(q+=4*(w-(g+1)),r+=4*(w-g))}A=d[g+1].pc.j;for(A.reset();A.next();)if(w=A.value,C=w.toVertex,w.valid&&
C.layer===b){for(w=0;d[w]!==C;)w++;w===g&&(q+=1)}var w=C=0,A=h[d[g].index],N=k[d[g].index],H=h[d[g+1].index],W=k[d[g+1].index];-1!==A&&(C+=Math.abs(A-s),w+=Math.abs(A-y));-1!==N&&(C+=Math.abs(N-s),w+=Math.abs(N-y));-1!==H&&(C+=Math.abs(H-u),w+=Math.abs(H-t));-1!==W&&(C+=Math.abs(W-u),w+=Math.abs(W-t));if(r<q-.5||r===q&&p<n-.5||r===q&&p===n&&w<C-.5)m=l=!0,d[g].column=y,d[g+1].column=t,n=d[g],d[g]=d[g+1],d[g+1]=n}for(g=0;g<e;g++)d[g].index=g;Eu(a,b,d);return l}
pu.prototype.straightenAndPack=function(){var a=0,b=!1,c=0!==(this.oj&bv),a=this.oj===uu;1E3<this.network.edges.count&&!a&&(c=!1);if(c){b=[];for(a=a=0;a<=this.yb;a++)b[a]=0;for(var d=0,e=this.network.vertexes.j;e.next();){var g=e.value,a=g.layer,d=g.column,g=this.nodeMinColumnSpace(g,!1);b[a]=Math.max(b[a],d+g)}for(e.reset();e.next();)g=e.value,a=g.layer,d=g.column,g.column=(8*(this.Pb-b[a])>>1)+8*d;this.Pb*=8}if(0!==(this.oj&cv))for(b=!0;b;){b=!1;for(a=this.Uf+1;a<=this.yb;a++)b=dv(this,a,1)||b;
for(a=this.Uf-1;0<=a;a--)b=dv(this,a,-1)||b;b=dv(this,this.Uf,0)||b}if(0!==(this.oj&ev)){for(a=this.Uf+1;a<=this.yb;a++)fv(this,a,1);for(a=this.Uf-1;0<=a;a--)fv(this,a,-1);fv(this,this.Uf,0)}c&&(gv(this,-1),gv(this,1));if(0!==(this.oj&cv))for(b=!0;b;){b=!1;b=dv(this,this.Uf,0)||b;for(a=this.Uf+1;a<=this.yb;a++)b=dv(this,a,0)||b;for(a=this.Uf-1;0<=a;a--)b=dv(this,a,0)||b}};
function dv(a,b,c){v&&(D.p(b,pu,"bendStraighten:unfixedLayer"),D.p(c,pu,"bendStraighten:direction"));for(var d=!1;hv(a,b,c);)d=!0;return d}
function hv(a,b,c){v&&(D.p(b,pu,"shiftbendStraighten:unfixedLayer"),D.p(c,pu,"shiftbendStraighten:direction"));var d=0,e=Du(a,b),g=a.se[b],h=Ku(a,b,-1);if(0<c)for(d=0;d<g;d++)h[d]=-1;var k=Ku(a,b,1);if(0>c)for(d=0;d<g;d++)k[d]=-1;for(var l=!1,m=!0;m;)for(m=!1,d=0;d<g;d++){var n=e[d].column,p=a.nodeMinColumnSpace(e[d],!0),q=a.nodeMinColumnSpace(e[d],!1),r=0,r=0>d-1||n-e[d-1].column-1>p+a.nodeMinColumnSpace(e[d-1],!1)?n-1:n,p=0,p=d+1>=g||e[d+1].column-n-1>q+a.nodeMinColumnSpace(e[d+1],!0)?n+1:n,s=q=
0,u=0,t=0,y=0,w=0;if(0>=c)for(var C=e[d].sc.j;C.next();){var w=C.value,A=w.fromVertex;w.valid&&A.layer!==b&&(t=Fu(w),y=w.portFromColOffset,w=w.portToColOffset,A=A.column,q+=(Math.abs(n+w-(A+y))+1)*t,s+=(Math.abs(r+w-(A+y))+1)*t,u+=(Math.abs(p+w-(A+y))+1)*t)}if(0<=c)for(C=e[d].pc.j;C.next();)w=C.value,A=w.toVertex,w.valid&&A.layer!==b&&(t=Fu(w),y=w.portFromColOffset,w=w.portToColOffset,A=A.column,q+=(Math.abs(n+y-(A+w))+1)*t,s+=(Math.abs(r+y-(A+w))+1)*t,u+=(Math.abs(p+y-(A+w))+1)*t);w=y=t=0;C=h[e[d].index];
A=k[e[d].index];-1!==C&&(t+=Math.abs(C-n),y+=Math.abs(C-r),w+=Math.abs(C-p));-1!==A&&(t+=Math.abs(A-n),y+=Math.abs(A-r),w+=Math.abs(A-p));if(s<q||s===q&&y<t)m=l=!0,e[d].column=r;else if(u<q||u===q&&w<t)m=l=!0,e[d].column=p}Eu(a,b,e);a.normalize();return l}
function fv(a,b,c){v&&(D.p(b,pu,"medianStraighten:unfixedLayer"),D.p(c,pu,"medianStraighten:direction"));var d=0,e=Du(a,b),g=a.se[b],h=Lu(a,b,c);c=[];for(d=0;d<g;d++)c[d]=h[d];for(h=!0;h;)for(h=!1,d=0;d<g;d++){var k=e[d].column,l=a.nodeMinColumnSpace(e[d],!0),m=a.nodeMinColumnSpace(e[d],!1),n=0,p=0,q=0,q=p=0;-1===c[d]?0===d&&d===g-1?n=k:0===d?(p=e[d+1].column,n=p-k===m+a.nodeMinColumnSpace(e[d+1],!0)?k-1:k):d===g-1?(q=e[d-1].column,n=k-q===l+a.nodeMinColumnSpace(e[d-1],!1)?k+1:k):(q=e[d-1].column,
q=q+a.nodeMinColumnSpace(e[d-1],!1)+l+1,p=e[d+1].column,p=p-a.nodeMinColumnSpace(e[d+1],!0)-m-1,n=(q+p)/2|0):0===d&&d===g-1?n=c[d]:0===d?(p=e[d+1].column,p=p-a.nodeMinColumnSpace(e[d+1],!0)-m-1,n=Math.min(c[d],p)):d===g-1?(q=e[d-1].column,q=q+a.nodeMinColumnSpace(e[d-1],!1)+l+1,n=Math.max(c[d],q)):(q=e[d-1].column,q=q+a.nodeMinColumnSpace(e[d-1],!1)+l+1,p=e[d+1].column,p=p-a.nodeMinColumnSpace(e[d+1],!0)-m-1,q<c[d]&&c[d]<p?n=c[d]:q>=c[d]?n=q:p<=c[d]&&(n=p));n!==k&&(h=!0,e[d].column=n)}Eu(a,b,e);a.normalize()}
function iv(a,b){v&&(D.p(b,pu,"packAux:column"),D.p(1,pu,"packAux:direction"));for(var c=!0,d=a.network.vertexes.j;d.next();){var e=d.value,g=a.nodeMinColumnSpace(e,!0),h=a.nodeMinColumnSpace(e,!1);if(e.column-g<=b&&e.column+h>=b){c=!1;break}}e=!1;if(c)for(d.reset();d.next();)c=d.value,c.column>b&&(c.column-=1,e=!0);return e}
function jv(a,b){v&&(D.p(b,pu,"tightPackAux:column"),D.p(1,pu,"tightPackAux:direction"));for(var c=b,c=b+1,d=0,e=[],g=[],d=0;d<=a.yb;d++)e[d]=!1,g[d]=!1;for(var h=a.network.vertexes.j;h.next();){var d=h.value,k=d.column-a.nodeMinColumnSpace(d,!0),l=d.column+a.nodeMinColumnSpace(d,!1);k<=b&&l>=b&&(e[d.layer]=!0);k<=c&&l>=c&&(g[d.layer]=!0)}k=!0;c=!1;for(d=0;d<=a.yb;d++)k=k&&!(e[d]&&g[d]);if(k)for(h.reset();h.next();)e=h.value,e.column>b&&(e.column-=1,c=!0);return c}
function gv(a,b){v&&D.p(b,pu,"componentPack:direction");for(var c=0;c<=a.Pb;c++)for(;iv(a,c););a.normalize();for(c=0;c<a.Pb;c++)for(;jv(a,c););a.normalize();var c=0,d,e=0,g=0,h=0;if(0<b)for(c=0;c<=a.Pb;c++)for(d=Gu(a),e=Ju(a),g=e+1;e<g;)g=e,kv(a,c,1),h=Ju(a),h>e?Hu(a,d):h<e&&(e=h,d=Gu(a));if(0>b)for(c=a.Pb;0<=c;c--)for(d=Gu(a),e=Ju(a),g=e+1;e<g;)g=e,kv(a,c,-1),h=Ju(a),h>e?Hu(a,d):h<e&&(e=h,d=Gu(a));a.normalize()}
function kv(a,b,c){a.Hg=0;for(var d=a.network.vertexes.j;d.next();)d.value.component=-1;if(0<c)for(d.reset();d.next();){var e=d.value;e.column-a.nodeMinColumnSpace(e,!0)<=b&&(e.component=a.Hg)}if(0>c)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.Hg);a.Hg++;for(d.reset();d.next();)b=d.value,-1===b.component&&(Nu(a,b,a.Hg,-1,!0,!0),a.Hg++);var g=0;b=[];for(g=0;g<a.Hg*a.Hg;g++)b[g]=!1;e=[];for(g=0;g<(a.yb+1)*(a.Pb+1);g++)e[g]=-1;for(d.reset();d.next();)for(var g=
d.value,h=g.layer,k=Math.max(0,g.column-a.nodeMinColumnSpace(g,!0)),l=Math.min(a.Pb,g.column+a.nodeMinColumnSpace(g,!1));k<=l;k++)e[h*(a.Pb+1)+k]=g.component;for(g=0;g<=a.yb;g++){if(0<c)for(k=0;k<a.Pb;k++)-1!==e[g*(a.Pb+1)+k]&&-1!==e[g*(a.Pb+1)+k+1]&&e[g*(a.Pb+1)+k]!==e[g*(a.Pb+1)+k+1]&&(b[e[g*(a.Pb+1)+k]*a.Hg+e[g*(a.Pb+1)+k+1]]=!0);if(0>c)for(k=a.Pb;0<k;k--)-1!==e[g*(a.Pb+1)+k]&&-1!==e[g*(a.Pb+1)+k-1]&&e[g*(a.Pb+1)+k]!==e[g*(a.Pb+1)+k-1]&&(b[e[g*(a.Pb+1)+k]*a.Hg+e[g*(a.Pb+1)+k-1]]=!0)}e=[];for(g=
0;g<a.Hg;g++)e[g]=!0;h=new K("number");h.add(0);for(l=0;0!==h.count;)if(l=h.o[h.count-1],h.jd(h.count-1),e[l])for(e[l]=!1,g=0;g<a.Hg;g++)b[l*a.Hg+g]&&h.Xd(0,g);if(0<c)for(d.reset();d.next();)a=d.value,e[a.component]&&(a.column-=1);if(0>c)for(d.reset();d.next();)c=d.value,e[c.component]&&(c.column+=1)}
pu.prototype.commitLayout=function(){if(this.Rq)for(var a=Bu(this,!0),b=Bu(this,!1),c=this.network.edges.j;c.next();){var d=c.value.link;null!==d&&(d.Gb=a,d.Hb=b)}this.commitNodes();this.sA();this.zu&&this.commitLinks()};function Bu(a,b){return 270===a.fa?b?Yc:gd:90===a.fa?b?gd:Yc:180===a.fa?b?ed:fd:b?fd:ed}
pu.prototype.commitNodes=function(){this.Fg=[];this.Tf=[];this.Sf=[];this.Ub=[];for(var a=0;a<=this.yb;a++)this.Fg[a]=0,this.Tf[a]=0,this.Sf[a]=0,this.Ub[a]=0;for(a=this.network.vertexes.j;a.next();){var b=a.value,c=b.layer;this.Fg[c]=Math.max(this.Fg[c],this.nodeMinLayerSpace(b,!0));this.Tf[c]=Math.max(this.Tf[c],this.nodeMinLayerSpace(b,!1))}for(var b=0,d=this.Zm,c=0;c<=this.yb;c++){var e=d;0>=this.Fg[c]+this.Tf[c]&&(e=0);0<c&&(b+=e/2);90===this.fa||0===this.fa?(b+=this.Tf[c],this.Sf[c]=b,b+=this.Fg[c]):
(b+=this.Fg[c],this.Sf[c]=b,b+=this.Tf[c]);c<this.yb&&(b+=e/2);this.Ub[c]=b}d=b;b=this.Ae;for(c=0;c<=this.yb;c++)270===this.fa?this.Sf[c]=b.y+this.Sf[c]:90===this.fa?(this.Sf[c]=b.y+d-this.Sf[c],this.Ub[c]=d-this.Ub[c]):180===this.fa?this.Sf[c]=b.x+this.Sf[c]:(this.Sf[c]=b.x+d-this.Sf[c],this.Ub[c]=d-this.Ub[c]);a.reset();for(d=e=Infinity;a.next();){var c=a.value,g=c.layer,h=c.column|0,k=0,l=0;270===this.fa||90===this.fa?(k=b.x+this.ee*h,l=this.Sf[g]):(k=this.Sf[g],l=b.y+this.ee*h);c.na=k;c.va=l;
e=Math.min(c.x,e);d=Math.min(c.y,d)}e=b.x-e;b=b.y-d;this.nC=new O(e,b);for(a.reset();a.next();)c=a.value,c.x+=e,c.y+=b,c.commit()};
pu.prototype.sA=function(){for(var a=0,b=this.Zm,c=0;c<=this.yb;c++)a+=this.Fg[c],a+=this.Tf[c];for(var a=a+this.yb*b,b=[],c=this.ee*this.Pb,d=this.yJ;0<=d;d--)270===this.fa?0===d?b.push(new B(0,0,c,Math.abs(this.Ub[0]))):b.push(new B(0,this.Ub[d-1],c,Math.abs(this.Ub[d-1]-this.Ub[d]))):90===this.fa?0===d?b.push(new B(0,this.Ub[0],c,Math.abs(this.Ub[0]-a))):b.push(new B(0,this.Ub[d],c,Math.abs(this.Ub[d-1]-this.Ub[d]))):180===this.fa?0===d?b.push(new B(0,0,Math.abs(this.Ub[0]),c)):b.push(new B(this.Ub[d-
1],0,Math.abs(this.Ub[d-1]-this.Ub[d]),c)):0===d?b.push(new B(this.Ub[0],0,Math.abs(this.Ub[0]-a),c)):b.push(new B(this.Ub[d],0,Math.abs(this.Ub[d-1]-this.Ub[d]),c));this.commitLayers(b,this.nC)};pu.prototype.commitLayers=function(){};
pu.prototype.commitLinks=function(){for(var a=this.network.edges.j,b;a.next();)b=a.value.link,null!==b&&(b.zm(),b.dq(),b.Aj());for(a.reset();a.next();)b=a.value.link,null!==b&&b.yo();for(a.reset();a.next();){var c=a.value;b=c.link;if(null!==b){b.zm();var d=b,e=d.aa,g=d.da,h=d.dd,k=d.Ld,l=c.fromVertex,m=c.toVertex;if(c.valid){if(b.gf===Nj&&4===b.ta){if(c.rev)var n=e,e=g,g=n,p=h,h=k,k=p;if(l.column===m.column){var q=b.getLinkPoint(e,h,b.computeSpot(!0),!0,!1,g,k),r=b.getLinkPoint(g,k,b.computeSpot(!1),
!1,!1,e,h);q.F()||q.set(e.$.bm);r.F()||r.set(g.$.bm);b.dq();b.Wl(q.x,q.y);b.Wl((2*q.x+r.x)/3,(2*q.y+r.y)/3);b.Wl((q.x+2*r.x)/3,(q.y+2*r.y)/3);b.Wl(r.x,r.y)}else{var s=!1,u=!1;null!==h&&b.computeSpot(!0)===bc&&(s=!0);null!==k&&b.computeSpot(!1)===bc&&(u=!0);if(s||u){var t=b.n(0).x,y=b.n(0).y,w=b.n(1).x,C=b.n(1).y,A=b.n(2).x,N=b.n(2).y,H=b.n(3).x,W=b.n(3).y;if(s){90===this.fa||270===this.fa?(w=t,C=(y+W)/2):(w=(t+H)/2,C=y);b.ia(1,w,C);var fa=b.getLinkPoint(e,h,b.computeSpot(!0),!0,!1,g,k);fa.F()||fa.set(e.$.bm);
b.ia(0,fa.x,fa.y)}u&&(90===this.fa||270===this.fa?(A=H,N=(y+W)/2):(A=(t+H)/2,N=W),b.ia(2,A,N),fa=b.getLinkPoint(g,k,b.computeSpot(!1),!1,!1,e,h),fa.F()||fa.set(g.$.bm),b.ia(3,fa.x,fa.y))}}}b.Aj()}else if(l.layer===m.layer)b.Aj();else{var S=!1,ba=!1,ia=0,U=b.ju+1;if(b.qc)ba=!0,ia=b.ta,4<ia&&b.points.removeRange(2,ia-3);else if(b.gf===Nj)S=!0,ia=b.ta,4<ia&&b.points.removeRange(2,ia-3),U=2;else{var ia=b.ta,Ua=b.computeSpot(!0)===bc,lb=b.computeSpot(!1)===bc;2<ia&&Ua&&lb?b.points.removeRange(1,ia-2):
3<ia&&Ua&&!lb?b.points.removeRange(1,ia-3):3<ia&&!Ua&&lb?b.points.removeRange(2,ia-2):4<ia&&!Ua&&!lb&&b.points.removeRange(2,ia-3)}var ua,Oa;if(c.rev){for(var Fa=0;null!==m&&l!==m;){Oa=ua=null;for(var Vb=m.sc.j;Vb.next();){var Rb=Vb.value;if(Rb.link===c.link&&(ua=Rb.fromVertex,Oa=Rb.toVertex,null===ua.Bd))break}if(ua!==l)if(Za=b.n(U-1).x,pb=b.n(U-1).y,sa=ua.na,pa=ua.va,ba)180===this.fa||0===this.fa?2===U?(b.B(U++,Za,pb),b.B(U++,Za,pa)):(ve=null!==Oa?Oa.va:pb,ve!==pa&&(mb=this.Ub[ua.layer-1],b.B(U++,
mb,pb),b.B(U++,mb,pa))):2===U?(b.B(U++,Za,pb),b.B(U++,sa,pb)):(Id=null!==Oa?Oa.na:Za,Id!==sa&&(mb=this.Ub[ua.layer-1],b.B(U++,Za,mb),b.B(U++,sa,mb)));else if(2===U)if(nb=Math.max(10,this.Fg[m.layer]),ib=Math.max(10,this.Tf[m.layer]),S)180===this.fa?sa<=m.R.x?(Fa=m.R.x,b.B(U++,Fa-nb,pa),b.B(U++,Fa,pa),b.B(U++,Fa+ib,pa)):(b.B(U++,sa-nb,pa),b.B(U++,sa,pa),b.B(U++,sa+ib,pa)):90===this.fa?pa>=m.R.bottom?(Fa=m.R.y+m.R.height,b.B(U++,sa,Fa+ib),b.B(U++,sa,Fa),b.B(U++,sa,Fa-nb)):(b.B(U++,sa,pa+ib),b.B(U++,
sa,pa),b.B(U++,sa,pa-nb)):270===this.fa?pa<=m.R.y?(Fa=m.R.y,b.B(U++,sa,Fa-nb),b.B(U++,sa,Fa),b.B(U++,sa,Fa+ib)):(b.B(U++,sa,pa-nb),b.B(U++,sa,pa),b.B(U++,sa,pa+ib)):0===this.fa&&(sa>=m.R.right?(Fa=m.R.x+m.R.width,b.B(U++,Fa+ib,pa),b.B(U++,Fa,pa),b.B(U++,Fa-nb,pa)):(b.B(U++,sa+ib,pa),b.B(U++,sa,pa),b.B(U++,sa-nb,pa)));else{b.B(U++,Za,pb);var de=0;if(180===this.fa||0===this.fa){if(180===this.fa?sa>=m.R.right:sa<=m.R.x)de=(0===this.fa?-nb:ib)/2;b.B(U++,Za+de,pa)}else{if(270===this.fa?pa>=m.R.bottom:
pa<=m.R.y)de=(90===this.fa?-nb:ib)/2;b.B(U++,sa,pb+de)}b.B(U++,sa,pa)}else nb=Math.max(10,this.Fg[ua.layer]),ib=Math.max(10,this.Tf[ua.layer]),180===this.fa?(S&&b.B(U++,sa-nb,pa),b.B(U++,sa,pa),S&&b.B(U++,sa+ib,pa)):90===this.fa?(S&&b.B(U++,sa,pa+ib),b.B(U++,sa,pa),S&&b.B(U++,sa,pa-nb)):270===this.fa?(S&&b.B(U++,sa,pa-nb),b.B(U++,sa,pa),S&&b.B(U++,sa,pa+ib)):(S&&b.B(U++,sa+ib,pa),b.B(U++,sa,pa),S&&b.B(U++,sa-nb,pa));m=ua}if(null===k||b.computeSpot(!1)!==bc||ba)if(Za=b.n(U-1).x,pb=b.n(U-1).y,sa=b.n(U).x,
pa=b.n(U).y,ba){var sd=this.Tf[l.layer],vc=0;180===this.fa||0===this.fa?(vc=pb,vc>=l.R.y&&vc<=l.R.bottom&&(180===this.fa?sa>=l.R.x:sa<=l.R.right)&&(Fa=l.na+(180===this.fa?-sd:sd),vc=vc<l.R.y+l.R.height/2?l.R.y-this.ee/2:l.R.bottom+this.ee/2,b.B(U++,Fa,pb),b.B(U++,Fa,vc)),b.B(U++,sa,vc)):(vc=Za,vc>=l.R.x&&vc<=l.R.right&&(270===this.fa?pa>=l.R.y:pa<=l.R.bottom)&&(Fa=l.va+(270===this.fa?-sd:sd),vc=vc<l.R.x+l.R.width/2?l.R.x-this.ee/2:l.R.right+this.ee/2,b.B(U++,Za,Fa),b.B(U++,vc,Fa)),b.B(U++,vc,pa));
b.B(U++,sa,pa)}else if(S)nb=Math.max(10,this.Fg[l.layer]),ib=Math.max(10,this.Tf[l.layer]),180===this.fa&&sa>=l.R.x?(Fa=l.R.x+l.R.width,b.ia(U-2,Fa,pb),b.ia(U-1,Fa+ib,pb)):90===this.fa&&pa<=l.R.bottom?(Fa=l.R.y,b.ia(U-2,Za,Fa),b.ia(U-1,Za,Fa-nb)):270===this.fa&&pa>=l.R.y?(Fa=l.R.y+l.R.height,b.ia(U-2,Za,Fa),b.ia(U-1,Za,Fa+ib)):0===this.fa&&sa<=l.R.right&&(Fa=l.R.x,b.ia(U-2,Fa,pb),b.ia(U-1,Fa-nb,pb));else{nb=Math.max(10,this.Fg[l.layer]);ib=Math.max(10,this.Tf[l.layer]);de=0;if(180===this.fa||0===
this.fa){if(180===this.fa?sa<=l.R.x:sa>=l.R.right)de=(0===this.fa?ib:-nb)/2;b.B(U++,sa+de,pb)}else{if(270===this.fa?pa<=l.R.y:pa>=l.R.bottom)de=(90===this.fa?ib:-nb)/2;b.B(U++,Za,pa+de)}b.B(U++,sa,pa)}}else{for(;null!==l&&l!==m;){Oa=ua=null;for(var Bg=l.pc.j;Bg.next();){var Ff=Bg.value;if(Ff.link===c.link&&(ua=Ff.toVertex,Oa=Ff.fromVertex,null!==Oa.Bd&&(Oa=null),null===ua.Bd))break}var Za=0,pb=0,sa=0,pa=0,mb=0,nb=0,ib=0;if(ua!==m)if(Za=b.n(U-1).x,pb=b.n(U-1).y,sa=ua.na,pa=ua.va,ba)if(180===this.fa||
0===this.fa){var ve=null!==Oa?Oa.va:pb;ve!==pa&&(mb=this.Ub[ua.layer],2===U&&(mb=0===this.fa?Math.max(mb,Za):Math.min(mb,Za)),b.B(U++,mb,pb),b.B(U++,mb,pa))}else{var Id=null!==Oa?Oa.na:Za;Id!==sa&&(mb=this.Ub[ua.layer],2===U&&(mb=90===this.fa?Math.max(mb,pb):Math.min(mb,pb)),b.B(U++,Za,mb),b.B(U++,sa,mb))}else nb=Math.max(10,this.Fg[ua.layer]),ib=Math.max(10,this.Tf[ua.layer]),180===this.fa?(b.B(U++,sa+ib,pa),S&&b.B(U++,sa,pa),b.B(U++,sa-nb,pa)):90===this.fa?(b.B(U++,sa,pa-nb),S&&b.B(U++,sa,pa),b.B(U++,
sa,pa+ib)):270===this.fa?(b.B(U++,sa,pa+ib),S&&b.B(U++,sa,pa),b.B(U++,sa,pa-nb)):(b.B(U++,sa-nb,pa),S&&b.B(U++,sa,pa),b.B(U++,sa+ib,pa));l=ua}ba&&(Za=b.n(U-1).x,pb=b.n(U-1).y,sa=b.n(U).x,pa=b.n(U).y,180===this.fa||0===this.fa?pb!==pa&&(mb=0===this.fa?Math.min(Math.max((sa+Za)/2,this.Ub[m.layer]),sa):Math.max(Math.min((sa+Za)/2,this.Ub[m.layer]),sa),b.B(U++,mb,pb),b.B(U++,mb,pa)):Za!==sa&&(mb=90===this.fa?Math.min(Math.max((pa+pb)/2,this.Ub[m.layer]),pa):Math.max(Math.min((pa+pb)/2,this.Ub[m.layer]),
pa),b.B(U++,Za,mb),b.B(U++,sa,mb)))}if(null!==d&&S){if(null!==h){if(b.computeSpot(!0)===bc){var zb=b.n(0),Oe=b.n(2);zb.O(Oe)||b.ia(1,(zb.x+Oe.x)/2,(zb.y+Oe.y)/2)}fa=b.getLinkPoint(e,h,bc,!0,!1,g,k);fa.F()||fa.set(e.$.bm);b.ia(0,fa.x,fa.y)}null!==k&&(b.computeSpot(!1)===bc&&(zb=b.n(b.ta-1),Oe=b.n(b.ta-3),zb.O(Oe)||b.ia(b.ta-2,(zb.x+Oe.x)/2,(zb.y+Oe.y)/2)),fa=b.getLinkPoint(g,k,bc,!1,!1,e,h),fa.F()||fa.set(g.$.bm),b.ia(b.ta-1,fa.x,fa.y))}b.Aj();c.commit()}}}for(var jd=new K(J),eg=this.network.edges.j;eg.next();){var Gf=
eg.value.link;null!==Gf&&Gf.qc&&!jd.contains(Gf)&&jd.add(Gf)}if(0<jd.count)if(90===this.fa||270===this.fa){for(var Cg=0,ob=new K(lv),hc,Zc,fg=jd.j;fg.next();){var Cb=fg.value;if(null!==Cb&&Cb.qc)for(var Sb=2;Sb<Cb.ta-3;Sb++)if(hc=Cb.n(Sb),Zc=Cb.n(Sb+1),mv(hc.y,Zc.y)&&!mv(hc.x,Zc.x)){var we=new lv;we.layer=Math.floor(hc.y/2);var Dg=Cb.n(0),Jd=Cb.n(Cb.ta-1);we.first=Dg.x*Dg.x+Dg.y;we.pe=Jd.x*Jd.x+Jd.y;we.ef=Math.min(hc.x,Zc.x);we.Ce=Math.max(hc.x,Zc.x);we.index=Sb;we.link=Cb;if(Sb+2<Cb.ta){var qb=Cb.n(Sb-
1),Nc=Cb.n(Sb+2),Hf=0;qb.y<hc.y?Hf=Nc.y<hc.y?3:hc.x<Zc.x?2:1:qb.y>hc.y&&(Hf=Nc.y>hc.y?0:Zc.x<hc.x?2:1);we.Ji=Hf}ob.add(we)}}if(1<ob.count){ob.sort(this.KG);for(var Pe=0;Pe<ob.count;){for(var Zh=ob.o[Pe].layer,Va=Pe+1;Va<ob.count&&ob.o[Va].layer===Zh;)Va++;if(1<Va-Pe)for(var eb=Pe;eb<Va;){for(var Ac=ob.o[eb].Ce,wc=Pe+1;wc<Va&&ob.o[wc].ef<Ac;)Ac=Math.max(Ac,ob.o[wc].Ce),wc++;var $c=wc-eb;if(1<$c){ob.Uq(this.By,eb,eb+$c);for(var oh=1,ab=ob.o[eb].pe,Sb=eb;Sb<wc;Sb++){var Db=ob.o[Sb];Db.pe!==ab&&(oh++,
ab=Db.pe)}ob.Uq(this.JG,eb,eb+$c);for(var Ab=1,ab=ob.o[eb].first,Sb=eb;Sb<wc;Sb++)Db=ob.o[Sb],Db.first!==ab&&(Ab++,ab=Db.first);var Bc=!0,Eb=Ab;oh<Ab?(Bc=!1,Eb=oh,ab=ob.o[eb].pe,ob.Uq(this.By,eb,eb+$c)):ab=ob.o[eb].first;for(var tb=0,Sb=eb;Sb<wc;Sb++){Db=ob.o[Sb];(Bc?Db.first:Db.pe)!==ab&&(tb++,ab=Bc?Db.first:Db.pe);Cb=Db.link;hc=Cb.n(Db.index);Zc=Cb.n(Db.index+1);var Fb=this.aG*(tb-(Eb-1)/2);if(!Cb.Di||nv(hc.x,hc.y+Fb,Zc.x,Zc.y+Fb))Cg++,Cb.zm(),Cb.ia(Db.index,hc.x,hc.y+Fb),Cb.ia(Db.index+1,Zc.x,
Zc.y+Fb),Cb.Aj()}}eb=wc}Pe=Va}}}else{for(var ee=0,Ib=new K(lv),Mb,Oc,$h=jd.j;$h.next();){var Nb=$h.value;if(null!==Nb&&Nb.qc)for(var Tb=2;Tb<Nb.ta-3;Tb++)if(Mb=Nb.n(Tb),Oc=Nb.n(Tb+1),mv(Mb.x,Oc.x)&&!mv(Mb.y,Oc.y)){var Cc=new lv;Cc.layer=Math.floor(Mb.x/2);var ad=Nb.n(0),td=Nb.n(Nb.ta-1);Cc.first=ad.x+ad.y*ad.y;Cc.pe=td.x+td.y*td.y;Cc.ef=Math.min(Mb.y,Oc.y);Cc.Ce=Math.max(Mb.y,Oc.y);Cc.index=Tb;Cc.link=Nb;if(Tb+2<Nb.ta){var Eg=Nb.n(Tb-1),ai=Nb.n(Tb+2),ub=0;Eg.x<Mb.x?ub=ai.x<Mb.x?3:Mb.y<Oc.y?2:1:Eg.x>
Mb.x&&(ub=ai.x>Mb.x?0:Oc.y<Mb.y?2:1);Cc.Ji=ub}Ib.add(Cc)}}if(1<Ib.count){Ib.sort(this.KG);for(var bd=0;bd<Ib.count;){for(var bi=Ib.o[bd].layer,Qe=bd+1;Qe<Ib.count&&Ib.o[Qe].layer===bi;)Qe++;if(1<Qe-bd)for(var ic=bd;ic<Qe;){for(var xe=Ib.o[ic].Ce,Zb=bd+1;Zb<Qe&&Ib.o[Zb].ef<xe;)xe=Math.max(xe,Ib.o[Zb].Ce),Zb++;var Dc=Zb-ic;if(1<Dc){Ib.Uq(this.By,ic,ic+Dc);for(var ud=1,jc=Ib.o[ic].pe,Tb=ic;Tb<Zb;Tb++){var Wa=Ib.o[Tb];Wa.pe!==jc&&(ud++,jc=Wa.pe)}Ib.Uq(this.JG,ic,ic+Dc);for(var kc=1,jc=Ib.o[ic].first,
Tb=ic;Tb<Zb;Tb++)Wa=Ib.o[Tb],Wa.first!==jc&&(kc++,jc=Wa.first);var ci=!0,ef=kc;ud<kc?(ci=!1,ef=ud,jc=Ib.o[ic].pe,Ib.Uq(this.By,ic,ic+Dc)):jc=Ib.o[ic].first;for(var Kd=0,Tb=ic;Tb<Zb;Tb++){Wa=Ib.o[Tb];(ci?Wa.first:Wa.pe)!==jc&&(Kd++,jc=ci?Wa.first:Wa.pe);Nb=Wa.link;Mb=Nb.n(Wa.index);Oc=Nb.n(Wa.index+1);var fe=this.aG*(Kd-(ef-1)/2);if(!Nb.Di||nv(Mb.x+fe,Mb.y,Oc.x+fe,Oc.y))ee++,Nb.zm(),Nb.ia(Wa.index,Mb.x+fe,Mb.y),Nb.ia(Wa.index+1,Oc.x+fe,Oc.y),Nb.Aj()}}ic=Zb}bd=Qe}}}};
pu.prototype.KG=function(a,b){return a instanceof lv&&b instanceof lv&&a!==b?a.layer<b.layer?-1:a.layer>b.layer?1:a.ef<b.ef?-1:a.ef>b.ef?1:a.Ce<b.Ce?-1:a.Ce>b.Ce?1:0:0};pu.prototype.JG=function(a,b){return a instanceof lv&&b instanceof lv&&a!==b?a.first<b.first?-1:a.first>b.first||a.Ji<b.Ji?1:a.Ji>b.Ji||a.ef<b.ef?-1:a.ef>b.ef?1:a.Ce<b.Ce?-1:a.Ce>b.Ce?1:0:0};
pu.prototype.By=function(a,b){return a instanceof lv&&b instanceof lv&&a!==b?a.pe<b.pe?-1:a.pe>b.pe||a.Ji<b.Ji?1:a.Ji>b.Ji||a.ef<b.ef?-1:a.ef>b.ef?1:a.Ce<b.Ce?-1:a.Ce>b.Ce?1:0:0};function mv(a,b){v&&(D.p(a,pu,"isApprox:a"),D.p(b,pu,"isApprox:b"));var c=a-b;return-1<c&&1>c}function nv(a,b,c,d){v&&(D.p(a,pu,"isUnoccupied2:px"),D.p(b,pu,"isUnoccupied2:py"),D.p(c,pu,"isUnoccupied2:qx"),D.p(d,pu,"isUnoccupied2:qy"));return!0}
function Du(a,b){var c,d=a.se[b];if(d>=a.xh.length){c=[];for(var e=0;e<a.xh.length;e++)c[e]=a.xh[e];a.xh=c}void 0===a.xh[d]||null===a.xh[d]?c=[]:(c=a.xh[d],a.xh[d]=null);d=a.Ls[b];for(e=0;e<d.length;e++){var g=d[e];c[g.index]=g}return c}function Eu(a,b,c){a.xh[a.se[b]]=c}D.defineProperty(pu,{layerSpacing:"layerSpacing"},function(){return this.Zm},function(a){this.Zm!==a&&(D.h(a,"number",pu,"layerSpacing"),0<=a&&(this.Zm=a,this.N()))});
D.defineProperty(pu,{dL:"columnSpacing"},function(){return this.ee},function(a){this.ee!==a&&(D.h(a,"number",pu,"columnSpacing"),0<a&&(this.ee=a,this.N()))});D.defineProperty(pu,{direction:"direction"},function(){return this.fa},function(a){this.fa!==a&&(D.h(a,"number",pu,"direction"),0===a||90===a||180===a||270===a?(this.fa=a,this.N()):D.k("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))});
D.defineProperty(pu,{angle:"angle"},function(){return this.direction},function(a){this.direction=a});D.defineProperty(pu,{lI:"cycleRemoveOption"},function(){return this.Ro},function(a){this.Ro!==a&&(D.Ca(a,pu,pu,"cycleRemoveOption"),a===wu||a===qu)&&(this.Ro=a,this.N())});D.defineProperty(pu,{pJ:"layeringOption"},function(){return this.vp},function(a){this.vp!==a&&(D.Ca(a,pu,pu,"layeringOption"),a===ru||a===Ou||a===Qu)&&(this.vp=a,this.N())});
D.defineProperty(pu,{cJ:"initializeOption"},function(){return this.jp},function(a){this.jp!==a&&(D.Ca(a,pu,pu,"initializeOption"),a===su||a===Wu||a===Uu)&&(this.jp=a,this.N())});D.defineProperty(pu,{ML:"iterations"},function(){return this.Xm},function(a){this.Xm!==a&&(D.p(a,vu,"iterations"),0<=a&&(this.Xm=a,this.N()))});D.defineProperty(pu,{PH:"aggressiveOption"},function(){return this.Eo},function(a){this.Eo!==a&&(D.Ca(a,pu,pu,"aggressiveOption"),a===$u||a===tu||a===av)&&(this.Eo=a,this.N())});
D.defineProperty(pu,{gM:"packOption"},function(){return this.oj},function(a){this.oj!==a&&(D.h(a,"number",pu,"packOption"),0<=a&&8>a&&(this.oj=a,this.N()))});D.defineProperty(pu,{Rq:"setsPortSpots"},function(){return this.pi},function(a){this.pi!==a&&(D.h(a,"boolean",pu,"setsPortSpots"),this.pi=a,this.N())});D.defineProperty(pu,{aG:"linkSpacing"},function(){return this.ts},function(a){this.ts!==a&&(D.h(a,"number",pu,"linkSpacing"),0<=a&&(this.ts=a,this.N()))});D.w(pu,{yJ:"maxLayer"},function(){return this.yb});
D.w(pu,{RL:"maxIndex"},function(){return this.ow});D.w(pu,{QL:"maxColumn"},function(){return this.Pb});D.w(pu,{WL:"minIndexLayer"},function(){return this.Cs});D.w(pu,{SL:"maxIndexLayer"},function(){return this.Uf});var qu;pu.CycleDepthFirst=qu=D.s(pu,"CycleDepthFirst",0);var wu;pu.CycleGreedy=wu=D.s(pu,"CycleGreedy",1);var ru;pu.LayerOptimalLinkLength=ru=D.s(pu,"LayerOptimalLinkLength",0);var Ou;pu.LayerLongestPathSink=Ou=D.s(pu,"LayerLongestPathSink",1);var Qu;
pu.LayerLongestPathSource=Qu=D.s(pu,"LayerLongestPathSource",2);var su;pu.InitDepthFirstOut=su=D.s(pu,"InitDepthFirstOut",0);var Wu;pu.InitDepthFirstIn=Wu=D.s(pu,"InitDepthFirstIn",1);var Uu;pu.InitNaive=Uu=D.s(pu,"InitNaive",2);var $u;pu.AggressiveNone=$u=D.s(pu,"AggressiveNone",0);var tu;pu.AggressiveLess=tu=D.s(pu,"AggressiveLess",1);var av;pu.AggressiveMore=av=D.s(pu,"AggressiveMore",2);pu.PackNone=0;var bv;pu.PackExpand=bv=1;var cv;pu.PackStraighten=cv=2;var ev;pu.PackMedian=ev=4;var uu;
pu.PackAll=uu=7;function lv(){this.index=this.Ce=this.ef=this.pe=this.first=this.layer=0;this.link=null;this.Ji=0}D.ke(lv,{layer:!0,first:!0,pe:!0,ef:!0,Ce:!0,index:!0,link:!0,Ji:!0});function vu(){va.call(this)}D.Sa(vu,va);D.ja("LayeredDigraphNetwork",vu);vu.prototype.createVertex=function(){return new ov};vu.prototype.createEdge=function(){return new pv};
function ov(){wa.call(this);this.index=this.column=this.layer=-1;this.component=NaN;this.near=null;this.valid=!1;this.finish=this.lq=NaN;this.Dn=0;this.mB=this.nB=null}D.Sa(ov,wa);D.ja("LayeredDigraphVertex",ov);function pv(){xa.call(this);this.forest=this.rev=this.valid=!1;this.portToPos=this.portFromPos=NaN;this.portToColOffset=this.portFromColOffset=0}D.Sa(pv,xa);D.ja("LayeredDigraphEdge",pv);
function Z(){0<arguments.length&&D.td(Z);Tg.call(this);this.Cd=new L(Object);this.Us=qv;this.Rf=rv;this.Lt=sv;this.lw=tv;this.lC=null;this.Yh=!0;this.vd=uv;this.sg=(new Ca(10,10)).freeze();this.ya=new vv;this.za=new vv;this.bA=[]}D.Sa(Z,Tg);D.ja("TreeLayout",Z);Z.prototype.cloneProtected=function(a){Tg.prototype.cloneProtected.call(this,a);a.Us=this.Us;a.Lt=this.Lt;a.lw=this.lw;a.Yh=this.Yh;a.vd=this.vd;a.sg.assign(this.sg);a.ya.copyInheritedPropertiesFrom(this.ya);a.za.copyInheritedPropertiesFrom(this.za)};
Z.prototype.nc=function(a){a.Ne===Z?0===a.name.indexOf("Alignment")?this.alignment=a:0===a.name.indexOf("Arrangement")?this.$f=a:0===a.name.indexOf("Compaction")?this.compaction=a:0===a.name.indexOf("Path")?this.path=a:0===a.name.indexOf("Sorting")?this.sorting=a:0===a.name.indexOf("Style")?this.wK=a:D.k("Unknown enum value: "+a):Tg.prototype.nc.call(this,a)};Z.prototype.createNetwork=function(){return new wv};
Z.prototype.makeNetwork=function(a){function b(a){if(a instanceof G)return!a.tf&&"Comment"!==a.Dd;if(a instanceof J){var b=a.aa;if(null===b||b.tf||"Comment"===b.Dd)return!1;a=a.da;return null===a||a.tf||"Comment"===a.Dd?!1:!0}return!1}var c=this.createNetwork();c.Vb=this;a instanceof E?(c.Jk(a.ng,!0,b),c.Jk(a.links,!0,b)):a instanceof I?c.Jk(a.Mc,!1,b):c.Jk(a.j,!1,b);return c};
Z.prototype.doLayout=function(a){null===a&&D.k("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));this.$f!==xv&&(this.Ae=this.initialOrigin(this.Ae));var b=this.g;null===b&&a instanceof E&&(b=a);this.Rf=this.path===qv&&null!==b?b.$d?rv:yv:this.path===qv?rv:this.path;if(0<this.network.vertexes.count){this.network.Ax();for(a=this.network.vertexes.j;a.next();)b=a.value,b.initialized=!1,b.level=
0,b.parent=null,b.children=[];if(0<this.Cd.count){a=new L(vv);for(b=this.Cd.j;b.next();){var c=b.value;c instanceof G?(c=this.network.Qn(c),null!==c&&a.add(c)):c instanceof vv&&a.add(c)}this.Cd=a}0===this.Cd.count&&this.findRoots();for(a=this.Cd.copy().j;a.next();)b=a.value,b.initialized||(b.initialized=!0,zv(this,b));b=this.network.vertexes;for(a=null;a=Av(b),0<a.count;)b=Bv(this,a),null!==b&&this.Cd.add(b),b.initialized=!0,zv(this,b),b=a;for(a=this.Cd.j;a.next();)b=a.value,b instanceof vv&&Cv(this,
b);for(a=this.Cd.j;a.next();)b=a.value,b instanceof vv&&Dv(this,b);for(a=this.Cd.j;a.next();)b=a.value,b instanceof vv&&Ev(this,b);this.oA();if(this.aB===Fv){c=[];for(a=this.network.vertexes.j;a.next();){var d=a.value,b=d.parent;null===b&&(b=d);var b=0===b.angle||180===b.angle,e=c[d.level];void 0===e&&(e=0);c[d.level]=Math.max(e,b?d.width:d.height)}for(d=0;d<c.length;d++)void 0===c[d]&&(c[d]=0);this.lC=c;for(a=this.network.vertexes.j;a.next();)d=a.value,b=d.parent,null===b&&(b=d),0===b.angle||180===
b.angle?(180===b.angle&&(d.lu+=c[d.level]-d.width),d.width=c[d.level]):(270===b.angle&&(d.mu+=c[d.level]-d.height),d.height=c[d.level])}else if(this.aB===Gv)for(a=this.network.vertexes.j;a.next();){c=a.value;b=0===c.angle||180===c.angle;e=-1;for(d=0;d<c.children.length;d++)var g=c.children[d],e=Math.max(e,b?g.width:g.height);if(0<=e)for(d=0;d<c.children.length;d++)g=c.children[d],b?(180===c.angle&&(g.lu+=e-g.width),g.width=e):(270===c.angle&&(g.mu+=e-g.height),g.height=e)}for(a=this.Cd.j;a.next();)b=
a.value,b instanceof vv&&this.layoutTree(b);this.arrangeTrees();this.updateParts()}this.network=null;this.Cd=new L(Object);this.Hf=!0};function Av(a){var b=new L(vv);for(a=a.j;a.next();){var c=a.value;c.initialized||b.add(c)}return b}
Z.prototype.findRoots=function(){for(var a=this.network.vertexes,b=a.j;b.next();){var c=b.value;switch(this.Rf){case rv:0===c.sc.count&&this.Cd.add(c);break;case yv:0===c.pc.count&&this.Cd.add(c);break;default:D.k("Unhandled path value "+this.Rf.toString())}}0===this.Cd.count&&(a=Bv(this,a),null!==a&&this.Cd.add(a))};
function Bv(a,b){for(var c=999999,d=null,e=b.j;e.next();){var g=e.value;switch(a.Rf){case rv:g.sc.count<c&&(c=g.sc.count,d=g);break;case yv:g.pc.count<c&&(c=g.pc.count,d=g);break;default:D.k("Unhandled path value "+a.Rf.toString())}}return d}
function zv(a,b){if(null!==b){v&&D.l(b,vv,Z,"walkTree:v");switch(a.Rf){case rv:if(0<b.pc.count){for(var c=new K(vv),d=b.qI;d.next();){var e=d.value;Hv(a,b,e)&&c.add(e)}0<c.count&&(b.children=c.lc())}break;case yv:if(0<b.sc.count){c=new K(vv);for(d=b.lK;d.next();)e=d.value,Hv(a,b,e)&&c.add(e);0<c.count&&(b.children=c.lc())}break;default:D.k("Unhandled path value"+a.Rf.toString())}c=b.children;d=c.length;for(e=0;e<d;e++){var g=c[e];g.initialized=!0;g.level=b.level+1;g.parent=b;a.Cd.remove(g)}for(e=
0;e<d;e++)g=c[e],zv(a,g)}}function Hv(a,b,c){v&&D.l(b,vv,Z,"walkOK:v");v&&D.l(c,vv,Z,"walkOK:c");if(c.initialized){var d;if(null===b)d=!1;else{v&&D.l(c,vv,Z,"isAncestor:a");v&&D.l(b,vv,Z,"isAncestor:b");for(d=b.parent;null!==d&&d!==c;)d=d.parent;d=d===c}if(d||c.level>b.level)return!1;a.removeChild(c.parent,c)}return!0}
Z.prototype.removeChild=function(a,b){if(null!==a&&null!==b){v&&D.l(a,vv,Z,"removeChild:p");v&&D.l(b,vv,Z,"removeChild:c");for(var c=a.children,d=0,e=0;e<c.length;e++)c[e]===b&&d++;if(0<d){for(var d=Array(c.length-d),g=0,e=0;e<c.length;e++)c[e]!==b&&(d[g++]=c[e]);a.children=d}}};
function Cv(a,b){if(null!==b){v&&D.l(b,vv,Z,"initializeTree:v");a.initializeTreeVertexValues(b);b.alignment===Iv&&a.sortTreeVertexChildren(b);for(var c=0,d=b.Fn,e=0,g=b.children,h=g.length,k=0;k<h;k++){var l=g[k];Cv(a,l);c+=l.descendantCount+1;d=Math.max(d,l.maxChildrenCount);e=Math.max(e,l.maxGenerationCount)}b.descendantCount=c;b.maxChildrenCount=d;b.maxGenerationCount=0<d?e+1:0}}
function Jv(a,b){v&&D.l(b,vv,Z,"mom:v");switch(a.Lt){default:case sv:return null!==b.parent?b.parent:a.ya;case Kv:return null===b.parent?a.ya:null===b.parent.parent?a.za:b.parent;case Lv:return null!==b.parent?null!==b.parent.parent?b.parent.parent:a.za:a.ya;case Mv:var c=!0;if(0===b.Fn)c=!1;else for(var d=b.children,e=d.length,g=0;g<e;g++)if(0<d[g].Fn){c=!1;break}return c&&null!==b.parent?a.za:null!==b.parent?b.parent:a.ya}}
Z.prototype.initializeTreeVertexValues=function(a){v&&D.l(a,vv,Z,"initializeTreeVertexValues:v");var b=Jv(this,a);a.copyInheritedPropertiesFrom(b);if(null!==a.parent&&a.parent.alignment===Iv){for(var b=a.angle,c=a.parent.children,d=0;d<c.length&&a!==c[d];)d++;0===d%2?d!==c.length-1&&(b=90===b?180:180===b?270:270===b?180:270):b=90===b?0:180===b?90:270===b?0:90;a.angle=b}a.initialized=!0};
function Dv(a,b){if(null!==b){v&&D.l(b,vv,Z,"assignTree:v");a.assignTreeVertexValues(b);for(var c=b.children,d=c.length,e=0;e<d;e++)Dv(a,c[e])}}Z.prototype.assignTreeVertexValues=function(){};function Ev(a,b){if(null!==b){v&&D.l(b,vv,Z,"sortTree:v");b.alignment!==Iv&&a.sortTreeVertexChildren(b);for(var c=b.children,d=c.length,e=0;e<d;e++)Ev(a,c[e])}}
Z.prototype.sortTreeVertexChildren=function(a){v&&D.l(a,vv,Z,"sortTreeVertexChildren:v");switch(a.sorting){case Nv:break;case Ov:a.children.reverse();break;case Pv:a.children.sort(a.comparer);break;case Qv:a.children.sort(a.comparer);a.children.reverse();break;default:D.k("Unhandled sorting value "+a.sorting.toString())}};Z.prototype.oA=function(){if(this.comments)for(var a=this.network.vertexes.j;a.next();)this.addComments(a.value)};
Z.prototype.addComments=function(a){v&&D.l(a,vv,Z,"addComments:v");var b=a.angle,c=a.parent,d=0,e=Rv,e=!1;null!==c&&(d=c.angle,e=c.alignment,e=Sv(e));var b=90===b||270===b,d=90===d||270===d,c=0===a.Fn,g=0,h=0,k=0,l=a.commentSpacing;if(null!==a.Vc)for(var m=a.Vc.mF();m.next();){var n=m.value;"Comment"===n.Dd&&n.canLayout()&&(null===a.comments&&(a.comments=[]),a.comments.push(n),n.hf(),n=n.Fa,b&&!c||!e&&!d&&c||e&&d&&c?(g=Math.max(g,n.width),h+=n.height+Math.abs(k)):(g+=n.width+Math.abs(k),h=Math.max(h,
n.height)),k=l)}null!==a.comments&&(b&&!c||!e&&!d&&c||e&&d&&c?(g+=Math.abs(a.commentMargin),h=Math.max(0,h-a.height)):(h+=Math.abs(a.commentMargin),g=Math.max(0,g-a.width)),e=D.gh(0,0,a.R.width+g,a.R.height+h),a.sb=e,D.Mb(e))};function Sv(a){return a===Tv||a===Iv||a===Uv||a===Vv}function Wv(a){return a===Tv||a===Iv}
function Xv(a){v&&D.l(a,vv,Z,"isLeftSideBus:v");var b=a.parent;if(null!==b){var c=b.alignment;if(Sv(c)){if(Wv(c)){b=b.children;for(c=0;c<b.length&&a!==b[c];)c++;return 0===c%2}if(c===Uv)return!0}}return!1}
Z.prototype.layoutComments=function(a){v&&D.l(a,vv,Z,"layoutComments:v");if(null!==a.comments){var b=a.Vc.Fa,c=a.parent,d=a.angle,e=0,g=Rv,g=!1;null!==c&&(e=c.angle,g=c.alignment,g=Sv(g));for(var c=90===d||270===d,d=90===e||270===e,h=0===a.Fn,k=Xv(a),l=0,m=a.comments,n=m.length,p=D.P(),q=0;q<n;q++){var r=m[q],s=r.Fa;if(c&&!h||!g&&!d&&h||g&&d&&h){if(135<e&&!g||d&&k)if(0<=a.commentMargin)for(p.m(a.R.x-a.commentMargin-s.width,a.R.y+l),r.move(p),r=r.Vg();r.next();){var u=r.value;u.Gb=ed;u.Hb=fd}else for(p.m(a.R.x+
2*a.W.x-a.commentMargin,a.R.y+l),r.move(p),r=r.Vg();r.next();)u=r.value,u.Gb=fd,u.Hb=ed;else if(0<=a.commentMargin)for(p.m(a.R.x+2*a.W.x+a.commentMargin,a.R.y+l),r.move(p),r=r.Vg();r.next();)u=r.value,u.Gb=fd,u.Hb=ed;else for(p.m(a.R.x+a.commentMargin-s.width,a.R.y+l),r.move(p),r=r.Vg();r.next();)u=r.value,u.Gb=ed,u.Hb=fd;l=0<=a.commentSpacing?l+(s.height+a.commentSpacing):l+(a.commentSpacing-s.height)}else{if(135<e&&!g||!d&&k)if(0<=a.commentMargin)for(p.m(a.R.x+l,a.R.y-a.commentMargin-s.height),
r.move(p),r=r.Vg();r.next();)u=r.value,u.Gb=Yc,u.Hb=gd;else for(p.m(a.R.x+l,a.R.y+2*a.W.y-a.commentMargin),r.move(p),r=r.Vg();r.next();)u=r.value,u.Gb=gd,u.Hb=Yc;else if(0<=a.commentMargin)for(p.m(a.R.x+l,a.R.y+2*a.W.y+a.commentMargin),r.move(p),r=r.Vg();r.next();)u=r.value,u.Gb=gd,u.Hb=Yc;else for(p.m(a.R.x+l,a.R.y+a.commentMargin-s.height),r.move(p),r=r.Vg();r.next();)u=r.value,u.Gb=Yc,u.Hb=gd;l=0<=a.commentSpacing?l+(s.width+a.commentSpacing):l+(a.commentSpacing-s.width)}}D.A(p);b=l-a.commentSpacing-
(c?b.height:b.width);if(this.Rf===rv)for(e=a.pc;e.next();)a=e.value.link,null===a||a.Di||(a.nm=0<b?b:NaN);else for(e=a.sc;e.next();)a=e.value.link,null===a||a.Di||(a.Dm=0<b?b:NaN)}};
Z.prototype.layoutTree=function(a){if(null!==a){v&&D.l(a,vv,Z,"layoutTree:v");for(var b=a.children,c=b.length,d=0;d<c;d++)this.layoutTree(b[d]);switch(a.compaction){case Yv:Zv(this,a);break;case $v:if(a.alignment===Iv)Zv(this,a);else if(v&&D.l(a,vv,Z,"layoutTreeBlock:v"),0===a.Fn){var d=a.parent,b=!1,c=0,e=Rv;null!==d&&(c=d.angle,e=d.alignment,b=Sv(e));d=Xv(a);a.sa.m(0,0);a.rb.m(a.width,a.height);null===a.parent||null===a.comments||(180!==c&&270!==c||b)&&!d?a.Wa.m(0,0):180===c&&!b||(90===c||270===
c)&&d?a.Wa.m(a.width-2*a.W.x,0):a.Wa.m(0,a.height-2*a.W.y);a.Bu=null;a.Wu=null}else{for(var g=aw(a),b=90===g||270===g,h=0,k=a.children,l=k.length,m=0;m<l;m++)var n=k[m],h=Math.max(h,b?n.rb.width:n.rb.height);var p=a.alignment,d=p===bw,q=p===cw,r=Sv(p),s=Math.max(0,a.breadthLimit),c=dw(a),u=a.nodeSpacing,t=ew(a),y=a.rowSpacing,w=0;if(d||q||a.Lq||a.Mq&&1===a.maxGenerationCount)w=Math.max(0,a.rowIndent);var d=a.width,e=a.height,C=0,A=0,N=0,H=null,W=null,fa=0,S=0,ba=0,ia=0,U=0,Ua=0,lb=0,ua=0,n=0;r&&!Wv(p)&&
135<g&&k.reverse();if(Wv(p))if(1<l)for(m=0;m<l;m++)0===m%2&&m!==l-1?ua=Math.max(ua,b?k[m].rb.width:k[m].rb.height):0!==m%2&&(n=Math.max(n,b?k[m].rb.width:k[m].rb.height));else 1===l&&(ua=b?k[0].rb.width:k[0].rb.height);if(r){switch(p){case Tv:A=135>g?fw(a,k,ua,C,A):gw(a,k,ua,C,A);ua=A.x;C=A.width;A=A.height;break;case Uv:for(m=0;m<l;m++){var n=k[m],Oa=n.rb,H=0===Ua?0:y;b?(n.sa.m(h-Oa.width,ia+H),C=Math.max(C,Oa.width),A=Math.max(A,ia+H+Oa.height),ia+=H+Oa.height):(n.sa.m(ba+H,h-Oa.height),C=Math.max(C,
ba+H+Oa.width),A=Math.max(A,Oa.height),ba+=H+Oa.width);Ua++}break;case Vv:for(m=0;m<l;m++)n=k[m],Oa=n.rb,H=0===Ua?0:y,b?(n.sa.m(u/2+a.W.x,ia+H),C=Math.max(C,Oa.width),A=Math.max(A,ia+H+Oa.height),ia+=H+Oa.height):(n.sa.m(ba+H,u/2+a.W.y),C=Math.max(C,ba+H+Oa.width),A=Math.max(A,Oa.height),ba+=H+Oa.width),Ua++}H=Mw(this,2);W=Mw(this,2);b?(H[0].m(0,0),H[1].m(0,A),W[0].m(C,0)):(H[0].m(0,0),H[1].m(C,0),W[0].m(0,A));W[1].m(C,A)}else for(m=0;m<l;m++){n=k[m];Oa=n.rb;if(b){0<s&&0<Ua&&ba+u+Oa.width>s&&(ba<
h&&Nw(a,p,h-ba,0,lb,m-1),U++,Ua=0,lb=m,N=A,ba=0,ia=135<g?-A-y:A+y);Ow(this,n,0,ia);var Fa=0;if(0===Ua){if(H=n.Bu,W=n.Wu,fa=Oa.width,S=Oa.height,null===H||null===W||g!==aw(n))H=Mw(this,2),W=Mw(this,2),H[0].m(0,0),H[1].m(0,S),W[0].m(fa,0),W[1].m(fa,S)}else{var Vb=D.tb(),S=Pw(this,a,n,H,W,fa,S,Vb),Fa=S.x,H=Vb[0],W=Vb[1],fa=S.width,S=S.height;D.Aa(Vb);ba<Oa.width&&0>Fa&&(Qw(a,-Fa,0,lb,m-1),Rw(H,-Fa,0),Rw(W,-Fa,0),Fa=0)}n.sa.m(Fa,ia);C=Math.max(C,fa);A=Math.max(A,N+(0===U?0:y)+Oa.height);ba=fa}else{0<
s&&0<Ua&&ia+u+Oa.height>s&&(ia<h&&Nw(a,p,0,h-ia,lb,m-1),U++,Ua=0,lb=m,N=C,ia=0,ba=135<g?-C-y:C+y);Ow(this,n,ba,0);Fa=0;if(0===Ua){if(H=n.Bu,W=n.Wu,fa=Oa.width,S=Oa.height,null===H||null===W||g!==aw(n))H=Mw(this,2),W=Mw(this,2),H[0].m(0,0),H[1].m(fa,0),W[0].m(0,S),W[1].m(fa,S)}else Vb=D.tb(),S=Pw(this,a,n,H,W,fa,S,Vb),Fa=S.x,H=Vb[0],W=Vb[1],fa=S.width,S=S.height,D.Aa(Vb),ia<Oa.height&&0>Fa&&(Qw(a,0,-Fa,lb,m-1),Rw(H,0,-Fa),Rw(W,0,-Fa),Fa=0);n.sa.m(ba,Fa);A=Math.max(A,S);C=Math.max(C,N+(0===U?0:y)+Oa.width);
ia=S}Ua++}0<U&&(b?(A+=Math.max(0,c),ba<C&&Nw(a,p,C-ba,0,lb,l-1),0<w&&(q||Qw(a,w,0,0,l-1),C+=w)):(C+=Math.max(0,c),ia<A&&Nw(a,p,0,A-ia,lb,l-1),0<w&&(q||Qw(a,0,w,0,l-1),A+=w)));w=q=0;switch(p){case Sw:b?q+=C/2-a.W.x-t/2:w+=A/2-a.W.y-t/2;break;case Rv:0<U?b?q+=C/2-a.W.x-t/2:w+=A/2-a.W.y-t/2:b?(ua=k[0].sa.x+k[0].Wa.x,m=k[l-1].sa.x+k[l-1].Wa.x+2*k[l-1].W.x,q+=ua+(m-ua)/2-a.W.x-t/2):(ua=k[0].sa.y+k[0].Wa.y,m=k[l-1].sa.y+k[l-1].Wa.y+2*k[l-1].W.y,w+=ua+(m-ua)/2-a.W.y-t/2);break;case bw:b?(q-=t,C+=t):(w-=
t,A+=t);break;case cw:b?(q+=C-a.width+t,C+=t):(w+=A-a.height+t,A+=t);break;case Tv:b?q=1<l?q+(ua+u/2-a.W.x):q+(k[0].W.x-a.W.x+k[0].Wa.x):w=1<l?w+(ua+u/2-a.W.y):w+(k[0].W.y-a.W.y+k[0].Wa.y);break;case Uv:b?q+=C+u/2-a.W.x:w+=A+u/2-a.W.y;break;case Vv:break;default:D.k("Unhandled alignment value "+p.toString())}for(m=0;m<l;m++)n=k[m],b?n.sa.m(n.sa.x+n.Wa.x-q,n.sa.y+(135<g?(r?-A:-n.rb.height)+n.Wa.y-c:e+c+n.Wa.y)):n.sa.m(n.sa.x+(135<g?(r?-C:-n.rb.width)+n.Wa.x-c:d+c+n.Wa.x),n.sa.y+n.Wa.y-w);l=k=0;r?b?
(C=Tw(a,C,q),0>q&&(q=0),135<g&&(w+=A+c),A+=e+c,p===Vv&&(k+=u/2+a.W.x),l+=e+c):(135<g&&(q+=C+c),C+=d+c,A=Uw(a,A,w),0>w&&(w=0),p===Vv&&(l+=u/2+a.W.y),k+=d+c):b?(null===a.comments?d>C&&(p=Vw(p,d-C,0),k=p.x,l=p.y,C=d,q=0):C=Tw(a,C,q),0>q&&(k-=q,q=0),135<g&&(w+=A+c),A=Math.max(Math.max(A,e),A+e+c),l+=e+c):(135<g&&(q+=C+c),C=Math.max(Math.max(C,d),C+d+c),null===a.comments?e>A&&(p=Vw(p,0,e-A),k=p.x,l=p.y,A=e,w=0):A=Uw(a,A,w),0>w&&(l-=w,w=0),k+=d+c);if(0<U)g=Mw(this,4),p=Mw(this,4),b?(g[2].m(0,e+c),g[3].m(g[2].x,
A),p[2].m(C,g[2].y),p[3].m(p[2].x,g[3].y)):(g[2].m(d+c,0),g[3].m(C,g[2].y),p[2].m(g[2].x,A),p[3].m(g[3].x,p[2].y));else{g=Mw(this,H.length+2);p=Mw(this,W.length+2);for(m=0;m<H.length;m++)r=H[m],g[m+2].m(r.x+k,r.y+l);for(m=0;m<W.length;m++)r=W[m],p[m+2].m(r.x+k,r.y+l)}b?(g[0].m(q,0),g[1].m(g[0].x,e),g[2].y<g[1].y&&(g[2].x>g[0].x?g[2].assign(g[1]):g[1].assign(g[2])),g[3].y<g[2].y&&(g[3].x>g[0].x?g[3].assign(g[2]):g[2].assign(g[3])),p[0].m(q+d,0),p[1].m(p[0].x,e),p[2].y<p[1].y&&(p[2].x<p[0].x?p[2].assign(p[1]):
p[1].assign(p[2])),p[3].y<p[2].y&&(p[3].x<p[0].x?p[3].assign(p[2]):p[2].assign(p[3])),g[2].y-=c/2,p[2].y-=c/2):(g[0].m(0,w),g[1].m(d,g[0].y),g[2].x<g[1].x&&(g[2].y>g[0].y?g[2].assign(g[1]):g[1].assign(g[2])),g[3].x<g[2].x&&(g[3].y>g[0].y?g[3].assign(g[2]):g[2].assign(g[3])),p[0].m(0,w+e),p[1].m(d,p[0].y),p[2].x<p[1].x&&(p[2].y<p[0].y?p[2].assign(p[1]):p[1].assign(p[2])),p[3].x<p[2].x&&(p[3].y<p[0].y?p[3].assign(p[2]):p[2].assign(p[3])),g[2].x-=c/2,p[2].x-=c/2);Ww(this,H);Ww(this,W);a.Bu=g;a.Wu=p;
a.Wa.m(q,w);a.rb.m(C,A)}break;default:D.k("Unhandled compaction value "+a.compaction.toString())}}};
function Zv(a,b){v&&D.l(b,vv,Z,"layoutTreeNone:v");if(0===b.Fn){var c=!1,d=0,e=Rv;null!==b.parent&&(d=b.parent.angle,e=b.parent.alignment,c=Sv(e));e=Xv(b);b.sa.m(0,0);b.rb.m(b.width,b.height);null===b.parent||null===b.comments||(180!==d&&270!==d||c)&&!e?b.Wa.m(0,0):180===d&&!c||(90===d||270===d)&&e?b.Wa.m(b.width-2*b.W.x,0):b.Wa.m(0,b.height-2*b.W.y)}else{for(var c=aw(b),d=90===c||270===c,g=0,e=b.children,h=e.length,k=0;k<h;k++)var l=e[k],g=Math.max(g,d?l.rb.width:l.rb.height);var m=b.alignment,n=
m===bw,p=m===cw,q=Sv(m),r=Math.max(0,b.breadthLimit),s=dw(b),u=b.nodeSpacing,t=ew(b),y=n||p?0:t/2,w=b.rowSpacing,C=0;if(n||p||b.Lq||b.Mq&&1===b.maxGenerationCount)C=Math.max(0,b.rowIndent);var n=b.width,A=b.height,N=0,H=0,W=0,fa=0,S=0,ba=0,ia=0,U=0,Ua=0,lb=0;q&&!Wv(m)&&135<c&&e.reverse();if(Wv(m))if(1<h)for(k=0;k<h;k++){var l=e[k],ua=l.rb;0===k%2&&k!==h-1?Ua=Math.max(Ua,(d?ua.width:ua.height)+Xw(l)-u):0!==k%2&&(lb=Math.max(lb,(d?ua.width:ua.height)+Xw(l)-u))}else 1===h&&(Ua=d?e[0].rb.width:e[0].rb.height);
if(q)switch(m){case Tv:case Iv:H=135>c?fw(b,e,Ua,N,H):gw(b,e,Ua,N,H);Ua=H.x;N=H.width;H=H.height;break;case Uv:for(k=0;k<h;k++)l=e[k],ua=l.rb,r=0===ia?0:w,d?(l.sa.m(g-ua.width,S+r),N=Math.max(N,ua.width),H=Math.max(H,S+r+ua.height),S+=r+ua.height):(l.sa.m(fa+r,g-ua.height),N=Math.max(N,fa+r+ua.width),H=Math.max(H,ua.height),fa+=r+ua.width),ia++;break;case Vv:for(g=0;g<h;g++)l=e[g],ua=l.rb,r=0===ia?0:w,d?(l.sa.m(u/2+b.W.x,S+r),N=Math.max(N,ua.width),H=Math.max(H,S+r+ua.height),S+=r+ua.height):(l.sa.m(fa+
r,u/2+b.W.y),N=Math.max(N,fa+r+ua.width),H=Math.max(H,ua.height),fa+=r+ua.width),ia++}else for(k=0;k<h;k++)l=e[k],ua=l.rb,d?(0<r&&0<ia&&fa+u+ua.width>r&&(fa<g&&Nw(b,m,g-fa,0,U,k-1),ba++,ia=0,U=k,W=H,fa=0,S=135<c?-H-w:H+w),lb=0===ia?y:u,Ow(a,l,0,S),l.sa.m(fa+lb,S),N=Math.max(N,fa+lb+ua.width),H=Math.max(H,W+(0===ba?0:w)+ua.height),fa+=lb+ua.width):(0<r&&0<ia&&S+u+ua.height>r&&(S<g&&Nw(b,m,0,g-S,U,k-1),ba++,ia=0,U=k,W=N,S=0,fa=135<c?-N-w:N+w),lb=0===ia?y:u,Ow(a,l,fa,0),l.sa.m(fa,S+lb),H=Math.max(H,
S+lb+ua.height),N=Math.max(N,W+(0===ba?0:w)+ua.width),S+=lb+ua.height),ia++;0<ba&&(d?(H+=Math.max(0,s),fa<N&&Nw(b,m,N-fa,0,U,h-1),0<C&&(p||Qw(b,C,0,0,h-1),N+=C)):(N+=Math.max(0,s),S<H&&Nw(b,m,0,H-S,U,h-1),0<C&&(p||Qw(b,0,C,0,h-1),H+=C)));C=p=0;switch(m){case Sw:d?p+=N/2-b.W.x-t/2:C+=H/2-b.W.y-t/2;break;case Rv:0<ba?d?p+=N/2-b.W.x-t/2:C+=H/2-b.W.y-t/2:d?(m=e[0].sa.x+e[0].Wa.x,u=e[h-1].sa.x+e[h-1].Wa.x+2*e[h-1].W.x,p+=m+(u-m)/2-b.W.x-t/2):(m=e[0].sa.y+e[0].Wa.y,u=e[h-1].sa.y+e[h-1].Wa.y+2*e[h-1].W.y,
C+=m+(u-m)/2-b.W.y-t/2);break;case bw:d?(p-=t,N+=t):(C-=t,H+=t);break;case cw:d?(p+=N-b.width+t,N+=t):(C+=H-b.height+t,H+=t);break;case Tv:case Iv:d?p=1<h?p+(Ua+u/2-b.W.x):p+(e[0].W.x-b.W.x+e[0].Wa.x):C=1<h?C+(Ua+u/2-b.W.y):C+(e[0].W.y-b.W.y+e[0].Wa.y);break;case Uv:d?p+=N+u/2-b.W.x:C+=H+u/2-b.W.y;break;case Vv:break;default:D.k("Unhandled alignment value "+m.toString())}for(k=0;k<h;k++)l=e[k],d?l.sa.m(l.sa.x+l.Wa.x-p,l.sa.y+(135<c?(q?-H:-l.rb.height)+l.Wa.y-s:A+s+l.Wa.y)):l.sa.m(l.sa.x+(135<c?(q?
-N:-l.rb.width)+l.Wa.x-s:n+s+l.Wa.x),l.sa.y+l.Wa.y-C);d?(N=Tw(b,N,p),0>p&&(p=0),135<c&&(C+=H+s),H+=A+s):(135<c&&(p+=N+s),N+=n+s,H=Uw(b,H,C),0>C&&(C=0));b.Wa.m(p,C);b.rb.m(N,H)}}
function fw(a,b,c,d,e){v&&D.l(a,vv,Z,"layoutBusChildrenPosDir:v");var g=b.length;if(0===g)return new B(c,0,d,e);if(1===g){var h=b[0];d=h.rb.width;e=h.rb.height;return new B(c,0,d,e)}for(var k=a.nodeSpacing,l=a.rowSpacing,m=90===aw(a),n=0,p=0,q=0,r=0;r<g;r++)if(!(0!==r%2||1<g&&r===g-1)){var h=b[r],s=h.rb,u=0===n?0:l;if(m){var t=Xw(h)-k;h.sa.m(c-(s.width+t),q+u);d=Math.max(d,s.width+t);e=Math.max(e,q+u+s.height);q+=u+s.height}else t=Xw(h)-k,h.sa.m(p+u,c-(s.height+t)),e=Math.max(e,s.height+t),d=Math.max(d,
p+u+s.width),p+=u+s.width;n++}var n=0,y=p,w=q;m?(p=c+k,q=0):(p=0,q=c+k);for(r=0;r<g;r++)0!==r%2&&(h=b[r],s=h.rb,u=0===n?0:l,m?(t=Xw(h)-k,h.sa.m(p+t,q+u),d=Math.max(d,p+s.width+t),e=Math.max(e,q+u+s.height),q+=u+s.height):(t=Xw(h)-k,h.sa.m(p+u,q+t),d=Math.max(d,p+u+s.width),e=Math.max(e,q+s.height+t),p+=u+s.width),n++);1<g&&1===g%2&&(h=b[g-1],s=h.rb,b=Yw(h,m?Math.max(Math.abs(w),Math.abs(q)):Math.max(Math.abs(y),Math.abs(p))),m?(h.sa.m(c+k/2-h.W.x-h.Wa.x,e+b),m=c+k/2-h.W.x-h.Wa.x,d=Math.max(d,m+s.width),
0>m&&(d-=m),e=Math.max(e,Math.max(w,q)+b+s.height),0>h.sa.x&&(c=Zw(a,h.sa.x,!1,c,k))):(h.sa.m(d+b,c+k/2-h.W.y-h.Wa.y),d=Math.max(d,Math.max(y,p)+b+s.width),m=c+k/2-h.W.y-h.Wa.y,e=Math.max(e,m+s.height),0>m&&(e-=m),0>h.sa.y&&(c=Zw(a,h.sa.y,!0,c,k))));return new B(c,0,d,e)}
function gw(a,b,c,d,e){v&&D.l(a,vv,Z,"layoutBusChildrenNegDir:v");var g=b.length;if(0===g)return new B(c,0,d,e);if(1===g){var h=b[0];d=h.rb.width;e=h.rb.height;return new B(c,0,d,e)}for(var k=a.nodeSpacing,l=a.rowSpacing,m=270===aw(a),n=0,p=0,q=0,r=0;r<g;r++)if(!(0!==r%2||1<g&&r===g-1)){var h=b[r],s=h.rb,u=0===n?0:l;if(m){var t=Xw(h)-k,q=q-(u+s.height);h.sa.m(c-(s.width+t),q);d=Math.max(d,s.width+t);e=Math.max(e,Math.abs(q))}else t=Xw(h)-k,p-=u+s.width,h.sa.m(p,c-(s.height+t)),e=Math.max(e,s.height+
t),d=Math.max(d,Math.abs(p));n++}var n=0,y=p,w=q;m?(p=c+k,q=0):(p=0,q=c+k);for(r=0;r<g;r++)0!==r%2&&(h=b[r],s=h.rb,u=0===n?0:l,m?(t=Xw(h)-k,q-=u+s.height,h.sa.m(p+t,q),d=Math.max(d,p+s.width+t),e=Math.max(e,Math.abs(q))):(t=Xw(h)-k,p-=u+s.width,h.sa.m(p,q+t),e=Math.max(e,q+s.height+t),d=Math.max(d,Math.abs(p))),n++);1<g&&1===g%2&&(h=b[g-1],s=h.rb,l=Yw(h,m?Math.max(Math.abs(w),Math.abs(q)):Math.max(Math.abs(y),Math.abs(p))),m?(h.sa.m(c+k/2-h.W.x-h.Wa.x,-e-s.height-l),p=c+k/2-h.W.x-h.Wa.x,d=Math.max(d,
p+s.width),0>p&&(d-=p),e=Math.max(e,Math.abs(Math.min(w,q))+l+s.height),0>h.sa.x&&(c=Zw(a,h.sa.x,!1,c,k))):(h.sa.m(-d-s.width-l,c+k/2-h.W.y-h.Wa.y),d=Math.max(d,Math.abs(Math.min(y,p))+l+s.width),p=c+k/2-h.W.y-h.Wa.y,e=Math.max(e,p+s.height),0>p&&(e-=p),0>h.sa.y&&(c=Zw(a,h.sa.y,!0,c,k))));for(r=0;r<g;r++)h=b[r],m?h.sa.m(h.sa.x,h.sa.y+e):h.sa.m(h.sa.x+d,h.sa.y);return new B(c,0,d,e)}function Xw(a){v&&D.l(a,vv,Z,"fixRelativePostions:child");return null===a.parent?0:a.parent.nodeSpacing}
function Yw(a){v&&D.l(a,vv,Z,"fixRelativePostions:lastchild");return null===a.parent?0:a.parent.rowSpacing}function Zw(a,b,c,d,e){v&&D.l(a,vv,Z,"fixRelativePostions:v");a=a.children;for(var g=a.length,h=0;h<g;h++)c?a[h].sa.m(a[h].sa.x,a[h].sa.y-b):a[h].sa.m(a[h].sa.x-b,a[h].sa.y);b=a[g-1];return Math.max(d,c?b.Wa.y+b.W.y-e/2:b.Wa.x+b.W.x-e/2)}
function Tw(a,b,c){v&&D.l(a,vv,Z,"calculateSubwidth:v");switch(a.alignment){case Rv:case Sw:var d=b;c+a.width>d&&(d=c+a.width);0>c&&(d-=c);return d;case bw:return a.width>b?a.width:b;case cw:return 2*a.W.x>b?a.width:b+a.width-2*a.W.x;case Tv:case Iv:return d=Math.min(0,c),c=Math.max(b,c+a.width),Math.max(a.width,c-d);case Uv:return a.width-a.W.x+a.nodeSpacing/2+b;case Vv:return Math.max(a.width,a.W.x+a.nodeSpacing/2+b);default:return b}}
function Uw(a,b,c){v&&D.l(a,vv,Z,"calculateSubheight:v");switch(a.alignment){case Rv:case Sw:var d=b;c+a.height>d&&(d=c+a.height);0>c&&(d-=c);return d;case bw:return a.height>b?a.height:b;case cw:return 2*a.W.y>b?a.height:b+a.height-2*a.W.y;case Tv:case Iv:return d=Math.min(0,c),c=Math.max(b,c+a.height),Math.max(a.height,c-d);case Uv:return a.height-a.W.y+a.nodeSpacing/2+b;case Vv:return Math.max(a.height,a.W.y+a.nodeSpacing/2+b);default:return b}}
function Vw(a,b,c){v&&D.l(a,za,Z,"alignOffset:align");switch(a){case Sw:b/=2;c/=2;break;case Rv:b/=2;c/=2;break;case bw:c=b=0;break;case cw:break;default:D.k("Unhandled alignment value "+a.toString())}return new O(b,c)}function Nw(a,b,c,d,e,g){v&&D.l(a,vv,Z,"shiftRelPosAlign:v");v&&D.l(b,za,Z,"shiftRelPosAlign:align");b=Vw(b,c,d);Qw(a,b.x,b.y,e,g)}function Qw(a,b,c,d,e){v&&D.l(a,vv,Z,"shiftRelPos:v");if(0!==b||0!==c)for(a=a.children;d<=e;d++){var g=a[d].sa;g.x+=b;g.y+=c}}
function Ow(a,b,c,d){v&&(D.l(b,vv,Z,"recordMidPoints:v"),D.h(c,"number",Z,"recordMidPoints:x"),D.h(d,"number",Z,"recordMidPoints:y"));var e=b.parent;switch(a.Rf){case rv:for(a=b.sc;a.next();)b=a.value,b.fromVertex===e&&b.at.m(c,d);break;case yv:for(a=b.pc;a.next();)b=a.value,b.toVertex===e&&b.at.m(c,d);break;default:D.k("Unhandled path value "+a.Rf.toString())}}function Rw(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];e.x+=b;e.y+=c}}
function Pw(a,b,c,d,e,g,h,k){v&&D.l(b,vv,Z,"mergeFringes:parent");v&&D.l(c,vv,Z,"mergeFringes:child");var l=aw(b),m=90===l||270===l,n=b.nodeSpacing;b=d;var p=e;d=g;e=h;var q=c.Bu,r=c.Wu;h=c.rb;var s=m?Math.max(e,h.height):Math.max(d,h.width);if(null===q||l!==aw(c))q=Mw(a,2),r=Mw(a,2),m?(q[0].m(0,0),q[1].m(0,h.height),r[0].m(h.width,0),r[1].m(r[0].x,q[1].y)):(q[0].m(0,0),q[1].m(h.width,0),r[0].m(0,h.height),r[1].m(q[1].x,r[0].y));if(m){c=d;d=9999999;if(!(null===p||2>p.length||null===q||2>q.length))for(m=
l=0;l<p.length&&m<q.length;){e=p[l];var u=q[m];g=u.x;var t=u.y;g+=c;var y=e;l+1<p.length&&(y=p[l+1]);var w=u,u=w.x,w=w.y;m+1<q.length&&(w=q[m+1],u=w.x,w=w.y,u+=c);var C=d;e.y===t?C=g-e.x:e.y>t&&e.y<w?C=g+(e.y-t)/(w-t)*(u-g)-e.x:t>e.y&&t<y.y&&(C=g-(e.x+(t-e.y)/(y.y-e.y)*(y.x-e.x)));C<d&&(d=C);y.y<=e.y?l++:w<=t?m++:(y.y<=w&&l++,w<=y.y&&m++)}c-=d;c+=n;l=q;m=c;if(null===b||2>b.length||null===l||2>l.length)d=null;else{n=Mw(a,b.length+l.length);for(d=g=e=0;g<l.length&&l[g].y<b[0].y;)t=l[g++],n[d++].m(t.x+
m,t.y);for(;e<b.length;)t=b[e++],n[d++].m(t.x,t.y);for(e=b[b.length-1].y;g<l.length&&l[g].y<=e;)g++;for(;g<l.length&&l[g].y>e;)t=l[g++],n[d++].m(t.x+m,t.y);l=Mw(a,d);for(e=0;e<d;e++)l[e].assign(n[e]);Ww(a,n);d=l}g=r;t=c;if(null===p||2>p.length||null===g||2>g.length)e=null;else{n=Mw(a,p.length+g.length);for(m=y=l=0;l<p.length&&p[l].y<g[0].y;)e=p[l++],n[m++].m(e.x,e.y);for(;y<g.length;)e=g[y++],n[m++].m(e.x+t,e.y);for(g=g[g.length-1].y;l<p.length&&p[l].y<=g;)l++;for(;l<p.length&&p[l].y>g;)e=p[l++],
n[m++].m(e.x,e.y);e=Mw(a,m);for(l=0;l<m;l++)e[l].assign(n[l]);Ww(a,n)}g=Math.max(0,c)+h.width;h=s}else{c=e;d=9999999;if(!(null===p||2>p.length||null===q||2>q.length))for(m=l=0;l<p.length&&m<q.length;)e=p[l],u=q[m],g=u.x,t=u.y,t+=c,y=e,l+1<p.length&&(y=p[l+1]),w=u,u=w.x,w=w.y,m+1<q.length&&(w=q[m+1],u=w.x,w=w.y,w+=c),C=d,e.x===g?C=t-e.y:e.x>g&&e.x<u?C=t+(e.x-g)/(u-g)*(w-t)-e.y:g>e.x&&g<y.x&&(C=t-(e.y+(g-e.x)/(y.x-e.x)*(y.y-e.y))),C<d&&(d=C),y.x<=e.x?l++:u<=g?m++:(y.x<=u&&l++,u<=y.x&&m++);c-=d;c+=n;
l=q;m=c;if(null===b||2>b.length||null===l||2>l.length)d=null;else{n=Mw(a,b.length+l.length);for(d=g=e=0;g<l.length&&l[g].x<b[0].x;)t=l[g++],n[d++].m(t.x,t.y+m);for(;e<b.length;)t=b[e++],n[d++].m(t.x,t.y);for(e=b[b.length-1].x;g<l.length&&l[g].x<=e;)g++;for(;g<l.length&&l[g].x>e;)t=l[g++],n[d++].m(t.x,t.y+m);l=Mw(a,d);for(e=0;e<d;e++)l[e].assign(n[e]);Ww(a,n);d=l}g=r;t=c;if(null===p||2>p.length||null===g||2>g.length)e=null;else{n=Mw(a,p.length+g.length);for(m=y=l=0;l<p.length&&p[l].x<g[0].x;)e=p[l++],
n[m++].m(e.x,e.y);for(;y<g.length;)e=g[y++],n[m++].m(e.x,e.y+t);for(g=g[g.length-1].x;l<p.length&&p[l].x<=g;)l++;for(;l<p.length&&p[l].x>g;)e=p[l++],n[m++].m(e.x,e.y);e=Mw(a,m);for(l=0;l<m;l++)e[l].assign(n[l]);Ww(a,n)}g=s;h=Math.max(0,c)+h.height}Ww(a,b);Ww(a,q);Ww(a,p);Ww(a,r);k[0]=d;k[1]=e;return new B(c,0,g,h)}function Mw(a,b){var c=a.bA[b];if(void 0!==c&&(c=c.pop(),void 0!==c))return c;for(var c=[],d=0;d<b;d++)c[d]=new O;return c}
function Ww(a,b){var c=b.length,d=a.bA[c];void 0===d&&(d=[],a.bA[c]=d);d.push(b)}
Z.prototype.arrangeTrees=function(){if(this.vd===xv)for(var a=this.Cd.j;a.next();){var b=a.value;if(b instanceof vv){var c=b.Vc;if(null!==c){var d=c.position,c=d.x,d=d.y;isFinite(c)||(c=0);isFinite(d)||(d=0);$w(this,b,c,d)}}}else{c=[];for(a=this.Cd.j;a.next();)b=a.value,b instanceof vv&&c.push(b);switch(this.sorting){case Nv:break;case Ov:c.reverse();break;case Pv:c.sort(this.comparer);break;case Qv:c.sort(this.comparer);c.reverse();break;default:D.k("Unhandled sorting value "+this.sorting.toString())}b=
this.Ae;a=b.x;b=b.y;for(d=0;d<c.length;d++){var e=c[d];$w(this,e,a+e.Wa.x,b+e.Wa.y);switch(this.vd){case uv:b+=e.rb.height+this.sg.height;break;case ax:a+=e.rb.width+this.sg.width;break;default:D.k("Unhandled arrangement value "+this.vd.toString())}}}};function $w(a,b,c,d){if(null!==b){v&&D.l(b,vv,Z,"assignAbsolutePositions:v");b.x=c;b.y=d;b=b.children;for(var e=b.length,g=0;g<e;g++){var h=b[g];$w(a,h,c+h.sa.x,d+h.sa.y)}}}
Z.prototype.commitLayout=function(){this.EB();this.commitNodes();this.sA();this.zu&&this.commitLinks()};Z.prototype.commitNodes=function(){for(var a=this.network.vertexes.j;a.next();)a.value.commit();for(a.reset();a.next();)this.layoutComments(a.value)};
Z.prototype.sA=function(){if(this.aB===Fv){for(var a=this.lC,b=[],c=null,d=this.network.vertexes.j;d.next();){var e=d.value;null===c?c=e.sb.copy():c.Wh(e.sb);var g=b[e.level],g=void 0===g?dw(e):Math.max(g,dw(e));b[e.level]=g}for(d=0;d<b.length;d++)void 0===b[d]&&(b[d]=0);90===this.angle||270===this.angle?(c.eg(this.nodeSpacing/2,this.layerSpacing),e=new O(-this.nodeSpacing/2,-this.layerSpacing/2)):(c.eg(this.layerSpacing,this.nodeSpacing/2),e=new O(-this.layerSpacing/2,-this.nodeSpacing/2));var g=
[],c=90===this.angle||270===this.angle?c.width:c.height,h=0;if(180===this.angle||270===this.angle)for(d=0;d<a.length;d++)h+=a[d]+b[d];for(d=0;d<a.length;d++){var k=a[d]+b[d];270===this.angle?(h-=k,g.push(new B(0,h,c,k))):90===this.angle?(g.push(new B(0,h,c,k)),h+=k):180===this.angle?(h-=k,g.push(new B(h,0,k,c))):(g.push(new B(h,0,k,c)),h+=k)}this.commitLayers(g,e)}};Z.prototype.commitLayers=function(){};Z.prototype.commitLinks=function(){for(var a=this.network.edges.j;a.next();)a.value.commit()};
Z.prototype.EB=function(){for(var a=this.Cd.j;a.next();){var b=a.value;b instanceof vv&&bx(this,b)}};function bx(a,b){if(null!==b){v&&D.l(b,vv,Z,"setPortSpotsTree:v");a.setPortSpots(b);for(var c=b.children,d=c.length,e=0;e<d;e++)bx(a,c[e])}}
Z.prototype.setPortSpots=function(a){v&&D.l(a,vv,Z,"setPortSpots:v");var b=a.alignment;if(Sv(b)){v&&D.l(a,vv,Z,"setPortSpotsBus:v");v&&D.l(b,za,Z,"setPortSpots:align");var c=this.Rf===rv,d=aw(a),e;switch(d){case 0:e=fd;break;case 90:e=gd;break;case 180:e=ed;break;default:e=Yc}var g=a.children,h=g.length;switch(b){case Tv:case Iv:for(b=0;b<h;b++){var k=g[b],k=(c?k.sc:k.pc).first();if(null!==k&&(k=k.link,null!==k)){var l=90===d||270===d?ed:Yc;if(1===h||b===h-1&&1===h%2)switch(d){case 0:l=ed;break;case 90:l=
Yc;break;case 180:l=fd;break;default:l=gd}else 0===b%2&&(l=90===d||270===d?fd:gd);c?(a.setsPortSpot&&(k.Gb=e),a.setsChildPortSpot&&(k.Hb=l)):(a.setsPortSpot&&(k.Gb=l),a.setsChildPortSpot&&(k.Hb=e))}}break;case Uv:l=90===d||270===d?fd:gd;for(d=c?a.pc:a.sc;d.next();)k=d.value.link,null!==k&&(c?(a.setsPortSpot&&(k.Gb=e),a.setsChildPortSpot&&(k.Hb=l)):(a.setsPortSpot&&(k.Gb=l),a.setsChildPortSpot&&(k.Hb=e)));break;case Vv:for(l=90===d||270===d?ed:Yc,d=c?a.pc:a.sc;d.next();)k=d.value.link,null!==k&&(c?
(a.setsPortSpot&&(k.Gb=e),a.setsChildPortSpot&&(k.Hb=l)):(a.setsPortSpot&&(k.Gb=l),a.setsChildPortSpot&&(k.Hb=e)))}}else if(c=aw(a),this.Rf===rv)for(e=a.pc;e.next();){if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.ed())switch(c){case 0:d.Gb=fd;break;case 90:d.Gb=gd;break;case 180:d.Gb=ed;break;default:d.Gb=Yc}else d.Gb=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.ed())switch(c){case 0:d.Hb=ed;break;case 90:d.Hb=Yc;break;case 180:d.Hb=fd;break;default:d.Hb=gd}else d.Hb=a.childPortSpot}}else for(e=
a.sc;e.next();)if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.ed())switch(c){case 0:d.Hb=fd;break;case 90:d.Hb=gd;break;case 180:d.Hb=ed;break;default:d.Hb=Yc}else d.Hb=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.ed())switch(c){case 0:d.Gb=ed;break;case 90:d.Gb=Yc;break;case 180:d.Gb=fd;break;default:d.Gb=gd}else d.Gb=a.childPortSpot}};function aw(a){a=a.angle;return 45>=a?0:135>=a?90:225>=a?180:315>=a?270:0}
function dw(a){v&&D.l(a,vv,Z,"computeLayerSpacing:v");var b=aw(a),b=90===b||270===b,c=a.layerSpacing;if(0<a.layerSpacingParentOverlap)var d=Math.min(1,a.layerSpacingParentOverlap),c=c-(b?a.height*d:a.width*d);c<(b?-a.height:-a.width)&&(c=b?-a.height:-a.width);return c}function ew(a){v&&D.l(a,vv,Z,"computeNodeIndent:v");var b=aw(a),b=90===b||270===b,c=a.nodeIndent;if(0<a.nodeIndentPastParent)var d=Math.min(1,a.nodeIndentPastParent),c=c+(b?a.width*d:a.height*d);return c=Math.max(0,c)}
D.defineProperty(Z,{qM:"roots"},function(){return this.Cd},function(a){this.Cd!==a&&(D.l(a,L,Z,"roots"),this.Cd=a,this.N())});D.defineProperty(Z,{path:"path"},function(){return this.Us},function(a){this.Us!==a&&(D.Ca(a,Z,Z,"path"),this.Us=a,this.N())});D.defineProperty(Z,{wK:"treeStyle"},function(){return this.Lt},function(a){this.vd!==a&&(D.Ca(a,Z,Z,"treeStyle"),a===sv||a===Lv||a===Mv||a===Kv)&&(this.Lt=a,this.N())});
D.defineProperty(Z,{aB:"layerStyle"},function(){return this.lw},function(a){this.vd!==a&&(D.Ca(a,Z,Z,"layerStyle"),a===tv||a===Gv||a===Fv)&&(this.lw=a,this.N())});D.defineProperty(Z,{comments:"comments"},function(){return this.Yh},function(a){this.Yh!==a&&(D.h(a,"boolean",Z,"comments"),this.Yh=a,this.N())});D.defineProperty(Z,{$f:"arrangement"},function(){return this.vd},function(a){this.vd!==a&&(D.Ca(a,Z,Z,"arrangement"),a===uv||a===ax||a===xv)&&(this.vd=a,this.N())});
D.defineProperty(Z,{IE:"arrangementSpacing"},function(){return this.sg},function(a){D.l(a,Ca,Z,"arrangementSpacing");this.sg.O(a)||(this.sg.assign(a),this.N())});D.defineProperty(Z,{pM:"rootDefaults"},function(){return this.ya},function(a){this.ya!==a&&(D.l(a,vv,Z,"rootDefaults"),this.ya=a,this.N())});D.defineProperty(Z,{NK:"alternateDefaults"},function(){return this.za},function(a){this.za!==a&&(D.l(a,vv,Z,"alternateDefaults"),this.za=a,this.N())});
D.defineProperty(Z,{sorting:"sorting"},function(){return this.ya.sorting},function(a){this.ya.sorting!==a&&(D.Ca(a,Z,Z,"sorting"),a===Nv||a===Ov||a===Pv||Qv)&&(this.ya.sorting=a,this.N())});D.defineProperty(Z,{comparer:"comparer"},function(){return this.ya.comparer},function(a){this.ya.comparer!==a&&(D.h(a,"function",Z,"comparer"),this.ya.comparer=a,this.N())});
D.defineProperty(Z,{angle:"angle"},function(){return this.ya.angle},function(a){this.ya.angle!==a&&(D.h(a,"number",Z,"angle"),0===a||90===a||180===a||270===a?(this.ya.angle=a,this.N()):D.k("TreeLayout.angle must be 0, 90, 180, or 270"))});D.defineProperty(Z,{alignment:"alignment"},function(){return this.ya.alignment},function(a){this.ya.alignment!==a&&(D.Ca(a,Z,Z,"alignment"),this.ya.alignment=a,this.N())});
D.defineProperty(Z,{nodeIndent:"nodeIndent"},function(){return this.ya.nodeIndent},function(a){this.ya.nodeIndent!==a&&(D.h(a,"number",Z,"nodeIndent"),0<=a&&(this.ya.nodeIndent=a,this.N()))});D.defineProperty(Z,{nodeIndentPastParent:"nodeIndentPastParent"},function(){return this.ya.nodeIndentPastParent},function(a){this.ya.nodeIndentPastParent!==a&&(D.h(a,"number",Z,"nodeIndentPastParent"),0<=a&&1>=a&&(this.ya.nodeIndentPastParent=a,this.N()))});
D.defineProperty(Z,{nodeSpacing:"nodeSpacing"},function(){return this.ya.nodeSpacing},function(a){this.ya.nodeSpacing!==a&&(D.h(a,"number",Z,"nodeSpacing"),this.ya.nodeSpacing=a,this.N())});D.defineProperty(Z,{layerSpacing:"layerSpacing"},function(){return this.ya.layerSpacing},function(a){this.ya.layerSpacing!==a&&(D.h(a,"number",Z,"layerSpacing"),this.ya.layerSpacing=a,this.N())});
D.defineProperty(Z,{layerSpacingParentOverlap:"layerSpacingParentOverlap"},function(){return this.ya.layerSpacingParentOverlap},function(a){this.ya.layerSpacingParentOverlap!==a&&(D.h(a,"number",Z,"layerSpacingParentOverlap"),0<=a&&1>=a&&(this.ya.layerSpacingParentOverlap=a,this.N()))});D.defineProperty(Z,{compaction:"compaction"},function(){return this.ya.compaction},function(a){this.ya.compaction!==a&&(D.Ca(a,Z,Z,"compaction"),a===Yv||a===$v)&&(this.ya.compaction=a,this.N())});
D.defineProperty(Z,{breadthLimit:"breadthLimit"},function(){return this.ya.breadthLimit},function(a){this.ya.breadthLimit!==a&&(D.h(a,"number",Z,"breadthLimit"),0<=a&&(this.ya.breadthLimit=a,this.N()))});D.defineProperty(Z,{rowSpacing:"rowSpacing"},function(){return this.ya.rowSpacing},function(a){this.ya.rowSpacing!==a&&(D.h(a,"number",Z,"rowSpacing"),this.ya.rowSpacing=a,this.N())});
D.defineProperty(Z,{rowIndent:"rowIndent"},function(){return this.ya.rowIndent},function(a){this.ya.rowIndent!==a&&(D.h(a,"number",Z,"rowIndent"),0<=a&&(this.ya.rowIndent=a,this.N()))});D.defineProperty(Z,{commentSpacing:"commentSpacing"},function(){return this.ya.commentSpacing},function(a){this.ya.commentSpacing!==a&&(D.h(a,"number",Z,"commentSpacing"),this.ya.commentSpacing=a,this.N())});
D.defineProperty(Z,{commentMargin:"commentMargin"},function(){return this.ya.commentMargin},function(a){this.ya.commentMargin!==a&&(D.h(a,"number",Z,"commentMargin"),this.ya.commentMargin=a,this.N())});D.defineProperty(Z,{setsPortSpot:"setsPortSpot"},function(){return this.ya.setsPortSpot},function(a){this.ya.setsPortSpot!==a&&(D.h(a,"boolean",Z,"setsPortSpot"),this.ya.setsPortSpot=a,this.N())});
D.defineProperty(Z,{portSpot:"portSpot"},function(){return this.ya.portSpot},function(a){D.l(a,R,Z,"portSpot");this.ya.portSpot.O(a)||(this.ya.portSpot=a,this.N())});D.defineProperty(Z,{setsChildPortSpot:"setsChildPortSpot"},function(){return this.ya.setsChildPortSpot},function(a){this.ya.setsChildPortSpot!==a&&(D.h(a,"boolean",Z,"setsChildPortSpot"),this.ya.setsChildPortSpot=a,this.N())});
D.defineProperty(Z,{childPortSpot:"childPortSpot"},function(){return this.ya.childPortSpot},function(a){D.l(a,R,Z,"childPortSpot");this.ya.childPortSpot.O(a)||(this.ya.childPortSpot=a,this.N())});D.defineProperty(Z,{YK:"alternateSorting"},function(){return this.za.sorting},function(a){this.za.sorting!==a&&(D.Ca(a,Z,Z,"alternateSorting"),a===Nv||a===Ov||a===Pv||Qv)&&(this.za.sorting=a,this.N())});
D.defineProperty(Z,{MK:"alternateComparer"},function(){return this.za.comparer},function(a){this.za.comparer!==a&&(D.h(a,"function",Z,"alternateComparer"),this.za.comparer=a,this.N())});D.defineProperty(Z,{GK:"alternateAngle"},function(){return this.za.angle},function(a){this.za.angle!==a&&(D.h(a,"number",Z,"alternateAngle"),0===a||90===a||180===a||270===a)&&(this.za.angle=a,this.N())});
D.defineProperty(Z,{FK:"alternateAlignment"},function(){return this.za.alignment},function(a){this.za.alignment!==a&&(D.Ca(a,Z,Z,"alternateAlignment"),this.za.alignment=a,this.N())});D.defineProperty(Z,{QK:"alternateNodeIndent"},function(){return this.za.nodeIndent},function(a){this.za.nodeIndent!==a&&(D.h(a,"number",Z,"alternateNodeIndent"),0<=a&&(this.za.nodeIndent=a,this.N()))});
D.defineProperty(Z,{RK:"alternateNodeIndentPastParent"},function(){return this.za.nodeIndentPastParent},function(a){this.za.nodeIndentPastParent!==a&&(D.h(a,"number",Z,"alternateNodeIndentPastParent"),0<=a&&1>=a&&(this.za.nodeIndentPastParent=a,this.N()))});D.defineProperty(Z,{SK:"alternateNodeSpacing"},function(){return this.za.nodeSpacing},function(a){this.za.nodeSpacing!==a&&(D.h(a,"number",Z,"alternateNodeSpacing"),this.za.nodeSpacing=a,this.N())});
D.defineProperty(Z,{OK:"alternateLayerSpacing"},function(){return this.za.layerSpacing},function(a){this.za.layerSpacing!==a&&(D.h(a,"number",Z,"alternateLayerSpacing"),this.za.layerSpacing=a,this.N())});D.defineProperty(Z,{PK:"alternateLayerSpacingParentOverlap"},function(){return this.za.layerSpacingParentOverlap},function(a){this.za.layerSpacingParentOverlap!==a&&(D.h(a,"number",Z,"alternateLayerSpacingParentOverlap"),0<=a&&1>=a&&(this.za.layerSpacingParentOverlap=a,this.N()))});
D.defineProperty(Z,{LK:"alternateCompaction"},function(){return this.za.compaction},function(a){this.za.compaction!==a&&(D.Ca(a,Z,Z,"alternateCompaction"),a===Yv||a===$v)&&(this.za.compaction=a,this.N())});D.defineProperty(Z,{HK:"alternateBreadthLimit"},function(){return this.za.breadthLimit},function(a){this.za.breadthLimit!==a&&(D.h(a,"number",Z,"alternateBreadthLimit"),0<=a&&(this.za.breadthLimit=a,this.N()))});
D.defineProperty(Z,{VK:"alternateRowSpacing"},function(){return this.za.rowSpacing},function(a){this.za.rowSpacing!==a&&(D.h(a,"number",Z,"alternateRowSpacing"),this.za.rowSpacing=a,this.N())});D.defineProperty(Z,{UK:"alternateRowIndent"},function(){return this.za.rowIndent},function(a){this.za.rowIndent!==a&&(D.h(a,"number",Z,"alternateRowIndent"),0<=a&&(this.za.rowIndent=a,this.N()))});
D.defineProperty(Z,{KK:"alternateCommentSpacing"},function(){return this.za.commentSpacing},function(a){this.za.commentSpacing!==a&&(D.h(a,"number",Z,"alternateCommentSpacing"),this.za.commentSpacing=a,this.N())});D.defineProperty(Z,{JK:"alternateCommentMargin"},function(){return this.za.commentMargin},function(a){this.za.commentMargin!==a&&(D.h(a,"number",Z,"alternateCommentMargin"),this.za.commentMargin=a,this.N())});
D.defineProperty(Z,{XK:"alternateSetsPortSpot"},function(){return this.za.setsPortSpot},function(a){this.za.setsPortSpot!==a&&(D.h(a,"boolean",Z,"alternateSetsPortSpot"),this.za.setsPortSpot=a,this.N())});D.defineProperty(Z,{TK:"alternatePortSpot"},function(){return this.za.portSpot},function(a){D.l(a,R,Z,"alternatePortSpot");this.za.portSpot.O(a)||(this.za.portSpot=a,this.N())});
D.defineProperty(Z,{WK:"alternateSetsChildPortSpot"},function(){return this.za.setsChildPortSpot},function(a){this.za.setsChildPortSpot!==a&&(D.h(a,"boolean",Z,"alternateSetsChildPortSpot"),this.za.setsChildPortSpot=a,this.N())});D.defineProperty(Z,{IK:"alternateChildPortSpot"},function(){return this.za.childPortSpot},function(a){D.l(a,R,Z,"alternateChildPortSpot");this.za.childPortSpot.O(a)||(this.za.childPortSpot=a,this.N())});var qv;Z.PathDefault=qv=D.s(Z,"PathDefault",-1);var rv;
Z.PathDestination=rv=D.s(Z,"PathDestination",0);var yv;Z.PathSource=yv=D.s(Z,"PathSource",1);var Nv;Z.SortingForwards=Nv=D.s(Z,"SortingForwards",10);var Ov;Z.SortingReverse=Ov=D.s(Z,"SortingReverse",11);var Pv;Z.SortingAscending=Pv=D.s(Z,"SortingAscending",12);var Qv;Z.SortingDescending=Qv=D.s(Z,"SortingDescending",13);var Sw;Z.AlignmentCenterSubtrees=Sw=D.s(Z,"AlignmentCenterSubtrees",20);var Rv;Z.AlignmentCenterChildren=Rv=D.s(Z,"AlignmentCenterChildren",21);var bw;
Z.AlignmentStart=bw=D.s(Z,"AlignmentStart",22);var cw;Z.AlignmentEnd=cw=D.s(Z,"AlignmentEnd",23);var Tv;Z.AlignmentBus=Tv=D.s(Z,"AlignmentBus",24);var Iv;Z.AlignmentBusBranching=Iv=D.s(Z,"AlignmentBusBranching",25);var Uv;Z.AlignmentTopLeftBus=Uv=D.s(Z,"AlignmentTopLeftBus",26);var Vv;Z.AlignmentBottomRightBus=Vv=D.s(Z,"AlignmentBottomRightBus",27);var Yv;Z.CompactionNone=Yv=D.s(Z,"CompactionNone",30);var $v;Z.CompactionBlock=$v=D.s(Z,"CompactionBlock",31);var sv;
Z.StyleLayered=sv=D.s(Z,"StyleLayered",40);var Mv;Z.StyleLastParents=Mv=D.s(Z,"StyleLastParents",41);var Lv;Z.StyleAlternating=Lv=D.s(Z,"StyleAlternating",42);var Kv;Z.StyleRootOnly=Kv=D.s(Z,"StyleRootOnly",43);var uv;Z.ArrangementVertical=uv=D.s(Z,"ArrangementVertical",50);var ax;Z.ArrangementHorizontal=ax=D.s(Z,"ArrangementHorizontal",51);var xv;Z.ArrangementFixedRoots=xv=D.s(Z,"ArrangementFixedRoots",52);var tv;Z.LayerIndividual=tv=D.s(Z,"LayerIndividual",60);var Gv;
Z.LayerSiblings=Gv=D.s(Z,"LayerSiblings",61);var Fv;Z.LayerUniform=Fv=D.s(Z,"LayerUniform",62);function wv(){va.call(this)}D.Sa(wv,va);D.ja("TreeNetwork",wv);wv.prototype.createVertex=function(){return new vv};wv.prototype.createEdge=function(){return new cx};
function vv(){wa.call(this);this.initialized=!1;this.parent=null;this.children=[];this.maxGenerationCount=this.maxChildrenCount=this.descendantCount=this.level=0;this.comments=null;this.sa=new O(0,0);this.rb=new Ca(0,0);this.Wa=new O(0,0);this.Mq=this.Lq=this.bK=!1;this.Wu=this.Bu=null;this.sorting=Nv;this.comparer=ws;this.angle=0;this.alignment=Rv;this.nodeIndentPastParent=this.nodeIndent=0;this.nodeSpacing=20;this.layerSpacing=50;this.layerSpacingParentOverlap=0;this.compaction=$v;this.breadthLimit=
0;this.rowSpacing=25;this.commentSpacing=this.rowIndent=10;this.commentMargin=20;this.setsPortSpot=!0;this.portSpot=Tc;this.setsChildPortSpot=!0;this.childPortSpot=Tc}D.Sa(vv,wa);D.ja("TreeVertex",vv);
vv.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.sorting=a.sorting,this.comparer=a.comparer,this.angle=a.angle,this.alignment=a.alignment,this.nodeIndent=a.nodeIndent,this.nodeIndentPastParent=a.nodeIndentPastParent,this.nodeSpacing=a.nodeSpacing,this.layerSpacing=a.layerSpacing,this.layerSpacingParentOverlap=a.layerSpacingParentOverlap,this.compaction=a.compaction,this.breadthLimit=a.breadthLimit,this.rowSpacing=a.rowSpacing,this.rowIndent=a.rowIndent,this.commentSpacing=a.commentSpacing,
this.commentMargin=a.commentMargin,this.setsPortSpot=a.setsPortSpot,this.portSpot=a.portSpot,this.setsChildPortSpot=a.setsChildPortSpot,this.childPortSpot=a.childPortSpot)};D.w(vv,{Fn:"childrenCount"},function(){return this.children.length});D.defineProperty(vv,{oM:"relativePosition"},function(){return this.sa},function(a){this.sa.set(a)});D.defineProperty(vv,{BM:"subtreeSize"},function(){return this.rb},function(a){this.rb.set(a)});
D.defineProperty(vv,{AM:"subtreeOffset"},function(){return this.Wa},function(a){this.Wa.set(a)});function cx(){xa.call(this);this.at=new O(0,0)}D.Sa(cx,xa);D.ja("TreeEdge",cx);
cx.prototype.commit=function(){var a=this.link;if(null!==a&&!a.Di){var b=this.network.Vb,c=null,d=null;switch(b.Rf){case rv:c=this.fromVertex;d=this.toVertex;break;case yv:c=this.toVertex;d=this.fromVertex;break;default:D.k("Unhandled path value "+b.Rf.toString())}if(null!==c&&null!==d)if(b=this.at,0!==b.x||0!==b.y||c.bK){var d=c.sb,e=aw(c),g=dw(c),h=c.rowSpacing;a.yo();var k=a.gf===Nj,l=a.qc,m=0,n,p;a.zm();if(l||k){for(m=2;4<a.ta;)a.vG(2);n=a.n(1);p=a.n(2)}else{for(m=1;3<a.ta;)a.vG(1);n=a.n(0);p=
a.n(a.ta-1)}var q=a.n(a.ta-1),r=0;0===e?(c.alignment===cw?(r=d.bottom+b.y,0===b.y&&n.y>q.y+c.rowIndent&&(r=Math.min(r,Math.max(n.y,r-ew(c))))):c.alignment===bw?(r=d.top+b.y,0===b.y&&n.y<q.y-c.rowIndent&&(r=Math.max(r,Math.min(n.y,r+ew(c))))):r=c.Lq||c.Mq&&1===c.maxGenerationCount?d.top-c.Wa.y+b.y:d.y+d.height/2+b.y,k?(a.B(m,n.x,r),m++,a.B(m,d.right+g,r),m++,a.B(m,d.right+g+(b.x-h)/3,r),m++,a.B(m,d.right+g+2*(b.x-h)/3,r),m++,a.B(m,d.right+g+(b.x-h),r),m++,a.B(m,p.x,r)):(l&&(a.B(m,d.right+g/2,n.y),
m++),a.B(m,d.right+g/2,r),m++,a.B(m,d.right+g+b.x-(l?h/2:h),r),m++,l&&a.B(m,a.n(m-1).x,p.y))):90===e?(c.alignment===cw?(r=d.right+b.x,0===b.x&&n.x>q.x+c.rowIndent&&(r=Math.min(r,Math.max(n.x,r-ew(c))))):c.alignment===bw?(r=d.left+b.x,0===b.x&&n.x<q.x-c.rowIndent&&(r=Math.max(r,Math.min(n.x,r+ew(c))))):r=c.Lq||c.Mq&&1===c.maxGenerationCount?d.left-c.Wa.x+b.x:d.x+d.width/2+b.x,k?(a.B(m,r,n.y),m++,a.B(m,r,d.bottom+g),m++,a.B(m,r,d.bottom+g+(b.y-h)/3),m++,a.B(m,r,d.bottom+g+2*(b.y-h)/3),m++,a.B(m,r,d.bottom+
g+(b.y-h)),m++,a.B(m,r,p.y)):(l&&(a.B(m,n.x,d.bottom+g/2),m++),a.B(m,r,d.bottom+g/2),m++,a.B(m,r,d.bottom+g+b.y-(l?h/2:h)),m++,l&&a.B(m,p.x,a.n(m-1).y))):180===e?(c.alignment===cw?(r=d.bottom+b.y,0===b.y&&n.y>q.y+c.rowIndent&&(r=Math.min(r,Math.max(n.y,r-ew(c))))):c.alignment===bw?(r=d.top+b.y,0===b.y&&n.y<q.y-c.rowIndent&&(r=Math.max(r,Math.min(n.y,r+ew(c))))):r=c.Lq||c.Mq&&1===c.maxGenerationCount?d.top-c.Wa.y+b.y:d.y+d.height/2+b.y,k?(a.B(m,n.x,r),m++,a.B(m,d.left-g,r),m++,a.B(m,d.left-g+(b.x+
h)/3,r),m++,a.B(m,d.left-g+2*(b.x+h)/3,r),m++,a.B(m,d.left-g+(b.x+h),r),m++,a.B(m,p.x,r)):(l&&(a.B(m,d.left-g/2,n.y),m++),a.B(m,d.left-g/2,r),m++,a.B(m,d.left-g+b.x+(l?h/2:h),r),m++,l&&a.B(m,a.n(m-1).x,p.y))):270===e?(c.alignment===cw?(r=d.right+b.x,0===b.x&&n.x>q.x+c.rowIndent&&(r=Math.min(r,Math.max(n.x,r-ew(c))))):c.alignment===bw?(r=d.left+b.x,0===b.x&&n.x<q.x-c.rowIndent&&(r=Math.max(r,Math.min(n.x,r+ew(c))))):r=c.Lq||c.Mq&&1===c.maxGenerationCount?d.left-c.Wa.x+b.x:d.x+d.width/2+b.x,k?(a.B(m,
r,n.y),m++,a.B(m,r,d.top-g),m++,a.B(m,r,d.top-g+(b.y+h)/3),m++,a.B(m,r,d.top-g+2*(b.y+h)/3),m++,a.B(m,r,d.top-g+(b.y+h)),m++,a.B(m,r,p.y)):(l&&(a.B(m,n.x,d.top-g/2),m++),a.B(m,r,d.top-g/2),m++,a.B(m,r,d.top-g+b.y+(l?h/2:h)),m++,l&&a.B(m,p.x,a.n(m-1).y))):D.k("Invalid angle "+e);a.Aj()}else e=c,g=d,v&&D.l(e,vv,cx,"adjustRouteForAngleChange:parent"),v&&D.l(g,vv,cx,"adjustRouteForAngleChange:child"),a=this.link,c=aw(e),c!==aw(g)&&(b=dw(e),d=e.sb,e=g.sb,0===c&&e.left-d.right<b+1||90===c&&e.top-d.bottom<
b+1||180===c&&d.left-e.right<b+1||270===c&&d.top-e.bottom<b+1||(a.yo(),e=a.gf===Nj,g=a.qc,h=Sv(this.fromVertex.alignment),a.zm(),0===c?(c=d.right+b/2,e?4===a.ta&&(b=a.n(3).y,a.ia(1,c-20,a.n(1).y),a.B(2,c-20,b),a.B(3,c,b),a.B(4,c+20,b),a.ia(5,a.n(5).x,b)):g?h?a.ia(3,a.n(2).x,a.n(4).y):6===a.ta&&(a.ia(2,c,a.n(2).y),a.ia(3,c,a.n(3).y)):4===a.ta?a.B(2,c,a.n(2).y):3===a.ta?a.ia(1,c,a.n(2).y):2===a.ta&&a.B(1,c,a.n(1).y)):90===c?(b=d.bottom+b/2,e?4===a.ta&&(c=a.n(3).x,a.ia(1,a.n(1).x,b-20),a.B(2,c,b-20),
a.B(3,c,b),a.B(4,c,b+20),a.ia(5,c,a.n(5).y)):g?h?a.ia(3,a.n(2).x,a.n(4).y):6===a.ta&&(a.ia(2,a.n(2).x,b),a.ia(3,a.n(3).x,b)):4===a.ta?a.B(2,a.n(2).x,b):3===a.ta?a.ia(1,a.n(2).x,b):2===a.ta&&a.B(1,a.n(1).x,b)):180===c?(c=d.left-b/2,e?4===a.ta&&(b=a.n(3).y,a.ia(1,c+20,a.n(1).y),a.B(2,c+20,b),a.B(3,c,b),a.B(4,c-20,b),a.ia(5,a.n(5).x,b)):g?h?a.ia(3,a.n(2).x,a.n(4).y):6===a.ta&&(a.ia(2,c,a.n(2).y),a.ia(3,c,a.n(3).y)):4===a.ta?a.B(2,c,a.n(2).y):3===a.ta?a.ia(1,c,a.n(2).y):2===a.ta&&a.B(1,c,a.n(1).y)):270===
c&&(b=d.top-b/2,e?4===a.ta&&(c=a.n(3).x,a.ia(1,a.n(1).x,b+20),a.B(2,c,b+20),a.B(3,c,b),a.B(4,c,b-20),a.ia(5,c,a.n(5).y)):g?h?a.ia(3,a.n(2).x,a.n(4).y):6===a.ta&&(a.ia(2,a.n(2).x,b),a.ia(3,a.n(3).x,b)):4===a.ta?a.B(2,a.n(2).x,b):3===a.ta?a.ia(1,a.n(2).x,b):2===a.ta&&a.B(1,a.n(1).x,b)),a.Aj()))}};D.defineProperty(cx,{nM:"relativePoint"},function(){return this.at},function(a){this.at.set(a)});function dx(){P.call(this);this.Ze=null}D.Sa(dx,P);
dx.prototype.cloneProtected=function(a){P.prototype.cloneProtected.call(this,a);a.element=this.Ze.cloneNode(!0)};dx.prototype.toString=function(){return"HTMLHost("+this.Ze.toString()+")#"+D.Fd(this)};
dx.prototype.Pk=function(a,b){var c=this.Ze;if(null!==c){var d=this.eb(gc);d.x-=this.$.width/2;d.y-=this.$.height/2;d.x-=this.$.x;d.y-=this.$.y;var d=b.TB(d),e=b.Dj;null===e||e.contains(c)||e.appendChild(c);e=this.transform;c.style.transform="matrix("+e.m11+","+e.m12+","+e.m21+","+e.m22+","+e.dx+","+e.dy+")";c.style.transformOrigin="0 0";e=d.y;c.style.left=d.x+"px";c.style.top=e+"px"}};
dx.prototype.ho=function(a,b,c,d){var e=this.Ea;isFinite(e.width)&&(a=e.width);isFinite(e.height)&&(b=e.height);var e=this.kf,g=this.hg;c=Math.max(c,g.width);d=Math.max(d,g.height);a=Math.min(e.width,a);b=Math.min(e.height,b);a=Math.max(c,a);b=Math.max(d,b);c=this.Ze;null!==c&&(b=c.getBoundingClientRect(),a=b.width,b=b.height);wb(this.$c,a,b);Go(this,0,0,a,b)};dx.prototype.yj=function(a,b,c,d){Lo(this,a,b,c,d)};D.w(dx,{Ga:"naturalBounds"},function(){return this.$c});
D.defineProperty(dx,{element:"element"},function(){return this.Ze},function(a){var b=this.Ze;b!==a&&(a instanceof HTMLElement||D.k("HTMLHost.element must be an instance of Element."),this.Ze=a,a.className="HTMLHost",this.i("element",b,a),this.qa())});aa.version="1.7.7";
window&&(window.module&&"object"===typeof window.module&&"object"===typeof window.module.exports?window.module.exports=aa:window.define&&"function"===typeof window.define&&window.define.amd?(window.go=aa,window.define(aa)):window.go=aa);"undefined"!==typeof module&&"object"===typeof module.exports&&(module.exports=aa); })(window);
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/release/go.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/release/go.js

Statements: 1.98% (598 / 30181)      Branches: 0% (0 / 25005)      Functions: 0% (0 / 4276)      Lines: 23.76% (480 / 2020)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057              2 1                       1                 1 1 1 1   1     1         1           1                       1         1                 1       1       1       1 1       1                   1           1   1 1       1 1       1   1 1 1 1       1         1                   1   1                   1 1   1                   1 1   1   1 1 1     1   1                         1 1 1 1 1 1 1 1   1   1 1 1 1 1 1 1 1 1 1       1         1         1     1               1         1       1       1             1               1 1             1                   1 1               1       1   1 1                               1 1     1       1         1     1         1 1 1 1     1             1                                                                   1 1 1                           1                     1           1     1     1         1             1               1     1                                   1                                 1             1                 1                 1 1 1 1 1 1 1 1 1     1 1   1 1 1 1 1 1               1 1 1                           1   1 1 1                   1               1 1                   1         1                                       1             1 1     1     1 1 1 1   1   1 1       1           1           1     1   1               1   1   1             1                 1             1 1 1 1 1 1 1 1   1 1 1 1   1                 1     1 1                     1                       1     1         1     1 1 1 1       1   1 1     1   1       1 1 1 1       1 1   1 1   1 1   1       1   1     1 1           1 1                   1     1                             1   1 1                                                                       1     1             1 1 1 1 1       1 1 1   1 1 1 1       1                         1             1 1     1   1   1 1 1       1 1         1           1 1       1                     1 1   1           1 1   1 1                       1     1 1 1         1 1   1 1                 1         1                     1 1       1 1 1 1 1 1               1 1                       1 1                                     1                                 1 1 1                                                   1 1   1 1                                                                                             1                                     1 1 1             1     1       1                     1 1         1   1 1       1     1 1                           1     1     1                             1               1             1 1     1 1                       1                   1                                     1   1 1 1     1 1 1         1                     1 1 1 1 1 1 1 1                                                                                                                                                                                                                                               1 1               1     1           1 1       1   1 1 1 1       1                   1 1                   1 1     1 1       1   1 1   1                       1 1 1       1 1       1 1     1 1     1                                 1 1                                         1                   1   1         1                                                   1 1                   1 1 1 1     1 1 1 1 1         1 1   1     1   1 1 1 1   1   1         1 1 1           1 1             1 1 1       1         1                 1     1             1   1   1   1 1                     1   1                           1                   1 1 1 1     1 1 1   1 1                     1 1 1 1 1             1 1 1   1 1 1     1 1                     1 1 1                       1   1 1       1   1 1 1 1 1   1 1     1   1 1         1 1       1 1     1   1 1 1 1     1                                                   1               1 1 1   1         1   1 1 1 1 1 1 1   1                                 1             1     1   1 1 1 1 1 1 1         1   1       1       1 1                                                   1 1       1                 1            
/*
 * GoJS v1.7.7 JavaScript Library for HTML Diagrams
 * Northwoods Software, https://www.nwoods.com/
 * GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation.
 * Copyright (C) 1998-2017 by Northwoods Software Corporation.  All Rights Reserved.
 * THIS SOFTWARE IS LICENSED.  THE LICENSE AGREEMENT IS AT: https://gojs.net/1.7.7/doc/license.html.
 */
(function(window) { var g,da={};if(!window.document||void 0===window.document.createElement("canvas").getContext)throw window.console&&window.console.log("The HTML Canvas element is not supported in this browser,or this browser is in Compatibility mode."),Error("The HTML Canvas element is not supported in this browser,or this browser is in Compatibility mode.");if(!Object.defineProperty)throw Error("GoJS requires a newer version of JavaScript");
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return f.apply(a,e.concat(d.call(arguments)))}function c(){}var d=Array.prototype.slice,e=d.call(arguments,1),f=this;c.prototype=this.prototype;b.prototype=new c;return b});
(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(b){var c=(new Date).getTime(),f=Math.max(8,16-(c-a)),h=window.setTimeout(function(){b(c+f)},f);a=c+f;return h});window.cancelAnimationFrame||(window.cancelAnimationFrame=
function(a){window.clearTimeout(a)})})();da.Debug=null;
var w={jd:1,Qc:2,Zc:4,Yc:8,Dn:void 0!==window.navigator&&0<window.navigator.userAgent.indexOf("534.30")&&0<window.navigator.userAgent.indexOf("Android"),qI:void 0!==window.navigator&&0<window.navigator.userAgent.indexOf("MSIE 9.0"),gF:void 0!==window.navigator&&0<window.navigator.userAgent.indexOf("MSIE 10.0"),hF:void 0!==window.navigator&&0<window.navigator.userAgent.indexOf("Trident/7"),UK:void 0!==window.navigator&&0<window.navigator.userAgent.indexOf("Edge/"),Ek:void 0!==window.navigator&&void 0!==
window.navigator.platform&&0<=window.navigator.platform.toUpperCase().indexOf("MAC"),iF:void 0!==window.navigator&&void 0!==window.navigator.platform&&null!==window.navigator.platform.match(/(iPhone|iPod|iPad)/i),tE:function(a,b,c){var d=-1;return function(){var e=this,f=arguments;-1!==d&&w.clearTimeout(d);d=w.setTimeout(function(){d=-1;c||a.apply(e,f)},b);c&&!d&&a.apply(e,f)}},setTimeout:function(a,b){return window.setTimeout(a,b)},clearTimeout:function(a){window.clearTimeout(a)},createElement:function(a){return window.document.createElement(a)},
k:function(a){throw Error(a);},la:function(a,b){var c="The object is frozen, so its properties cannot be set: "+a.toString();void 0!==b&&(c+="  to value: "+b);w.k(c)},G:function(a,b,c,d){a instanceof b||(c=w.getTypeName(c),void 0!==d&&(c+="."+d),w.wd(a,b,c))},j:function(a,b,c,d){typeof a!==b&&(c=w.getTypeName(c),void 0!==d&&(c+="."+d),w.wd(a,b,c))},Ed:function(a,b,c){"number"===typeof a&&isFinite(a)||(b=w.getTypeName(b),void 0!==c&&(b+="."+c),w.k(b+" must be a real number type, and not NaN or Infinity: "+
a))},mb:function(a,b,c,d){a instanceof ea&&a.De===b||(c=w.getTypeName(c),void 0!==d&&(c+="."+d),w.wd(a,"a constant of class "+w.hf(b),c))},tK:function(a,b){"string"===typeof a?fa(a)||w.k('Color "'+a+'" is not a valid color string for '+b):a instanceof ga||w.k("Value for "+b+" must be a color string or a Brush, not "+a)},wd:function(a,b,c,d){b=w.getTypeName(b);c=w.getTypeName(c);void 0!==d&&(c+="."+d);"string"===typeof a?w.k(c+" value is not an instance of "+b+': "'+a+'"'):w.k(c+" value is not an instance of "+
b+": "+a)},Ea:function(a,b,c,d){c=w.getTypeName(c);void 0!==d&&(c+="."+d);w.k(c+" is not in the range "+b+": "+a)},hd:function(a){w.k(w.hf(a)+" constructor cannot take any arguments.")},Na:function(a){w.k("Collection was modified during iteration: "+a.toString()+"\n  Perhaps you should iterate over a copy of the collection,\n  or you could collect items to be removed from the collection after the iteration.")},Ej:function(a,b){w.k("No property to set for this enum value: "+b+" on "+a.toString())},
trace:function(a){window.console&&window.console.log(a)},$w:{},Gt:function(a,b){!0!==w.$w[a]&&(w.$w[a]=!0,window.console&&window.console.log(a+" is deprecated in "+b+", see the GoJS change log for more information."))},Qa:function(a){return"object"===typeof a&&null!==a},isArray:function(a){return Array.isArray(a)||a instanceof NodeList||a instanceof HTMLCollection},rI:function(a){return Array.isArray(a)},Qz:function(a,b,c){w.isArray(a)||w.wd(a,"Array or NodeList or HTMLCollection",b,c)},Ya:function(a){return a.length},
Hl:function(a){return Array.prototype.slice.call(a)},Da:function(a,b){Array.isArray(a);return a[b]},jE:function(a,b,c){Array.isArray(a)?a[b]=c:w.k("Cannot replace an object in an HTMLCollection or NodeList at "+b)},El:function(a,b){if(Array.isArray(a))return a.indexOf(b);for(var c=a.length,d=0;d<c;d++)if(a[d]===b)return d;return-1},qh:function(a,b,c){Array.isArray(a)?b>=a.length?a.push(c):a.splice(b,0,c):w.k("Cannot insert an object into an HTMLCollection or NodeList: "+c+" at "+b)},Fg:function(a,
b){Array.isArray(a)?b>=a.length?a.pop():a.splice(b,1):w.k("Cannot remove an object from an HTMLCollection or NodeList at "+b)},ty:[],K:function(){var a=w.ty.pop();return void 0===a?new z:a},xb:function(a,b){var c=w.ty.pop();if(void 0===c)return new z(a,b);c.x=a;c.y=b;return c},v:function(a){w.ty.push(a)},FB:[],im:function(){var a=w.FB.pop();return void 0===a?new ha:a},zk:function(a){w.FB.push(a)},uy:[],Df:function(){var a=w.uy.pop();return void 0===a?new A:a},Vg:function(a,b,c,d){var e=w.uy.pop();
if(void 0===e)return new A(a,b,c,d);e.x=a;e.y=b;e.width=c;e.height=d;return e},Gb:function(a){w.uy.push(a)},GB:[],Ef:function(){var a=w.GB.pop();return void 0===a?new ia:a},ue:function(a){w.GB.push(a)},vy:null,s:function(){var a=w.vy;return null!==a?(w.vy=null,a):new ja},q:function(a){a.reset();w.vy=a},EB:[],lb:function(){var a=w.EB.pop();return void 0===a?[]:a},va:function(a){a.length=0;w.EB.push(a)},fo:Object.freeze([]),mm:1,lc:function(a){a.__gohashid=w.mm++},Yp:function(a){var b=a.__gohashid;
void 0===b&&(b=w.mm++,a.__gohashid=b);return b},Jd:function(a){return a.__gohashid},fa:function(a,b){b.Ey=a;da[a]=b},La:function(a,b){function c(){}c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a},ji:function(a){a.PG=!0},defineProperty:function(a,b,c,d,e){w.j(a,"function","Util.defineProperty:classfunc");w.j(b,"object","Util.defineProperty:propobj");w.j(c,"function","Util.defineProperty:getter");w.j(d,"function","Util.defineProperty:setter");for(var f in b){b=b[f];c={get:c,set:d,
enumerable:!0};if(void 0!==e)for(var h in e)c[h]=e[h];Object.defineProperty(a.prototype,f,c);e=Object.getOwnPropertyDescriptor(a.prototype,f);b&&e&&Object.defineProperty(a.prototype,b,e);break}},TJ:!1,u:function(a,b,c,d){w.j(a,"function","Util.defineReadOnlyProperty:classfunc");w.j(b,"object","Util.defineReadOnlyProperty:propobj");w.j(c,"function","Util.defineReadOnlyProperty:getter");for(var e in b){var f=b[e];b={get:c,set:function(a){w.k('The property "'+f+'" is read-only and cannot be set to '+
a)},enumerable:!0};if(void 0!==d)for(var h in d)b[h]=d[h];Object.defineProperty(a.prototype,e,b);d=Object.getOwnPropertyDescriptor(a.prototype,e);f&&d&&Object.defineProperty(a.prototype,f,d);break}},$d:function(a,b){for(var c in b)b[c]=!0;a.prototype.LG=b},getTypeName:function(a){return void 0===a?"":"string"===typeof a?a:"function"===typeof a?w.hf(a):null===a?"*":""},hf:function(a){if("function"===typeof a){if(a.Ey)return a.Ey;if(a.name)return a.name;var b=a.toString(),c=b.indexOf("("),b=b.substring(9,
c).trim();if(""!==b)return a.Ey=b}else if("object"===typeof a&&a.constructor)return w.hf(a.constructor);return typeof a},p:function(a,b,c){w.j(a,"function","Util.defineEnumValue:classfunc");w.j(b,"string","Util.defineEnumValue:name");w.j(c,"number","Util.defineEnumValue:num");c=new ea(a,b,c);Object.freeze(c);a[b]=c;var d=a.Ru;d instanceof ka||(d=new ka("string",ea),a.Ru=d);d.add(b,c);return c},rb:function(a,b){if(!a||!b)return null;var c=void 0;try{"function"===typeof b?c=b(a):"function"===typeof a.getAttribute?
(c=a.getAttribute(b),null===c&&(c=void 0)):c=a[b]}catch(d){}return c},Ma:function(a,b,c){if(a&&b)try{"function"===typeof b?b(a,c):"function"===typeof a.setAttribute?a.setAttribute(b,c):a[b]=c}catch(d){}},Fu:function(a,b){w.j(a,"object","Setting properties requires Objects as arguments");w.j(b,"object","Setting properties requires Objects as arguments");var c=a instanceof C,d=a instanceof D,e;for(e in b){""===e&&w.k("Setting properties requires non-empty property names");var f=a,h=e;if(c||d){var k=
e.indexOf(".");if(0<k){var l=e.substring(0,k);if(c)f=a.sd(l);else if(f=a[l],void 0===f||null===f)f=a.ab[l];w.Qa(f)?h=e.substr(k+1):w.k("Unable to find object named: "+l+" in "+a.toString()+" when trying to set property: "+e)}}if("_"!==h[0]&&!w.YE(f,h))if(d&&"ModelChanged"===h){a.aH(b[h]);continue}else if(d&&"Changed"===h){a.fn(b[h]);continue}else if(d&&w.YE(a.ab,h))f=a.ab;else if(d&&oa(a,h)){a.Lz(h,b[h]);continue}else if(a instanceof F&&"Changed"===h){a.fn(b[h]);continue}else w.k('Trying to set undefined property "'+
h+'" on object: '+f.toString());f[h]=b[e];"_"===h[0]&&f instanceof G&&f.YG(h)}},YE:function(a,b){if(a.hasOwnProperty(b))return!0;for(var c=Object.getPrototypeOf(a);c&&c!==Function;){if(c.hasOwnProperty(b))return!0;var d=c.LG;if(d&&d[b])return!0;c=Object.getPrototypeOf(c)}return!1},dJ:function(a){for(var b=[],c=0;256>c;c++)b[c]=c;for(var d=0,e=0,c=0;256>c;c++)d=(d+b[c]+119)%256,e=b[c],b[c]=b[d],b[d]=e;for(var d=c=0,f="",h=0;h<a.length;h++)c=(c+1)%256,d=(d+b[c])%256,e=b[c],b[c]=b[d],b[d]=e,f+=String.fromCharCode(a.charCodeAt(h)^
b[(b[c]+b[d])%256]);return f},eI:function(a){for(var b={},c=0;256>c;c++)b["0123456789abcdef".charAt(c>>4)+"0123456789abcdef".charAt(c&15)]=String.fromCharCode(c);a.length%2&&(a="0"+a);for(var d=[],e=0,c=0;c<a.length;c+=2)d[e++]=b[a.substr(c,2)];a=d.join("");return""===a?"0":a},Gg:function(a){return w.dJ(w.eI(a))},km:null,adym:"7da71ca0ad381e90",vfo:"2be641fdb4",nH:"@COLOR1",oH:"@COLOR2",uE:!1,Dt:null,Et:null};
w.km=function(){var a=window.document.createElement("canvas"),b=a.getContext("2d");b[w.Gg("7ca11abfd022028846")]=w.Gg("398c3597c01238");for(var c=["5da73c80a3330d854f9e5e671d6633","32ab5ff3b26f42dc0ed90f22422913b54ae6247590da4bb21c324ba3a84e385776","54a702f3e53909c447824c6706603faf4cfb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387","74bf19bce72555874c86"],d=1;5>d;d++)b[w.Gg("7ca11abfd7330390")](w.Gg(c[d-1]),10,15*d+0);b[w.Gg("7ca11abfd022028846")]=w.Gg("39f046ebb36e4b");for(d=1;5>d;d++)b[w.Gg("7ca11abfd7330390")](w.Gg(c[d-
1]),10,15*d+0);if(4!==c.length||"5"!==c[0][0]||"7"!==c[3][0])w.p=function(a,b){var c=new ea(a,b,2);Object.freeze(c);a[b]=c;var d=a.Ru;d instanceof ka||(d=new ka("string",ea),a.Ru=d);d.add(b,c);return c};return a}();function ea(a,b,c){w.lc(this);this.TB=a;this.Qb=b;this.TG=c}w.fa("EnumValue",ea);ea.prototype.toString=function(){return w.hf(this.TB)+"."+this.Qb};w.u(ea,{De:"classType"},function(){return this.TB});w.u(ea,{name:"name"},function(){return this.Qb});w.u(ea,{value:"value"},function(){return this.TG});
var pa;ea.findName=pa=function(a,b){if(void 0===b||null===b||""===b)return null;w.j(a,"function","findName:classfunc");w.j(b,"string","EnumValue.findName:name");var c=a.Ru;return c instanceof ka?c.ka(b):null};function ra(){this.RB=[]}ra.prototype.toString=function(){return this.RB.join("")};ra.prototype.add=function(a){""!==a&&this.RB.push(a)};function sa(){}
function ta(a){void 0===a&&(a=42);this.seed=a;this.oy=48271;this.Qu=2147483647;this.DB=this.Qu/this.oy;this.AG=this.Qu%this.oy;this.zG=1/this.Qu;this.random()}ta.prototype.random=function(){var a=this.seed%this.DB*this.oy-this.seed/this.DB*this.AG;this.seed=0<a?a:a+this.Qu;return this.seed*this.zG};function ua(){}w.u(ua,{i:"iterator"},function(){return this});ua.prototype.reset=ua.prototype.reset=function(){};ua.prototype.next=ua.prototype.next=function(){return!1};ua.prototype.hasNext=function(){return!1};
ua.prototype.first=ua.prototype.first=function(){return null};ua.prototype.any=function(){return!1};ua.prototype.all=function(){return!0};ua.prototype.each=function(){return this};ua.prototype.map=function(){return this};ua.prototype.filter=function(){return this};ua.prototype.concat=function(a){return a.i};w.u(ua,{count:"count"},function(){return 0});ua.prototype.Gf=function(){};ua.prototype.toString=function(){return"EmptyIterator"};var va=new ua;function wa(a){this.key=-1;this.value=a}
w.$d(wa,{key:!0,value:!0});w.u(wa,{i:"iterator"},function(){return this});wa.prototype.reset=wa.prototype.reset=function(){this.key=-1};wa.prototype.next=wa.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};wa.prototype.hasNext=function(){return this.next()};wa.prototype.first=wa.prototype.first=function(){this.key=0;return this.value};wa.prototype.any=function(a){this.key=-1;return a(this.value)};wa.prototype.all=function(a){this.key=-1;return a(this.value)};
wa.prototype.each=function(a){this.key=-1;a(this.value);return this};wa.prototype.map=function(a){return new wa(a(this.value))};wa.prototype.filter=function(a){return a(this.value)?new wa(this.value):va};wa.prototype.concat=function(a){return new xa(this,a.i)};w.u(wa,{count:"count"},function(){return 1});wa.prototype.Gf=function(){this.value=null};wa.prototype.toString=function(){return"SingletonIterator("+this.value+")"};function xa(a,b){this.hl=a;this.il=b;this.Su=!1}w.$d(xa,{key:!0,value:!0});
w.u(xa,{i:"iterator"},function(){return this});xa.prototype.reset=xa.prototype.reset=function(){this.hl.reset();this.il.reset();this.Su=!1};xa.prototype.next=xa.prototype.next=function(){if(!this.Su){var a=this.hl;if(a.next())return this.key=a.key,this.value=a.value,!0;this.Su=!0}return this.Su&&(a=this.il,a.next())?(this.key=a.key,this.value=a.value,!0):!1};xa.prototype.hasNext=function(){return this.next()};
xa.prototype.first=xa.prototype.first=function(){this.reset();return this.next()?this.value:null};xa.prototype.any=function(a){return this.hl.any(a)||this.il.any(a)?!0:!1};xa.prototype.all=function(a){return this.hl.all(a)&&this.il.all(a)?!0:!1};xa.prototype.each=function(a){this.hl.each(a);this.il.each(a);return this};xa.prototype.map=function(a){return new xa(this.hl.map(a),this.il.map(a))};xa.prototype.filter=function(a){return new xa(this.hl.filter(a),this.il.filter(a))};
xa.prototype.concat=function(a){return new xa(this,a.i)};w.u(xa,{count:"count"},function(){return this.hl.count+this.il.count});xa.prototype.Gf=function(){this.value=this.key=null};xa.prototype.toString=function(){return"ConcatIterator()"};function ya(a){this.uc=a;this.Wh=null;a.Ob=null;this.Ta=a.C;this.tc=-1}w.$d(ya,{key:!0,value:!0});w.u(ya,{i:"iterator"},function(){return this});w.defineProperty(ya,{jq:"predicate"},function(){return this.Wh},function(a){this.Wh=a});
ya.prototype.reset=ya.prototype.reset=function(){var a=this.uc;a.Ob=null;this.Ta=a.C;this.tc=-1};ya.prototype.next=ya.prototype.next=function(){var a=this.uc;if(a.C!==this.Ta){if(0>this.key)return!1;w.Na(a)}var a=a.n,b=a.length,c=++this.tc,d=this.Wh;if(null!==d)for(;c<b;){var e=a[c];if(d(e))return this.key=this.tc=c,this.value=e,!0;c++}else{if(c<b)return this.key=c,this.value=a[c],!0;this.Gf()}return!1};ya.prototype.hasNext=function(){return this.next()};
ya.prototype.first=ya.prototype.first=function(){var a=this.uc;this.Ta=a.C;this.tc=0;var a=a.n,b=a.length,c=this.Wh;if(null!==c){for(var d=0;d<b;){var e=a[d];if(c(e))return this.key=this.tc=d,this.value=e;d++}return null}return 0<b?(e=a[0],this.key=0,this.value=e):null};ya.prototype.any=function(a){var b=this.uc;b.Ob=null;var c=b.C;this.tc=-1;for(var d=b.n,e=d.length,f=this.Wh,h=0;h<e;h++){var k=d[h];if(null===f||f(k)){if(a(k))return!0;b.C!==c&&w.Na(b)}}return!1};
ya.prototype.all=function(a){var b=this.uc;b.Ob=null;var c=b.C;this.tc=-1;for(var d=b.n,e=d.length,f=this.Wh,h=0;h<e;h++){var k=d[h];if(null===f||f(k)){if(!a(k))return!1;b.C!==c&&w.Na(b)}}return!0};ya.prototype.each=function(a){var b=this.uc;b.Ob=null;var c=b.C;this.tc=-1;for(var d=b.n,e=d.length,f=this.Wh,h=0;h<e;h++){var k=d[h];if(null===f||f(k))a(k),b.C!==c&&w.Na(b)}return this};
ya.prototype.map=function(a){var b=this.uc;b.Ob=null;var c=b.C;this.tc=-1;for(var d=[],e=b.n,f=e.length,h=this.Wh,k=0;k<f;k++){var l=e[k];if(null===h||h(l))d.push(a(l)),b.C!==c&&w.Na(b)}a=new I;a.n=d;a.Fc();return a.i};ya.prototype.filter=function(a){var b=this.uc;b.Ob=null;var c=b.C;this.tc=-1;for(var d=[],e=b.n,f=e.length,h=this.Wh,k=0;k<f;k++){var l=e[k];if(null===h||h(l))a(l)&&d.push(l),b.C!==c&&w.Na(b)}a=new I(b.ma);a.n=d;a.Fc();return a.i};
ya.prototype.concat=function(a){this.uc.Ob=null;return new xa(this,a.i)};w.u(ya,{count:"count"},function(){var a=this.Wh;if(null!==a){for(var b=0,c=this.uc.n,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.uc.n.length});ya.prototype.Gf=function(){this.key=-1;this.value=null;this.Ta=-1;this.Wh=null;this.uc.Ob=this};ya.prototype.toString=function(){return"ListIterator@"+this.tc+"/"+this.uc.count};function Aa(a){this.uc=a;a.Li=null;this.Ta=a.C;this.tc=a.n.length}w.$d(Aa,{key:!0,value:!0});
w.u(Aa,{i:"iterator"},function(){return this});Aa.prototype.reset=Aa.prototype.reset=function(){var a=this.uc;a.Li=null;this.Ta=a.C;this.tc=a.n.length};Aa.prototype.next=Aa.prototype.next=function(){var a=this.uc;if(a.C!==this.Ta){if(0>this.key)return!1;w.Na(a)}var b=--this.tc;if(0<=b)return this.key=b,this.value=a.n[b],!0;this.Gf();return!1};Aa.prototype.hasNext=function(){return this.next()};
Aa.prototype.first=Aa.prototype.first=function(){var a=this.uc;this.Ta=a.C;var b=a.n;this.tc=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};Aa.prototype.any=function(a){var b=this.uc;b.Li=null;var c=b.C,d=b.n,e=d.length;this.tc=e;for(e-=1;0<=e;e--){if(a(d[e]))return!0;b.C!==c&&w.Na(b)}return!1};Aa.prototype.all=function(a){var b=this.uc;b.Li=null;var c=b.C,d=b.n,e=d.length;this.tc=e;for(e-=1;0<=e;e--){if(!a(d[e]))return!1;b.C!==c&&w.Na(b)}return!0};
Aa.prototype.each=function(a){var b=this.uc;b.Li=null;var c=b.C,d=b.n,e=d.length;this.tc=e;for(e-=1;0<=e;e--)a(d[e]),b.C!==c&&w.Na(b);return this};Aa.prototype.map=function(a){var b=this.uc;b.Li=null;var c=b.C,d=[],e=b.n,f=e.length;this.tc=f;for(f-=1;0<=f;f--)d.push(a(e[f])),b.C!==c&&w.Na(b);a=new I;a.n=d;a.Fc();return a.i};
Aa.prototype.filter=function(a){var b=this.uc;b.Li=null;var c=b.C,d=[],e=b.n,f=e.length;this.tc=f;for(f-=1;0<=f;f--){var h=e[f];a(h)&&d.push(h);b.C!==c&&w.Na(b)}a=new I(b.ma);a.n=d;a.Fc();return a.i};Aa.prototype.concat=function(a){this.uc.Li=null;return new xa(this,a.i)};w.u(Aa,{count:"count"},function(){return this.uc.n.length});Aa.prototype.Gf=function(){this.key=-1;this.value=null;this.Ta=-1;this.uc.Li=this};
Aa.prototype.toString=function(){return"ListIteratorBackwards("+this.tc+"/"+this.uc.count+")"};
function I(a){w.lc(this);this.Q=!1;this.n=[];this.C=0;this.Li=this.Ob=null;void 0===a||null===a?this.ma=null:"string"===typeof a?"object"===a||"string"===a||"number"===a||"boolean"===a||"function"===a?this.ma=a:w.Ea(a,"the string 'object', 'number', 'string', 'boolean', or 'function'","List constructor: type"):"function"===typeof a?this.ma=a===Object?"object":a===String?"string":a===Number?"number":a===Boolean?"boolean":a===Function?"function":a:w.Ea(a,"null, a primitive type name, or a class type",
"List constructor: type")}w.fa("List",I);I.prototype.Fc=function(){var a=this.C;a++;999999999<a&&(a=0);this.C=a};I.prototype.freeze=I.prototype.freeze=function(){this.Q=!0;return this};I.prototype.thaw=I.prototype.Ra=function(){this.Q=!1;return this};I.prototype.toString=function(){return"List("+w.getTypeName(this.ma)+")#"+w.Jd(this)};I.prototype.add=I.prototype.add=function(a){null!==a&&(this.Q&&w.la(this,a),this.n.push(a),this.Fc())};I.prototype.push=I.prototype.push=function(a){this.add(a)};
I.prototype.addAll=I.prototype.Hc=function(a){if(null===a)return this;this.Q&&w.la(this);var b=this.n;if(w.isArray(a))for(var c=w.Ya(a),d=0;d<c;d++){var e=w.Da(a,d);b.push(e)}else for(a=a.i;a.next();)e=a.value,b.push(e);this.Fc();return this};I.prototype.clear=I.prototype.clear=function(){this.Q&&w.la(this);this.n.length=0;this.Fc()};I.prototype.contains=I.prototype.contains=function(a){return null===a?!1:-1!==this.n.indexOf(a)};I.prototype.has=I.prototype.has=function(a){return this.contains(a)};
I.prototype.indexOf=I.prototype.indexOf=function(a){return null===a?-1:this.n.indexOf(a)};I.prototype.elt=I.prototype.da=function(a){var b=this.n;(0>a||a>=b.length)&&w.Ea(a,"0 <= i < length",I,"elt:i");return b[a]};I.prototype.get=I.prototype.get=function(a){return this.da(a)};I.prototype.setElt=I.prototype.fg=function(a,b){var c=this.n;(0>a||a>=c.length)&&w.Ea(a,"0 <= i < length",I,"setElt:i");this.Q&&w.la(this,a);c[a]=b};I.prototype.set=I.prototype.set=function(a,b){this.fg(a,b)};
I.prototype.first=I.prototype.first=function(){var a=this.n;return 0===a.length?null:a[0]};I.prototype.last=I.prototype.ee=function(){var a=this.n,b=a.length;return 0<b?a[b-1]:null};I.prototype.pop=I.prototype.pop=function(){this.Q&&w.la(this);var a=this.n;return 0<a.length?a.pop():null};I.prototype.any=function(a){for(var b=this.n,c=this.C,d=b.length,e=0;e<d;e++){if(a(b[e]))return!0;this.C!==c&&w.Na(this)}return!1};
I.prototype.all=function(a){for(var b=this.n,c=this.C,d=b.length,e=0;e<d;e++){if(!a(b[e]))return!1;this.C!==c&&w.Na(this)}return!0};I.prototype.each=function(a){for(var b=this.n,c=this.C,d=b.length,e=0;e<d;e++)a(b[e]),this.C!==c&&w.Na(this);return this};I.prototype.map=function(a){for(var b=new I,c=[],d=this.n,e=this.C,f=d.length,h=0;h<f;h++)c.push(a(d[h])),this.C!==e&&w.Na(this);b.n=c;b.Fc();return b};
I.prototype.filter=function(a){for(var b=new I(this.ma),c=[],d=this.n,e=this.C,f=d.length,h=0;h<f;h++){var k=d[h];a(k)&&c.push(k);this.C!==e&&w.Na(this)}b.n=c;b.Fc();return b};I.prototype.concat=function(a){return this.copy().Hc(a)};I.prototype.insertAt=I.prototype.Ld=function(a,b){0>a&&w.Ea(a,">= 0",I,"insertAt:i");this.Q&&w.la(this,a);var c=this.n;a>=c.length?c.push(b):c.splice(a,0,b);this.Fc();return!0};
I.prototype.remove=I.prototype.remove=function(a){if(null===a)return!1;this.Q&&w.la(this,a);var b=this.n;a=b.indexOf(a);if(-1===a)return!1;a===b.length-1?b.pop():b.splice(a,1);this.Fc();return!0};I.prototype["delete"]=I.prototype.delete=function(a){return this.remove(a)};I.prototype.removeAt=I.prototype.Xc=function(a){var b=this.n;(0>a||a>=b.length)&&w.Ea(a,"0 <= i < length",I,"removeAt:i");this.Q&&w.la(this,a);a===b.length-1?b.pop():b.splice(a,1);this.Fc()};
I.prototype.removeRange=I.prototype.removeRange=function(a,b){var c=this.n,d=c.length;if(0>a)a=0;else if(a>=d)return this;if(0>b)return this;b>=d&&(b=d-1);if(a>b)return this;this.Q&&w.la(this);for(var e=a,f=b+1;f<d;)c[e++]=c[f++];c.length=d-(b-a+1);this.Fc();return this};I.prototype.copy=function(){var a=new I(this.ma),b=this.n;0<b.length&&(a.n=Array.prototype.slice.call(b));return a};I.prototype.toArray=I.prototype.dc=function(){for(var a=this.n,b=this.count,c=Array(b),d=0;d<b;d++)c[d]=a[d];return c};
I.prototype.toSet=I.prototype.oG=function(){for(var a=new J(this.ma),b=this.n,c=this.count,d=0;d<c;d++)a.add(b[d]);return a};I.prototype.sort=I.prototype.sort=function(a){this.Q&&w.la(this);this.n.sort(a);this.Fc();return this};
I.prototype.sortRange=I.prototype.xq=function(a,b,c){var d=this.n,e=d.length;void 0===b&&(b=0);void 0===c&&(c=e);this.Q&&w.la(this);var f=c-b;if(1>=f)return this;(0>b||b>=e-1)&&w.Ea(b,"0 <= from < length",I,"sortRange:from");if(2===f)return c=d[b],e=d[b+1],0<a(c,e)&&(d[b]=e,d[b+1]=c,this.Fc()),this;if(0===b)if(c>=e)d.sort(a);else for(f=d.slice(0,c),f.sort(a),a=0;a<c;a++)d[a]=f[a];else if(c>=e)for(f=d.slice(b),f.sort(a),a=b;a<e;a++)d[a]=f[a-b];else for(f=d.slice(b,c),f.sort(a),a=b;a<c;a++)d[a]=f[a-
b];this.Fc();return this};I.prototype.reverse=I.prototype.reverse=function(){this.Q&&w.la(this);this.n.reverse();this.Fc();return this};w.u(I,{count:"count"},function(){return this.n.length});w.u(I,{size:"size"},function(){return this.n.length});w.u(I,{length:"length"},function(){return this.n.length});w.u(I,{i:"iterator"},function(){if(0>=this.n.length)return va;var a=this.Ob;return null!==a?(a.reset(),a):new ya(this)});
w.u(I,{Gn:"iteratorBackwards"},function(){if(0>=this.n.length)return va;var a=this.Li;return null!==a?(a.reset(),a):new Aa(this)});function Ba(a){this.Yh=a;a.Ob=null;this.Ta=a.C;this.Va=null}w.$d(Ba,{key:!0,value:!0});w.u(Ba,{i:"iterator"},function(){return this});Ba.prototype.reset=Ba.prototype.reset=function(){var a=this.Yh;a.Ob=null;this.Ta=a.C;this.Va=null};
Ba.prototype.next=Ba.prototype.next=function(){var a=this.Yh;if(a.C!==this.Ta){if(null===this.key)return!1;w.Na(a)}var b=this.Va,b=null===b?a.Ca:b.Xa;if(null!==b)return this.Va=b,this.value=b.value,this.key=b.key,!0;this.Gf();return!1};Ba.prototype.hasNext=function(){return this.next()};Ba.prototype.first=Ba.prototype.first=function(){var a=this.Yh;this.Ta=a.C;a=a.Ca;if(null!==a){this.Va=a;var b=a.value;this.key=a.key;return this.value=b}return null};
Ba.prototype.any=function(a){var b=this.Yh;b.Ob=null;var c=b.C;this.Va=null;for(var d=b.Ca;null!==d;){if(a(d.value))return!0;b.C!==c&&w.Na(b);d=d.Xa}return!1};Ba.prototype.all=function(a){var b=this.Yh;b.Ob=null;var c=b.C;this.Va=null;for(var d=b.Ca;null!==d;){if(!a(d.value))return!1;b.C!==c&&w.Na(b);d=d.Xa}return!0};Ba.prototype.each=function(a){var b=this.Yh;b.Ob=null;var c=b.C;this.Va=null;for(var d=b.Ca;null!==d;)a(d.value),b.C!==c&&w.Na(b),d=d.Xa;return this};
Ba.prototype.map=function(a){var b=this.Yh;b.Ob=null;for(var c=new I,d=b.C,e=b.Ca;null!==e;)c.add(a(e.value)),b.C!==d&&w.Na(b),e=e.Xa;return c.i};Ba.prototype.filter=function(a){var b=this.Yh;b.Ob=null;for(var c=new I(b.ma),d=b.C,e=b.Ca;null!==e;){var f=e.value;a(f)&&c.add(f);b.C!==d&&w.Na(b);e=e.Xa}return c.i};Ba.prototype.concat=function(a){this.Yh.Ob=null;return new xa(this,a.i)};w.u(Ba,{count:"count"},function(){return this.Yh.ld});
Ba.prototype.Gf=function(){this.value=this.key=null;this.Ta=-1;this.Yh.Ob=this};Ba.prototype.toString=function(){return null!==this.Va?"SetIterator@"+this.Va.value:"SetIterator"};
function J(a){w.lc(this);this.Q=!1;void 0===a||null===a?this.ma=null:"string"===typeof a?"object"===a||"string"===a||"number"===a?this.ma=a:w.Ea(a,"the string 'object', 'number' or 'string'","Set constructor: type"):"function"===typeof a?this.ma=a===Object?"object":a===String?"string":a===Number?"number":a:w.Ea(a,"null, a primitive type name, or a class type","Set constructor: type");this.md={};this.ld=0;this.Ob=null;this.C=0;this.Rh=this.Ca=null}w.fa("Set",J);
J.prototype.Fc=function(){var a=this.C;a++;999999999<a&&(a=0);this.C=a};J.prototype.freeze=J.prototype.freeze=function(){this.Q=!0;return this};J.prototype.thaw=J.prototype.Ra=function(){this.Q=!1;return this};J.prototype.toString=function(){return"Set("+w.getTypeName(this.ma)+")#"+w.Jd(this)};
J.prototype.add=J.prototype.add=function(a){if(null===a)return!1;this.Q&&w.la(this,a);var b=a;w.Qa(a)&&(b=w.Yp(a));return void 0===this.md[b]?(this.ld++,a=new Ca(a,a),this.md[b]=a,b=this.Rh,null===b?this.Ca=a:(a.hp=b,b.Xa=a),this.Rh=a,this.Fc(),!0):!1};J.prototype.addAll=J.prototype.Hc=function(a){if(null===a)return this;this.Q&&w.la(this);if(w.isArray(a))for(var b=w.Ya(a),c=0;c<b;c++)this.add(w.Da(a,c));else for(a=a.i;a.next();)this.add(a.value);return this};
J.prototype.contains=J.prototype.contains=function(a){if(null===a)return!1;var b=a;return w.Qa(a)&&(b=w.Jd(a),void 0===b)?!1:void 0!==this.md[b]};J.prototype.has=J.prototype.has=function(a){return this.contains(a)};J.prototype.containsAll=function(a){if(null===a)return!0;for(a=a.i;a.next();)if(!this.contains(a.value))return!1;return!0};J.prototype.containsAny=function(a){if(null===a)return!0;for(a=a.i;a.next();)if(this.contains(a.value))return!0;return!1};
J.prototype.first=J.prototype.first=function(){var a=this.Ca;return null===a?null:a.value};J.prototype.any=function(a){for(var b=this.C,c=this.Ca;null!==c;){if(a(c.value))return!0;this.C!==b&&w.Na(this);c=c.Xa}return!1};J.prototype.all=function(a){for(var b=this.C,c=this.Ca;null!==c;){if(!a(c.value))return!1;this.C!==b&&w.Na(this);c=c.Xa}return!0};J.prototype.each=function(a){for(var b=this.C,c=this.Ca;null!==c;)a(c.value),this.C!==b&&w.Na(this),c=c.Xa;return this};
J.prototype.map=function(a){for(var b=new J,c=this.C,d=this.Ca;null!==d;)b.add(a(d.value)),this.C!==c&&w.Na(this),d=d.Xa;return b};J.prototype.filter=function(a){for(var b=new J(this.ma),c=this.C,d=this.Ca;null!==d;){var e=d.value;a(e)&&b.add(e);this.C!==c&&w.Na(this);d=d.Xa}return b};J.prototype.concat=function(a){return this.copy().Hc(a)};
J.prototype.remove=J.prototype.remove=function(a){if(null===a)return!1;this.Q&&w.la(this,a);var b=a;if(w.Qa(a)&&(b=w.Jd(a),void 0===b))return!1;a=this.md[b];if(void 0===a)return!1;var c=a.Xa,d=a.hp;null!==c&&(c.hp=d);null!==d&&(d.Xa=c);this.Ca===a&&(this.Ca=c);this.Rh===a&&(this.Rh=d);delete this.md[b];this.ld--;this.Fc();return!0};J.prototype["delete"]=J.prototype.delete=function(a){return this.remove(a)};
J.prototype.removeAll=J.prototype.Vx=function(a){if(null===a)return this;this.Q&&w.la(this);if(w.isArray(a))for(var b=w.Ya(a),c=0;c<b;c++)this.remove(w.Da(a,c));else for(a=a.i;a.next();)this.remove(a.value);return this};J.prototype.retainAll=function(a){if(null===a||0===this.count)return this;this.Q&&w.la(this);var b=new J(this.ma);b.Hc(a);a=[];for(var c=this.i;c.next();){var d=c.value;b.contains(d)||a.push(d)}this.Vx(a);return this};
J.prototype.clear=J.prototype.clear=function(){this.Q&&w.la(this);this.md={};this.ld=0;this.Rh=this.Ca=null;this.Fc()};J.prototype.copy=function(){var a=new J(this.ma),b=this.md,c;for(c in b)a.add(b[c].value);return a};J.prototype.toArray=J.prototype.dc=function(){var a=Array(this.ld),b=this.md,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};J.prototype.toList=function(){var a=new I(this.ma),b=this.md,c;for(c in b)a.add(b[c].value);return a};w.u(J,{count:"count"},function(){return this.ld});
w.u(J,{size:"size"},function(){return this.ld});w.u(J,{i:"iterator"},function(){if(0>=this.ld)return va;var a=this.Ob;return null!==a?(a.reset(),a):new Ba(this)});function Da(a){this.Fa=a;this.Ta=a.C;this.Va=null}w.$d(Da,{key:!0,value:!0});w.u(Da,{i:"iterator"},function(){return this});Da.prototype.reset=Da.prototype.reset=function(){this.Ta=this.Fa.C;this.Va=null};
Da.prototype.next=Da.prototype.next=function(){var a=this.Fa;if(a.C!==this.Ta){if(null===this.key)return!1;w.Na(a)}var b=this.Va,b=null===b?a.Ca:b.Xa;if(null!==b)return this.Va=b,this.value=this.key=a=b.key,!0;this.Gf();return!1};Da.prototype.hasNext=function(){return this.next()};Da.prototype.first=Da.prototype.first=function(){var a=this.Fa;this.Ta=a.C;a=a.Ca;return null!==a?(this.Va=a,this.value=this.key=a=a.key):null};
Da.prototype.any=function(a){var b=this.Fa,c=b.C;this.Va=null;for(var d=b.Ca;null!==d;){if(a(d.key))return!0;b.C!==c&&w.Na(b);d=d.Xa}return!1};Da.prototype.all=function(a){var b=this.Fa,c=b.C;this.Va=null;for(var d=b.Ca;null!==d;){if(!a(d.key))return!1;b.C!==c&&w.Na(b);d=d.Xa}return!0};Da.prototype.each=function(a){var b=this.Fa,c=b.C;this.Va=null;for(var d=b.Ca;null!==d;)a(d.key),b.C!==c&&w.Na(b),d=d.Xa;return this};
Da.prototype.map=function(a){var b=this.Fa,c=b.C;this.Va=null;for(var d=new I,e=b.Ca;null!==e;)d.add(a(e.key)),b.C!==c&&w.Na(b),e=e.Xa;return d.i};Da.prototype.filter=function(a){var b=this.Fa,c=b.C;this.Va=null;for(var d=new I(b.Qh),e=b.Ca;null!==e;){var f=e.key;a(f)&&d.add(f);b.C!==c&&w.Na(b);e=e.Xa}return d.i};Da.prototype.concat=function(a){return new xa(this,a.i)};w.u(Da,{count:"count"},function(){return this.Fa.ld});Da.prototype.Gf=function(){this.value=this.key=null;this.Ta=-1};
Da.prototype.toString=function(){return null!==this.Va?"MapKeySetIterator@"+this.Va.value:"MapKeySetIterator"};function Ea(a){w.lc(this);this.Q=!0;this.Fa=a}w.La(Ea,J);Ea.prototype.freeze=function(){return this};Ea.prototype.Ra=function(){return this};Ea.prototype.toString=function(){return"MapKeySet("+this.Fa.toString()+")"};Ea.prototype.add=Ea.prototype.add=function(){w.k("This Set is read-only: "+this.toString());return!1};
Ea.prototype.set=Ea.prototype.set=function(){w.k("This Set is read-only: "+this.toString());return!1};Ea.prototype.contains=Ea.prototype.contains=function(a){return this.Fa.contains(a)};Ea.prototype.has=Ea.prototype.has=function(a){return this.contains(a)};Ea.prototype.remove=Ea.prototype.remove=function(){w.k("This Set is read-only: "+this.toString());return!1};Ea.prototype["delete"]=Ea.prototype.delete=function(){return this.remove()};
Ea.prototype.clear=Ea.prototype.clear=function(){w.k("This Set is read-only: "+this.toString())};Ea.prototype.first=Ea.prototype.first=function(){var a=this.Fa.Ca;return null!==a?a.key:null};Ea.prototype.any=function(a){for(var b=this.Fa.Ca;null!==b;){if(a(b.key))return!0;b=b.Xa}return!1};Ea.prototype.all=function(a){for(var b=this.Fa.Ca;null!==b;){if(!a(b.key))return!1;b=b.Xa}return!0};Ea.prototype.each=function(a){for(var b=this.Fa.Ca;null!==b;)a(b.key),b=b.Xa;return this};
Ea.prototype.map=function(a){for(var b=new J,c=this.Fa.Ca;null!==c;)b.add(a(c.key)),c=c.Xa;return b};Ea.prototype.filter=function(a){for(var b=new J(this.Fa.Qh),c=this.Fa.Ca;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.Xa}return b};Ea.prototype.concat=function(a){return this.oG().Hc(a)};Ea.prototype.copy=function(){return new Ea(this.Fa)};Ea.prototype.toSet=Ea.prototype.oG=function(){var a=new J(this.Fa.Qh),b=this.Fa.md,c;for(c in b)a.add(b[c].key);return a};
Ea.prototype.toArray=Ea.prototype.dc=function(){var a=this.Fa.md,b=Array(this.Fa.ld),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};Ea.prototype.toList=function(){var a=new I(this.Fa.Qh),b=this.Fa.md,c;for(c in b)a.add(b[c].key);return a};w.u(Ea,{count:"count"},function(){return this.Fa.ld});w.u(Ea,{size:"size"},function(){return this.Fa.ld});w.u(Ea,{i:"iterator"},function(){return 0>=this.Fa.ld?va:new Da(this.Fa)});function Fa(a){this.Fa=a;a.Mi=null;this.Ta=a.C;this.Va=null}w.$d(Fa,{key:!0,value:!0});
w.u(Fa,{i:"iterator"},function(){return this});Fa.prototype.reset=Fa.prototype.reset=function(){var a=this.Fa;a.Mi=null;this.Ta=a.C;this.Va=null};Fa.prototype.next=Fa.prototype.next=function(){var a=this.Fa;if(a.C!==this.Ta){if(null===this.key)return!1;w.Na(a)}var b=this.Va,b=null===b?a.Ca:b.Xa;if(null!==b)return this.Va=b,this.value=b.value,this.key=b.key,!0;this.Gf();return!1};Fa.prototype.hasNext=function(){return this.next()};
Fa.prototype.first=Fa.prototype.first=function(){var a=this.Fa;this.Ta=a.C;a=a.Ca;if(null!==a){this.Va=a;var b=a.value;this.key=a.key;return this.value=b}return null};Fa.prototype.any=function(a){var b=this.Fa;b.Mi=null;var c=b.C;this.Va=null;for(var d=b.Ca;null!==d;){if(a(d.value))return!0;b.C!==c&&w.Na(b);d=d.Xa}return!1};Fa.prototype.all=function(a){var b=this.Fa;b.Mi=null;var c=b.C;this.Va=null;for(var d=b.Ca;null!==d;){if(!a(d.value))return!1;b.C!==c&&w.Na(b);d=d.Xa}return!0};
Fa.prototype.each=function(a){var b=this.Fa;b.Mi=null;var c=b.C;this.Va=null;for(var d=b.Ca;null!==d;)a(d.value),b.C!==c&&w.Na(b),d=d.Xa;return this};Fa.prototype.map=function(a){var b=this.Fa;b.Mi=null;var c=b.C;this.Va=null;for(var d=new I,e=b.Ca;null!==e;)d.add(a(e.value)),b.C!==c&&w.Na(b),e=e.Xa;return d.i};Fa.prototype.filter=function(a){var b=this.Fa;b.Mi=null;var c=b.C;this.Va=null;for(var d=new I(b.Qh),e=b.Ca;null!==e;){var f=e.value;a(f)&&d.add(f);b.C!==c&&w.Na(b);e=e.Xa}return d.i};
Fa.prototype.concat=function(a){this.Fa.Mi=null;return new xa(this,a.i)};w.u(Fa,{count:"count"},function(){return this.Fa.ld});Fa.prototype.Gf=function(){this.value=this.key=null;this.Ta=-1;this.Fa.Mi=this};Fa.prototype.toString=function(){return null!==this.Va?"MapValueSetIterator@"+this.Va.value:"MapValueSetIterator"};function Ca(a,b){this.key=a;this.value=b;this.hp=this.Xa=null}w.$d(Ca,{key:!0,value:!0});Ca.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};
function Ga(a){this.Fa=a;a.Ob=null;this.Ta=a.C;this.Va=null}w.$d(Ga,{key:!0,value:!0});w.u(Ga,{i:"iterator"},function(){return this});Ga.prototype.reset=Ga.prototype.reset=function(){var a=this.Fa;a.Ob=null;this.Ta=a.C;this.Va=null};Ga.prototype.next=Ga.prototype.next=function(){var a=this.Fa;if(a.C!==this.Ta){if(null===this.key)return!1;w.Na(a)}var b=this.Va,b=null===b?a.Ca:b.Xa;if(null!==b)return this.Va=b,this.key=b.key,this.value=b.value,!0;this.Gf();return!1};Ga.prototype.hasNext=function(){return this.next()};
Ga.prototype.first=Ga.prototype.first=function(){var a=this.Fa;this.Ta=a.C;a=a.Ca;return null!==a?(this.Va=a,this.key=a.key,this.value=a.value,a):null};Ga.prototype.any=function(a){var b=this.Fa;b.Ob=null;var c=b.C;this.Va=null;for(var d=b.Ca;null!==d;){if(a(d))return!0;b.C!==c&&w.Na(b);d=d.Xa}return!1};Ga.prototype.all=function(a){var b=this.Fa;b.Ob=null;var c=b.C;this.Va=null;for(var d=b.Ca;null!==d;){if(!a(d))return!1;b.C!==c&&w.Na(b);d=d.Xa}return!0};
Ga.prototype.each=function(a){var b=this.Fa;b.Ob=null;var c=b.C;this.Va=null;for(var d=b.Ca;null!==d;)a(d),b.C!==c&&w.Na(b),d=d.Xa;return this};Ga.prototype.map=function(a){var b=this.Fa;b.Ob=null;var c=b.C;this.Va=null;for(var d=new I,e=b.Ca;null!==e;)d.add(a(e)),b.C!==c&&w.Na(b),e=e.Xa;return d.i};Ga.prototype.filter=function(a){var b=this.Fa;b.Ob=null;var c=b.C;this.Va=null;for(var d=new I,e=b.Ca;null!==e;)a(e)&&d.add(e),b.C!==c&&w.Na(b),e=e.Xa;return d.i};
Ga.prototype.concat=function(a){this.Fa.Ob=null;return new xa(this,a.i)};w.u(Ga,{count:"count"},function(){return this.Fa.ld});Ga.prototype.Gf=function(){this.value=this.key=null;this.Ta=-1;this.Fa.Ob=this};Ga.prototype.toString=function(){return null!==this.Va?"MapIterator@"+this.Va:"MapIterator"};
function ka(a,b){w.lc(this);this.Q=!1;void 0===a||null===a?this.Qh=null:"string"===typeof a?"object"===a||"string"===a||"number"===a?this.Qh=a:w.Ea(a,"the string 'object', 'number' or 'string'","Map constructor: keytype"):"function"===typeof a?this.Qh=a===Object?"object":a===String?"string":a===Number?"number":a:w.Ea(a,"null, a primitive type name, or a class type","Map constructor: keytype");void 0===b||null===b?this.qt=null:"string"===typeof b?"object"===b||"string"===b||"boolean"===b||"number"===
b||"function"===b?this.qt=b:w.Ea(b,"the string 'object', 'number', 'string', 'boolean', or 'function'","Map constructor: valtype"):"function"===typeof b?this.qt=b===Object?"object":b===String?"string":b===Number?"number":b===Boolean?"boolean":b===Function?"function":b:w.Ea(b,"null, a primitive type name, or a class type","Map constructor: valtype");this.md={};this.ld=0;this.Mi=this.Ob=null;this.C=0;this.Rh=this.Ca=null}w.fa("Map",ka);
ka.prototype.Fc=function(){var a=this.C;a++;999999999<a&&(a=0);this.C=a};ka.prototype.freeze=ka.prototype.freeze=function(){this.Q=!0;return this};ka.prototype.thaw=ka.prototype.Ra=function(){this.Q=!1;return this};ka.prototype.toString=function(){return"Map("+w.getTypeName(this.Qh)+","+w.getTypeName(this.qt)+")#"+w.Jd(this)};
ka.prototype.add=ka.prototype.add=function(a,b){this.Q&&w.la(this,a);var c=a;w.Qa(a)&&(c=w.Yp(a));var d=this.md[c];if(void 0===d)return this.ld++,d=new Ca(a,b),this.md[c]=d,c=this.Rh,null===c?this.Ca=d:(d.hp=c,c.Xa=d),this.Rh=d,this.Fc(),!0;d.value=b;return!1};ka.prototype.set=ka.prototype.set=function(a,b){return this.add(a,b)};
ka.prototype.addAll=ka.prototype.Hc=function(a){if(null===a)return this;if(w.isArray(a))for(var b=w.Ya(a),c=0;c<b;c++){var d=w.Da(a,c);this.add(d.key,d.value)}else for(a=a.i;a.next();)this.add(a.key,a.value);return this};ka.prototype.first=ka.prototype.first=function(){return this.Ca};ka.prototype.any=function(a){for(var b=this.C,c=this.Ca;null!==c;){if(a(c))return!0;this.C!==b&&w.Na(this);c=c.Xa}return!1};
ka.prototype.all=function(a){for(var b=this.C,c=this.Ca;null!==c;){if(!a(c))return!1;this.C!==b&&w.Na(this);c=c.Xa}return!0};ka.prototype.each=function(a){for(var b=this.C,c=this.Ca;null!==c;)a(c),this.C!==b&&w.Na(this),c=c.Xa;return this};ka.prototype.map=function(a){for(var b=new ka(this.Qh),c=this.C,d=this.Ca;null!==d;)b.add(d.key,a(d)),this.C!==c&&w.Na(this),d=d.Xa;return b};
ka.prototype.filter=function(a){for(var b=new ka(this.Qh,this.qt),c=this.C,d=this.Ca;null!==d;)a(d)&&b.add(d.key,d.value),this.C!==c&&w.Na(this),d=d.Xa;return b};ka.prototype.concat=function(a){return this.copy().Hc(a)};ka.prototype.contains=ka.prototype.contains=function(a){var b=a;return w.Qa(a)&&(b=w.Jd(a),void 0===b)?!1:void 0!==this.md[b]};ka.prototype.has=ka.prototype.has=function(a){return this.contains(a)};
ka.prototype.getValue=ka.prototype.ka=function(a){var b=a;if(w.Qa(a)&&(b=w.Jd(a),void 0===b))return null;a=this.md[b];return void 0===a?null:a.value};ka.prototype.get=ka.prototype.get=function(a){return this.ka(a)};
ka.prototype.remove=ka.prototype.remove=function(a){if(null===a)return!1;this.Q&&w.la(this,a);var b=a;if(w.Qa(a)&&(b=w.Jd(a),void 0===b))return!1;a=this.md[b];if(void 0===a)return!1;var c=a.Xa,d=a.hp;null!==c&&(c.hp=d);null!==d&&(d.Xa=c);this.Ca===a&&(this.Ca=c);this.Rh===a&&(this.Rh=d);delete this.md[b];this.ld--;this.Fc();return!0};ka.prototype["delete"]=ka.prototype.delete=function(a){return this.remove(a)};
ka.prototype.clear=ka.prototype.clear=function(){this.Q&&w.la(this);this.md={};this.ld=0;this.Rh=this.Ca=null;this.Fc()};ka.prototype.copy=function(){var a=new ka(this.Qh,this.qt),b=this.md,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};ka.prototype.toArray=ka.prototype.dc=function(){var a=this.md,b=Array(this.ld),c=0,d;for(d in a){var e=a[d];b[c]=new Ca(e.key,e.value);c++}return b};ka.prototype.toKeySet=ka.prototype.Fj=function(){return new Ea(this)};w.u(ka,{count:"count"},function(){return this.ld});
w.u(ka,{size:"size"},function(){return this.ld});w.u(ka,{i:"iterator"},function(){if(0>=this.count)return va;var a=this.Ob;return null!==a?(a.reset(),a):new Ga(this)});w.u(ka,{pF:"iteratorKeys"},function(){return 0>=this.count?va:new Da(this)});w.u(ka,{qF:"iteratorValues"},function(){if(0>=this.count)return va;var a=this.Mi;return null!==a?(a.reset(),a):new Fa(this)});function z(a,b){void 0===a?this.y=this.x=0:(this.x=a,this.y=b)}w.fa("Point",z);w.ji(z);w.$d(z,{x:!0,y:!0});
z.prototype.assign=function(a){this.x=a.x;this.y=a.y};z.prototype.setTo=z.prototype.l=function(a,b){this.x=a;this.y=b;return this};z.prototype.set=z.prototype.set=function(a){this.x=a.x;this.y=a.y;return this};z.prototype.copy=function(){var a=new z;a.x=this.x;a.y=this.y;return a};z.prototype.Ga=function(){Object.freeze(this);return this};z.prototype.S=function(){return Object.isFrozen(this)?this:this.copy().freeze()};z.prototype.freeze=function(){return this};
z.prototype.Ra=function(){Object.isFrozen(this)&&w.k("cannot thaw constant: "+this);return this};z.parse=function(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new z(c,e)}return new z};z.stringify=function(a){return a.x.toString()+" "+a.y.toString()};z.prototype.toString=function(){return"Point("+this.x+","+this.y+")"};
z.prototype.equals=z.prototype.L=function(a){return a instanceof z?this.x===a.x&&this.y===a.y:!1};z.prototype.equalTo=z.prototype.ex=function(a,b){return this.x===a&&this.y===b};z.prototype.equalsApprox=z.prototype.Ic=function(a){return K(this.x,a.x)&&K(this.y,a.y)};z.prototype.add=z.prototype.add=function(a){this.x+=a.x;this.y+=a.y;return this};z.prototype.subtract=z.prototype.Yn=function(a){this.x-=a.x;this.y-=a.y;return this};
z.prototype.offset=z.prototype.offset=function(a,b){this.x+=a;this.y+=b;return this};z.prototype.rotate=z.prototype.rotate=function(a){if(0===a)return this;var b=this.x,c=this.y;if(0===b&&0===c)return this;var d=0,e=0;360<=a?a-=360:0>a&&(a+=360);90===a?(d=0,e=1):180===a?(d=-1,e=0):270===a?(d=0,e=-1):(a=a*Math.PI/180,d=Math.cos(a),e=Math.sin(a));this.x=d*b-e*c;this.y=e*b+d*c;return this};z.prototype.scale=z.prototype.scale=function(a,b){this.x*=a;this.y*=b;return this};
z.prototype.distanceSquaredPoint=z.prototype.uf=function(a){var b=a.x-this.x;a=a.y-this.y;return b*b+a*a};z.prototype.distanceSquared=z.prototype.Sp=function(a,b){var c=a-this.x,d=b-this.y;return c*c+d*d};z.prototype.normalize=z.prototype.normalize=function(){var a=this.x,b=this.y,c=Math.sqrt(a*a+b*b);0<c&&(this.x=a/c,this.y=b/c);return this};z.prototype.directionPoint=z.prototype.yc=function(a){return Ha(a.x-this.x,a.y-this.y)};
z.prototype.direction=z.prototype.direction=function(a,b){return Ha(a-this.x,b-this.y)};function Ha(a,b){if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;var c=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?c=0>b?c+180:180-c:0>b&&(c=360-c);return c}z.prototype.projectOntoLineSegment=function(a,b,c,d){Ia(a,b,c,d,this.x,this.y,this);return this};z.prototype.projectOntoLineSegmentPoint=function(a,b){Ia(a.x,a.y,b.x,b.y,this.x,this.y,this);return this};
z.prototype.snapToGrid=function(a,b,c,d){Ka(this.x,this.y,a,b,c,d,this);return this};z.prototype.snapToGridPoint=function(a,b){Ka(this.x,this.y,a.x,a.y,b.width,b.height,this);return this};z.prototype.setRectSpot=z.prototype.Vn=function(a,b){this.x=a.x+b.x*a.width+b.offsetX;this.y=a.y+b.y*a.height+b.offsetY;return this};z.prototype.setSpot=z.prototype.Hu=function(a,b,c,d,e){this.x=a+e.x*c+e.offsetX;this.y=b+e.y*d+e.offsetY;return this};z.prototype.transform=function(a){a.nb(this);return this};
function La(a,b){b.li(a);return a}var Ma;z.distanceLineSegmentSquared=Ma=function(a,b,c,d,e,f){var h=e-c,k=f-d,l=h*h+k*k;c-=a;d-=b;var m=-c*h-d*k;if(0>=m||m>=l)return h=e-a,k=f-b,Math.min(c*c+d*d,h*h+k*k);a=h*d-k*c;return a*a/l};var Na;z.distanceSquared=Na=function(a,b,c,d){a=c-a;b=d-b;return a*a+b*b};var Oa;
z.direction=Oa=function(a,b,c,d){a=c-a;b=d-b;if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;d=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?d=0>b?d+180:180-d:0>b&&(d=360-d);return d};z.prototype.isReal=z.prototype.H=function(){return isFinite(this.x)&&isFinite(this.y)};function ha(a,b){void 0===a?this.height=this.width=0:(this.width=a,this.height=b)}w.fa("Size",ha);w.ji(ha);w.$d(ha,{width:!0,height:!0});
ha.prototype.assign=function(a){this.width=a.width;this.height=a.height};ha.prototype.setTo=ha.prototype.l=function(a,b){this.width=a;this.height=b;return this};ha.prototype.set=ha.prototype.set=function(a){this.width=a.width;this.height=a.height;return this};ha.prototype.copy=function(){var a=new ha;a.width=this.width;a.height=this.height;return a};ha.prototype.Ga=function(){Object.freeze(this);return this};ha.prototype.S=function(){return Object.isFrozen(this)?this:this.copy().freeze()};
ha.prototype.freeze=function(){return this};ha.prototype.Ra=function(){Object.isFrozen(this)&&w.k("cannot thaw constant: "+this);return this};ha.parse=function(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new ha(c,e)}return new ha};ha.stringify=function(a){return a.width.toString()+" "+a.height.toString()};
ha.prototype.toString=function(){return"Size("+this.width+","+this.height+")"};ha.prototype.equals=ha.prototype.L=function(a){return a instanceof ha?this.width===a.width&&this.height===a.height:!1};ha.prototype.equalTo=ha.prototype.ex=function(a,b){return this.width===a&&this.height===b};ha.prototype.equalsApprox=ha.prototype.Ic=function(a){return K(this.width,a.width)&&K(this.height,a.height)};ha.prototype.isReal=ha.prototype.H=function(){return isFinite(this.width)&&isFinite(this.height)};
function A(a,b,c,d){void 0===a?this.height=this.width=this.y=this.x=0:a instanceof z?b instanceof z?(this.x=Math.min(a.x,b.x),this.y=Math.min(a.y,b.y),this.width=Math.abs(a.x-b.x),this.height=Math.abs(a.y-b.y)):b instanceof ha?(this.x=a.x,this.y=a.y,this.width=b.width,this.height=b.height):w.k("Incorrect arguments supplied to Rect constructor"):(this.x=a,this.y=b,this.width=c,this.height=d)}w.fa("Rect",A);w.ji(A);w.$d(A,{x:!0,y:!0,width:!0,height:!0});
A.prototype.assign=function(a){this.x=a.x;this.y=a.y;this.width=a.width;this.height=a.height};function Pa(a,b,c){a.width=b;a.height=c}A.prototype.setTo=A.prototype.l=function(a,b,c,d){this.x=a;this.y=b;this.width=c;this.height=d;return this};A.prototype.set=A.prototype.set=function(a){this.x=a.x;this.y=a.y;this.width=a.width;this.height=a.height;return this};A.prototype.setPoint=A.prototype.Tg=function(a){this.x=a.x;this.y=a.y;return this};
A.prototype.setSize=function(a){this.width=a.width;this.height=a.height;return this};A.prototype.copy=function(){var a=new A;a.x=this.x;a.y=this.y;a.width=this.width;a.height=this.height;return a};A.prototype.Ga=function(){Object.freeze(this);return this};A.prototype.S=function(){return Object.isFrozen(this)?this:this.copy().freeze()};A.prototype.freeze=function(){return this};A.prototype.Ra=function(){Object.isFrozen(this)&&w.k("cannot thaw constant: "+this);return this};
A.parse=function(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));for(var h=0;""===a[b];)b++;(d=a[b++])&&(h=parseFloat(d));return new A(c,e,f,h)}return new A};A.stringify=function(a){return a.x.toString()+" "+a.y.toString()+" "+a.width.toString()+" "+a.height.toString()};
A.prototype.toString=function(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"};A.prototype.equals=A.prototype.L=function(a){return a instanceof A?this.x===a.x&&this.y===a.y&&this.width===a.width&&this.height===a.height:!1};A.prototype.equalTo=A.prototype.ex=function(a,b,c,d){return this.x===a&&this.y===b&&this.width===c&&this.height===d};A.prototype.equalsApprox=A.prototype.Ic=function(a){return K(this.x,a.x)&&K(this.y,a.y)&&K(this.width,a.width)&&K(this.height,a.height)};
function Qa(a,b){return Xa(a.x,b.x)&&Xa(a.y,b.y)&&Xa(a.width,b.width)&&Xa(a.height,b.height)}A.prototype.containsPoint=A.prototype.Ha=function(a){return this.x<=a.x&&this.x+this.width>=a.x&&this.y<=a.y&&this.y+this.height>=a.y};A.prototype.containsRect=A.prototype.vk=function(a){return this.x<=a.x&&a.x+a.width<=this.x+this.width&&this.y<=a.y&&a.y+a.height<=this.y+this.height};
A.prototype.contains=A.prototype.contains=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return this.x<=a&&a+c<=this.x+this.width&&this.y<=b&&b+d<=this.y+this.height};A.prototype.reset=function(){this.height=this.width=this.y=this.x=0};A.prototype.offset=A.prototype.offset=function(a,b){this.x+=a;this.y+=b;return this};A.prototype.inflate=A.prototype.Sf=function(a,b){return Za(this,b,a,b,a)};A.prototype.addMargin=A.prototype.Jw=function(a){return Za(this,a.top,a.right,a.bottom,a.left)};
A.prototype.subtractMargin=A.prototype.EJ=function(a){return Za(this,-a.top,-a.right,-a.bottom,-a.left)};A.prototype.grow=function(a,b,c,d){return Za(this,a,b,c,d)};function Za(a,b,c,d,e){var f=a.width;c+e<=-f?(a.x+=f/2,a.width=0):(a.x-=e,a.width+=c+e);c=a.height;b+d<=-c?(a.y+=c/2,a.height=0):(a.y-=b,a.height+=b+d);return a}A.prototype.intersectRect=function(a){return $a(this,a.x,a.y,a.width,a.height)};A.prototype.intersect=A.prototype.$E=function(a,b,c,d){return $a(this,a,b,c,d)};
function $a(a,b,c,d,e){var f=Math.max(a.x,b),h=Math.max(a.y,c);b=Math.min(a.x+a.width,b+d);c=Math.min(a.y+a.height,c+e);a.x=f;a.y=h;a.width=Math.max(0,b-f);a.height=Math.max(0,c-h);return a}A.prototype.intersectsRect=A.prototype.Kg=function(a){return this.aF(a.x,a.y,a.width,a.height)};
A.prototype.intersects=A.prototype.aF=function(a,b,c,d){var e=this.width,f=this.x;if(Infinity!==e&&Infinity!==c&&(e+=f,c+=a,isNaN(c)||isNaN(e)||f>c||a>e))return!1;a=this.height;c=this.y;return Infinity!==a&&Infinity!==d&&(a+=c,d+=b,isNaN(d)||isNaN(a)||c>d||b>a)?!1:!0};function ab(a,b){var c=a.width,d=b.width+10+10,e=a.x,f=b.x-10;if(e>d+f||f>c+e)return!1;c=a.height;d=b.height+10+10;e=a.y;f=b.y-10;return e>d+f||f>c+e?!1:!0}A.prototype.unionPoint=A.prototype.ri=function(a){return bb(this,a.x,a.y,0,0)};
A.prototype.unionRect=A.prototype.Gh=function(a){return bb(this,a.x,a.y,a.width,a.height)};A.prototype.union=A.prototype.tG=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return bb(this,a,b,c,d)};function bb(a,b,c,d,e){var f=Math.min(a.x,b),h=Math.min(a.y,c);b=Math.max(a.x+a.width,b+d);c=Math.max(a.y+a.height,c+e);a.x=f;a.y=h;a.width=b-f;a.height=c-h;return a}A.prototype.setSpot=A.prototype.Hu=function(a,b,c){this.x=a-c.offsetX-c.x*this.width;this.y=b-c.offsetY-c.y*this.height;return this};
var db;A.contains=db=function(a,b,c,d,e,f,h,k){void 0===h&&(h=0);void 0===k&&(k=0);return a<=e&&e+h<=a+c&&b<=f&&f+k<=b+d};A.intersects=function(a,b,c,d,e,f,h,k){c+=a;h+=e;if(a>h||e>c)return!1;a=d+b;k+=f;return b>k||f>a?!1:!0};w.defineProperty(A,{left:"left"},function(){return this.x},function(a){this.x=a});w.defineProperty(A,{top:"top"},function(){return this.y},function(a){this.y=a});w.defineProperty(A,{right:"right"},function(){return this.x+this.width},function(a){this.x+=a-(this.x+this.width)});
w.defineProperty(A,{bottom:"bottom"},function(){return this.y+this.height},function(a){this.y+=a-(this.y+this.height)});w.defineProperty(A,{position:"position"},function(){return new z(this.x,this.y)},function(a){this.x=a.x;this.y=a.y});w.defineProperty(A,{size:"size"},function(){return new ha(this.width,this.height)},function(a){this.width=a.width;this.height=a.height});
w.defineProperty(A,{Gl:"center"},function(){return new z(this.x+this.width/2,this.y+this.height/2)},function(a){this.x=a.x-this.width/2;this.y=a.y-this.height/2});w.defineProperty(A,{ja:"centerX"},function(){return this.x+this.width/2},function(a){this.x=a-this.width/2});w.defineProperty(A,{ra:"centerY"},function(){return this.y+this.height/2},function(a){this.y=a-this.height/2});A.prototype.isReal=A.prototype.H=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)};
A.prototype.isEmpty=function(){return 0===this.width&&0===this.height};function eb(a,b,c,d){void 0===a?this.left=this.bottom=this.right=this.top=0:void 0===b?this.left=this.bottom=this.right=this.top=a:void 0===c?(d=b,this.top=a,this.right=b,this.bottom=a,this.left=d):void 0!==d?(this.top=a,this.right=b,this.bottom=c,this.left=d):w.k("Invalid arguments to Margin constructor")}w.fa("Margin",eb);w.ji(eb);w.$d(eb,{top:!0,right:!0,bottom:!0,left:!0});
eb.prototype.assign=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left};eb.prototype.setTo=eb.prototype.l=function(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d;return this};eb.prototype.set=eb.prototype.set=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};eb.prototype.copy=function(){var a=new eb;a.top=this.top;a.right=this.right;a.bottom=this.bottom;a.left=this.left;return a};
eb.prototype.Ga=function(){Object.freeze(this);return this};eb.prototype.S=function(){return Object.isFrozen(this)?this:this.copy().freeze()};eb.prototype.freeze=function(){return this};eb.prototype.Ra=function(){Object.isFrozen(this)&&w.k("cannot thaw constant: "+this);return this};
eb.parse=function(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=NaN;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));if(isNaN(c))return new eb;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new eb(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new eb(c,e);for(var h=NaN;""===a[b];)b++;(d=a[b++])&&(h=parseFloat(d));return isNaN(h)?new eb(c,e):new eb(c,e,f,h)}return new eb};
eb.stringify=function(a){return a.top.toString()+" "+a.right.toString()+" "+a.bottom.toString()+" "+a.left.toString()};eb.prototype.toString=function(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"};eb.prototype.equals=eb.prototype.L=function(a){return a instanceof eb?this.top===a.top&&this.right===a.right&&this.bottom===a.bottom&&this.left===a.left:!1};
eb.prototype.equalTo=eb.prototype.ex=function(a,b,c,d){return this.top===a&&this.right===b&&this.bottom===c&&this.left===d};eb.prototype.equalsApprox=eb.prototype.Ic=function(a){return K(this.top,a.top)&&K(this.right,a.right)&&K(this.bottom,a.bottom)&&K(this.left,a.left)};eb.prototype.isReal=eb.prototype.H=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};function ia(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0}w.ji(ia);
w.$d(ia,{m11:!0,m12:!0,m21:!0,m22:!0,dx:!0,dy:!0});ia.prototype.set=ia.prototype.set=function(a){this.m11=a.m11;this.m12=a.m12;this.m21=a.m21;this.m22=a.m22;this.dx=a.dx;this.dy=a.dy;return this};ia.prototype.copy=function(){var a=new ia;a.m11=this.m11;a.m12=this.m12;a.m21=this.m21;a.m22=this.m22;a.dx=this.dx;a.dy=this.dy;return a};ia.prototype.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};
ia.prototype.equals=ia.prototype.L=function(a){return a instanceof ia?this.m11===a.m11&&this.m12===a.m12&&this.m21===a.m21&&this.m22===a.m22&&this.dx===a.dx&&this.dy===a.dy:!1};ia.prototype.isIdentity=ia.prototype.cu=function(){return 1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22&&0===this.dx&&0===this.dy};ia.prototype.reset=ia.prototype.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this};
ia.prototype.multiply=ia.prototype.multiply=function(a){var b=this.m12*a.m11+this.m22*a.m12,c=this.m11*a.m21+this.m21*a.m22,d=this.m12*a.m21+this.m22*a.m22,e=this.m11*a.dx+this.m21*a.dy+this.dx,f=this.m12*a.dx+this.m22*a.dy+this.dy;this.m11=this.m11*a.m11+this.m21*a.m12;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=f;return this};
ia.prototype.multiplyInverted=ia.prototype.yF=function(a){var b=1/(a.m11*a.m22-a.m12*a.m21),c=a.m22*b,d=-a.m12*b,e=-a.m21*b,f=a.m11*b,h=b*(a.m21*a.dy-a.m22*a.dx),k=b*(a.m12*a.dx-a.m11*a.dy);a=this.m12*c+this.m22*d;b=this.m11*e+this.m21*f;e=this.m12*e+this.m22*f;f=this.m11*h+this.m21*k+this.dx;h=this.m12*h+this.m22*k+this.dy;this.m11=this.m11*c+this.m21*d;this.m12=a;this.m21=b;this.m22=e;this.dx=f;this.dy=h;return this};
ia.prototype.invert=ia.prototype.qx=function(){var a=1/(this.m11*this.m22-this.m12*this.m21),b=-this.m12*a,c=-this.m21*a,d=this.m11*a,e=a*(this.m21*this.dy-this.m22*this.dx),f=a*(this.m12*this.dx-this.m11*this.dy);this.m11=this.m22*a;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=f;return this};
ia.prototype.rotate=ia.prototype.rotate=function(a,b,c){360<=a?a-=360:0>a&&(a+=360);if(0===a)return this;this.translate(b,c);var d=0,e=0;90===a?(d=0,e=1):180===a?(d=-1,e=0):270===a?(d=0,e=-1):(e=a*Math.PI/180,d=Math.cos(e),e=Math.sin(e));a=this.m12*d+this.m22*e;var f=this.m11*-e+this.m21*d,h=this.m12*-e+this.m22*d;this.m11=this.m11*d+this.m21*e;this.m12=a;this.m21=f;this.m22=h;this.translate(-b,-c);return this};
ia.prototype.translate=ia.prototype.translate=function(a,b){this.dx+=this.m11*a+this.m21*b;this.dy+=this.m12*a+this.m22*b;return this};ia.prototype.scale=ia.prototype.scale=function(a,b){void 0===b&&(b=a);this.m11*=a;this.m12*=a;this.m21*=b;this.m22*=b;return this};ia.prototype.transformPoint=ia.prototype.nb=function(a){var b=a.x,c=a.y;a.x=b*this.m11+c*this.m21+this.dx;a.y=b*this.m12+c*this.m22+this.dy;return a};
ia.prototype.invertedTransformPoint=ia.prototype.li=function(a){var b=1/(this.m11*this.m22-this.m12*this.m21),c=-this.m12*b,d=this.m11*b,e=b*(this.m12*this.dx-this.m11*this.dy),f=a.x,h=a.y;a.x=f*this.m22*b+h*-this.m21*b+b*(this.m21*this.dy-this.m22*this.dx);a.y=f*c+h*d+e;return a};
ia.prototype.transformRect=ia.prototype.sG=function(a){var b=a.x,c=a.y,d=b+a.width,e=c+a.height,f=this.m11,h=this.m12,k=this.m21,l=this.m22,m=this.dx,n=this.dy,p=b*f+c*k+m,q=b*h+c*l+n,r=d*f+c*k+m,c=d*h+c*l+n,s=b*f+e*k+m,b=b*h+e*l+n,f=d*f+e*k+m,d=d*h+e*l+n,e=p,h=q,p=Math.min(p,r),e=Math.max(e,r),h=Math.min(h,c),q=Math.max(q,c),p=Math.min(p,s),e=Math.max(e,s),h=Math.min(h,b),q=Math.max(q,b),p=Math.min(p,f),e=Math.max(e,f),h=Math.min(h,d),q=Math.max(q,d);a.x=p;a.y=h;a.width=e-p;a.height=q-h;return a};
function L(a,b,c,d){void 0===a?this.offsetY=this.offsetX=this.y=this.x=0:(void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),this.x=a,this.y=b,this.offsetX=c,this.offsetY=d)}w.fa("Spot",L);w.ji(L);w.$d(L,{x:!0,y:!0,offsetX:!0,offsetY:!0});L.prototype.assign=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY};L.prototype.setTo=L.prototype.l=function(a,b,c,d){this.x=a;this.y=b;this.offsetX=c;this.offsetY=d;return this};
L.prototype.set=L.prototype.set=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};L.prototype.copy=function(){var a=new L;a.x=this.x;a.y=this.y;a.offsetX=this.offsetX;a.offsetY=this.offsetY;return a};L.prototype.Ga=function(){Object.freeze(this);return this};L.prototype.S=function(){return Object.isFrozen(this)?this:this.copy().freeze()};L.prototype.freeze=function(){return this};
L.prototype.Ra=function(){Object.isFrozen(this)&&w.k("cannot thaw constant: "+this);return this};function gb(a,b){a.x=NaN;a.y=NaN;a.offsetX=b;return a}var rb;
L.parse=rb=function(a){if("string"===typeof a){a=a.trim();if("None"===a)return sb;if("TopLeft"===a)return vb;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return wb;if("TopRight"===a)return Ab;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return Eb;if("Center"===a)return Fb;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return Hb;if("BottomLeft"===a)return Ib;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return Jb;if("BottomRight"===a)return Kb;if("TopSide"===a)return Sb;if("LeftSide"===
a)return Tb;if("RightSide"===a)return Ub;if("BottomSide"===a)return Vb;if("TopBottomSides"===a)return Yb;if("LeftRightSides"===a)return Zb;if("TopLeftSides"===a)return $b;if("TopRightSides"===a)return ac;if("BottomLeftSides"===a)return bc;if("BottomRightSides"===a)return cc;if("NotTopSide"===a)return dc;if("NotLeftSide"===a)return kc;if("NotRightSide"===a)return lc;if("NotBottomSide"===a)return mc;if("AllSides"===a)return nc;if("Default"===a)return oc;a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;
var d=a[b++];void 0!==d&&0<d.length&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(f=parseFloat(d));for(var h=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(h=parseFloat(d));return new L(c,e,f,h)}return new L};L.stringify=function(a){return a.fd()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()};
L.prototype.toString=function(){return this.fd()?0===this.offsetX&&0===this.offsetY?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.L(sb)?"None":this.L(vb)?"TopLeft":this.L(wb)?"Top":this.L(Ab)?"TopRight":this.L(Eb)?"Left":this.L(Fb)?"Center":this.L(Hb)?"Right":this.L(Ib)?"BottomLeft":this.L(Jb)?"Bottom":this.L(Kb)?"BottomRight":this.L(Sb)?"TopSide":this.L(Tb)?"LeftSide":this.L(Ub)?"RightSide":this.L(Vb)?"BottomSide":this.L(Yb)?"TopBottomSides":this.L(Zb)?
"LeftRightSides":this.L($b)?"TopLeftSides":this.L(ac)?"TopRightSides":this.L(bc)?"BottomLeftSides":this.L(cc)?"BottomRightSides":this.L(dc)?"NotTopSide":this.L(kc)?"NotLeftSide":this.L(lc)?"NotRightSide":this.L(mc)?"NotBottomSide":this.L(nc)?"AllSides":this.L(oc)?"Default":"None"};L.prototype.equals=L.prototype.L=function(a){return a instanceof L?(this.x===a.x||isNaN(this.x)&&isNaN(a.x))&&(this.y===a.y||isNaN(this.y)&&isNaN(a.y))&&this.offsetX===a.offsetX&&this.offsetY===a.offsetY:!1};
L.prototype.opposite=L.prototype.CF=function(){return new L(.5-(this.x-.5),.5-(this.y-.5),-this.offsetX,-this.offsetY)};L.prototype.includesSide=L.prototype.qj=function(a){if(!this.sj())return!1;if(!a.sj())if(a.L(pc))a=Tb;else if(a.L(qc))a=Ub;else if(a.L(uc))a=Sb;else if(a.L(vc))a=Vb;else return!1;a=a.offsetY;return(this.offsetY&a)===a};L.prototype.isSpot=L.prototype.fd=function(){return!isNaN(this.x)&&!isNaN(this.y)};L.prototype.isNoSpot=L.prototype.Nd=function(){return isNaN(this.x)||isNaN(this.y)};
L.prototype.isSide=L.prototype.sj=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY};L.prototype.isNone=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};L.prototype.isDefault=L.prototype.Uc=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};var sb;L.None=sb=gb(new L(0,0,0,0),0).Ga();var oc;L.Default=oc=gb(new L(0,0,-1,0),-1).Ga();var vb;L.TopLeft=vb=(new L(0,0,0,0)).Ga();var wb;
L.TopCenter=wb=(new L(.5,0,0,0)).Ga();var Ab;L.TopRight=Ab=(new L(1,0,0,0)).Ga();var Eb;L.LeftCenter=Eb=(new L(0,.5,0,0)).Ga();var Fb;L.Center=Fb=(new L(.5,.5,0,0)).Ga();var Hb;L.RightCenter=Hb=(new L(1,.5,0,0)).Ga();var Ib;L.BottomLeft=Ib=(new L(0,1,0,0)).Ga();var Jb;L.BottomCenter=Jb=(new L(.5,1,0,0)).Ga();var Kb;L.BottomRight=Kb=(new L(1,1,0,0)).Ga();var Dc;L.MiddleTop=Dc=wb;var Ec;L.MiddleLeft=Ec=Eb;var Fc;L.MiddleRight=Fc=Hb;var Gc;L.MiddleBottom=Gc=Jb;var uc;L.Top=uc=wb;var pc;L.Left=pc=Eb;
var qc;L.Right=qc=Hb;var vc;L.Bottom=vc=Jb;var Sb;L.TopSide=Sb=gb(new L(0,0,1,w.jd),1).Ga();var Tb;L.LeftSide=Tb=gb(new L(0,0,1,w.Qc),1).Ga();var Ub;L.RightSide=Ub=gb(new L(0,0,1,w.Zc),1).Ga();var Vb;L.BottomSide=Vb=gb(new L(0,0,1,w.Yc),1).Ga();var Yb;L.TopBottomSides=Yb=gb(new L(0,0,1,w.jd|w.Yc),1).Ga();var Zb;L.LeftRightSides=Zb=gb(new L(0,0,1,w.Qc|w.Zc),1).Ga();var $b;L.TopLeftSides=$b=gb(new L(0,0,1,w.jd|w.Qc),1).Ga();var ac;L.TopRightSides=ac=gb(new L(0,0,1,w.jd|w.Zc),1).Ga();var bc;
L.BottomLeftSides=bc=gb(new L(0,0,1,w.Yc|w.Qc),1).Ga();var cc;L.BottomRightSides=cc=gb(new L(0,0,1,w.Yc|w.Zc),1).Ga();var dc;L.NotTopSide=dc=gb(new L(0,0,1,w.Qc|w.Zc|w.Yc),1).Ga();var kc;L.NotLeftSide=kc=gb(new L(0,0,1,w.jd|w.Zc|w.Yc),1).Ga();var lc;L.NotRightSide=lc=gb(new L(0,0,1,w.jd|w.Qc|w.Yc),1).Ga();var mc;L.NotBottomSide=mc=gb(new L(0,0,1,w.jd|w.Qc|w.Zc),1).Ga();var nc;L.AllSides=nc=gb(new L(0,0,1,w.jd|w.Qc|w.Zc|w.Yc),1).Ga();function Hc(){this.Sb=[1,0,0,1,0,0]}
Hc.prototype.copy=function(){var a=new Hc;a.Sb[0]=this.Sb[0];a.Sb[1]=this.Sb[1];a.Sb[2]=this.Sb[2];a.Sb[3]=this.Sb[3];a.Sb[4]=this.Sb[4];a.Sb[5]=this.Sb[5];return a};Hc.prototype.translate=function(a,b){this.Sb[4]+=this.Sb[0]*a+this.Sb[2]*b;this.Sb[5]+=this.Sb[1]*a+this.Sb[3]*b};Hc.prototype.scale=function(a,b){this.Sb[0]*=a;this.Sb[1]*=a;this.Sb[2]*=b;this.Sb[3]*=b};function Ic(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.mE=[];this.pattern=null}
Ic.prototype.addColorStop=function(a,b){this.mE.push({offset:a,color:b})};
function Lc(a,b,c){this.fillStyle="#000000";this.font="10px sans-serif";this.globalAlpha=1;this.lineCap="butt";this.Hn=0;this.lineJoin="miter";this.lineWidth=1;this.miterLimit=10;this.shadowBlur=0;this.shadowColor="rgba(0, 0, 0, 0)";this.shadowOffsetY=this.shadowOffsetX=0;this.strokeStyle="#000000";this.textAlign="start";this.Kp=!1;this.zg=this.Ys=this.Xs=0;this.document=b||document;this.BE=c;this.Bx=null;this.path=[];this.uh=new Hc;this.stack=[];this.wf=[];this.ax=a;this.ZI="http://www.w3.org/2000/svg";
this.width=this.ax.width;this.height=this.ax.height;this.gm=Mc(this,"svg",{width:this.width+"px",height:this.height+"px",RL:"0 0 "+this.ax.width+" "+this.ax.height});this.gm.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg");this.gm.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink");Nc(this,1,0,0,1,0,0);a=w.mm++;b=Mc(this,"clipPath",{id:"mainClip"+a});b.appendChild(Mc(this,"rect",{x:0,y:0,width:this.width,height:this.height}));
this.gm.appendChild(b);this.wf[0].setAttributeNS(null,"clip-path","url(#mainClip"+a+")")}g=Lc.prototype;g.arc=function(a,b,c,d,e,f){Oc(this,a,b,c,d,e,f)};g.beginPath=function(){this.path=[]};g.bezierCurveTo=function(a,b,c,d,e,f){this.path.push(["C",a,b,c,d,e,f])};g.clearRect=function(){};g.clip=function(){Pc(this,"clipPath",this.path,new Hc)};g.closePath=function(){this.path.push(["z"])};g.createLinearGradient=function(a,b,c,d){var e=new Ic("linear");e.x1=a;e.y1=b;e.x2=c;e.y2=d;return e};
g.createPattern=function(){return null};g.createRadialGradient=function(a,b,c,d,e,f){var h=new Ic("radial");h.x1=a;h.y1=b;h.r1=c;h.x2=d;h.y2=e;h.r2=f;return h};
g.drawImage=function(a,b,c,d,e,f,h,k,l){var m="";a instanceof HTMLCanvasElement&&(m=a.toDataURL());a instanceof HTMLImageElement&&(m=a.src);void 0===d&&(f=b,h=c,k=d=a.naturalWidth,l=e=a.naturalHeight);d=d||0;e=e||0;f=f||0;h=h||0;k=k||0;l=l||0;m={x:0,y:0,width:a.naturalWidth,height:a.naturalHeight,href:m,preserveAspectRatio:"xMidYMid slice"};Xa(d,k)&&Xa(e,l)||(m.preserveAspectRatio="none");var n="";k/=d;l/=e;if(0!==f||0!==h)n+=" translate("+f+", "+h+")";if(1!==k||1!==l)n+=" scale("+k+", "+l+")";if(0!==
b||0!==c)n+=" translate("+-b+", "+-c+")";if(0!==b||0!==c||d!==a.naturalWidth||e!==a.naturalHeight)a="CLIP"+w.mm++,f=Mc(this,"clipPath",{id:a}),f.appendChild(Mc(this,"rect",{x:b,y:c,width:d,height:e})),this.gm.appendChild(f),m["clip-path"]="url(#"+a+")";Qc(this,"image",m,this.uh,n);this.addElement("image",m)};g.fill=function(){Pc(this,"fill",this.path,this.uh)};g.Hg=function(){this.Kp?this.clip():this.fill()};g.fillRect=function(a,b,c,d){Rc(this,"fill",[a,b,c,d],this.uh)};
g.fillText=function(a,b,c){a=[a,b,c];b=this.textAlign;"left"===b?b="start":"right"===b?b="end":"center"===b&&(b="middle");b={x:a[1],y:a[2],style:"font: "+this.font,"text-anchor":b};Qc(this,"fill",b,this.uh);this.addElement("text",b,a[0])};g.lineTo=function(a,b){this.path.push(["L",a,b])};g.moveTo=function(a,b){this.path.push(["M",a,b])};g.quadraticCurveTo=function(a,b,c,d){this.path.push(["Q",a,b,c,d])};g.rect=function(a,b,c,d){this.path.push(["M",a,b],["L",a+c,b],["L",a+c,b+d],["L",a,b+d],["z"])};
g.restore=function(){this.uh=this.stack.pop();this.path=this.stack.pop();var a=this.stack.pop();this.fillStyle=a.fillStyle;this.font=a.font;this.globalAlpha=a.globalAlpha;this.lineCap=a.lineCap;this.Hn=a.Hn;this.lineJoin=a.lineJoin;this.lineWidth=a.lineWidth;this.miterLimit=a.miterLimit;this.shadowBlur=a.shadowBlur;this.shadowColor=a.shadowColor;this.shadowOffsetX=a.shadowOffsetX;this.shadowOffsetY=a.shadowOffsetY;this.strokeStyle=a.strokeStyle;this.textAlign=a.textAlign};
g.save=function(){this.stack.push({fillStyle:this.fillStyle,font:this.font,globalAlpha:this.globalAlpha,lineCap:this.lineCap,Hn:this.Hn,lineJoin:this.lineJoin,lineWidth:this.lineWidth,miterLimit:this.miterLimit,shadowBlur:this.shadowBlur,shadowColor:this.shadowColor,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,strokeStyle:this.strokeStyle,textAlign:this.textAlign});for(var a=[],b=0;b<this.path.length;b++)a.push(this.path[b]);this.stack.push(a);this.stack.push(this.uh.copy())};
g.setTransform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||Nc(this,a,b,c,d,e,f)};g.scale=function(a,b){this.uh.scale(a,b)};g.translate=function(a,b){this.uh.translate(a,b)};g.transform=function(){};g.stroke=function(){Pc(this,"stroke",this.path,this.uh)};g.Cj=function(){this.Kp||this.stroke()};g.strokeRect=function(a,b,c,d){Rc(this,"stroke",[a,b,c,d],this.uh)};
function Mc(a,b,c,d){a=a.document.createElementNS(a.ZI,b);if(w.Qa(c))for(var e in c)a.setAttributeNS("href"===e?"http://www.w3.org/1999/xlink":"",e,c[e]);void 0!==d&&(a.textContent=d);return a}g.addElement=function(a,b,c){a=Mc(this,a,b,c);0<this.wf.length?this.wf[this.wf.length-1].appendChild(a):this.gm.appendChild(a);return this.Bx=a};
function Qc(a,b,c,d,e){1!==a.globalAlpha&&(c.opacity=a.globalAlpha);"fill"===b?(a.fillStyle instanceof Ic?c.fill=Sc(a,a.fillStyle):(/^rgba\(/.test(a.fillStyle)&&(b=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.fillStyle),c.fill="rgb("+b[1]+","+b[2]+","+b[3]+")",c["fill-opacity"]=b[4]),c.fill=a.fillStyle),c.stroke="none"):"stroke"===b&&(c.fill="none",a.strokeStyle instanceof Ic?c.stroke=Sc(a,a.strokeStyle):(/^rgba\(/.test(a.strokeStyle)&&(b=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.strokeStyle),
c.stroke="rgb("+b[1]+","+b[2]+","+b[3]+")",c["stroke-opacity"]=b[4]),c.stroke=a.strokeStyle),c["stroke-width"]=a.lineWidth,c["stroke-linecap"]=a.lineCap,c["stroke-linejoin"]=a.lineJoin,c["stroke-miterlimit"]=a.miterLimit);a=d.Sb;a="matrix("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+")";void 0!==e&&(a+=e);c.transform=a}
function Sc(a,b){var c="GRAD"+w.mm++,d;if("linear"===b.type)d=Mc(a,"linearGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,id:c,gradientUnits:"userSpaceOnUse"});else if("radial"===b.type)d=Mc(a,"radialGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,r1:b.r1,r2:b.r2,id:c});else if("pattern"===b.type){var e=b.pattern;d={width:e.width,height:e.height,id:c,patternUnits:"userSpaceOnUse"};var f="";e instanceof HTMLCanvasElement&&(f=e.toDataURL());e instanceof HTMLImageElement&&(f=e.src);e={x:0,y:0,width:e.width,height:e.height,
href:f};d=Mc(a,"pattern",d);d.appendChild(Mc(a,"image",e))}else throw Error("invalid gradient");for(var e=b.mE,f=e.length,h=[],k=0;k<f;k++){var l=e[k],m=l.color,l={offset:l.offset,"stop-color":m};/^rgba\(/.test(m)&&(m=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(m),l["stop-color"]="rgb("+m[1]+","+m[2]+","+m[3]+")",l["stop-opacity"]=m[4]);h.push(l)}h.sort(function(a,b){return a.offset>b.offset?1:-1});for(k=0;k<f;k++)d.appendChild(Mc(a,"stop",h[k]));a.gm.appendChild(d);
return"url(#"+c+")"}function Rc(a,b,c,d){c={x:c[0],y:c[1],width:c[2],height:c[3]};Qc(a,b,c,d);a.addElement("rect",c)}
function Pc(a,b,c,d){for(var e=[],f=0;f<c.length;f++){var h=w.Hl(c[f]),k=[h.shift()];if("A"===k[0])k.push(h.shift()+","+h.shift(),h.shift(),h.shift()+","+h.shift(),h.shift()+","+h.shift());else for(;h.length;)k.push(h.shift()+","+h.shift());e.push(k.join(" "))}c={d:e.join(" ")};Qc(a,b,c,d);"clipPath"===b?(b="CLIP"+w.mm++,d=Mc(a,"clipPath",{id:b}),d.appendChild(Mc(a,"path",c)),a.gm.appendChild(d),0<a.wf.length&&a.wf[a.wf.length-1].setAttributeNS(null,"clip-path","url(#"+b+")")):a.addElement("path",
c)}function Oc(a,b,c,d,e,f,h){var k=Math.abs(e-f);if(e!==f){var l=b+d*Math.cos(f);f=c+d*Math.sin(f);k>=2*Math.PI?(Oc(a,b,c,d,e,e+Math.PI,h),Oc(a,b,c,d,e+Math.PI,e+2*Math.PI,h),a.path.push(["M",l,f])):(b+=d*Math.cos(e),c+=d*Math.sin(e),k=180*k/Math.PI,e=h?0:1,h=180<=k===!!h?0:1,0!==a.path.length?a.path.push(["L",b,c]):a.path.push(["M",b,c]),a.path.push(["A",d,d,k,h,e,l,f]))}}function Nc(a,b,c,d,e,f,h){var k=new Hc;k.Sb=[b,c,d,e,f,h];b={};Qc(a,"g",b,k);k=a.addElement("g",b);a.wf.push(k)}
g.$a=function(){if(0!==this.shadowOffsetX||0!==this.shadowOffsetY||0!==this.shadowBlur){var a="SHADOW"+w.mm++,b=this.addElement("filter",{id:a,x:"-100%",y:"-100%",width:"300%",height:"300%"},null),c,d,e,f,h;c=Mc(this,"feGaussianBlur",{"in":"SourceAlpha",result:"blur",GL:this.shadowBlur/2});d=Mc(this,"feFlood",{"in":"blur",result:"flood","flood-color":this.shadowColor});e=Mc(this,"feComposite",{"in":"flood",in2:"blur",operator:"in",result:"comp"});f=Mc(this,"feOffset",{"in":"comp",result:"offsetBlur",
dx:this.shadowOffsetX,dy:this.shadowOffsetY});h=Mc(this,"feMerge",{});h.appendChild(Mc(this,"feMergeNode",{"in":"offsetBlur"}));h.appendChild(Mc(this,"feMergeNode",{"in":"SourceGraphic"}));b.appendChild(c);b.appendChild(d);b.appendChild(e);b.appendChild(f);b.appendChild(h);0<this.wf.length&&this.wf[this.wf.length-1].setAttributeNS(null,"filter","url(#"+a+")")}};g.hB=function(a,b,c){this.Xs=a;this.Ys=b;this.zg=c};g.Wn=function(){this.shadowBlur=this.shadowOffsetY=this.shadowOffsetX=0};
g.Xn=function(){this.shadowOffsetX=this.Xs;this.shadowOffsetY=this.Ys;this.shadowBlur=this.zg};g.dA=function(){return!1};g.aA=function(){};g.Ee=function(){};g.ey=function(){};Lc.prototype.rotate=function(){};function Tc(a,b){this.ownerDocument=void 0===b?document:b;var c=this.ownerDocument.createElement("canvas");c.tabIndex=0;this.Gd=c;this.wk=new Uc(c);c.Z=a;Object.seal(this)}g=Tc.prototype;g.toDataURL=function(a,b){return this.Gd.toDataURL(a,b)};g.getBoundingClientRect=function(){return this.Gd.getBoundingClientRect()};
g.focus=function(){return this.Gd.focus()};g.addEventListener=function(a,b,c){this.Gd.addEventListener(a,b,c)};g.removeEventListener=function(a,b,c){this.Gd.removeEventListener(a,b,c)};w.defineProperty(Tc,{width:"width"},function(){return this.Gd.width},function(a){this.Gd.width=a});w.defineProperty(Tc,{height:"height"},function(){return this.Gd.height},function(a){this.Gd.height=a});w.u(Tc,{style:"style"},function(){return this.Gd.style});
function Uc(a){a.getContext&&a.getContext("2d")||w.k("Browser does not support HTML Canvas Element");this.ya=a.getContext("2d");this.By=this.Dy=this.Cy="";this.Tq=!1;this.zg=this.Ys=this.Xs=0;Object.seal(this)}Uc.prototype.ey=function(a){this.ya.sA=a;this.ya.mL=a};w.defineProperty(Uc,{fillStyle:"fillStyle"},function(){return this.ya.fillStyle},function(a){this.By!==a&&(this.By=this.ya.fillStyle=a)});
w.defineProperty(Uc,{font:"font"},function(){return this.ya.font},function(a){this.Cy!==a&&(this.Cy=this.ya.font=a)});w.defineProperty(Uc,{globalAlpha:"globalAlpha"},function(){return this.ya.globalAlpha},function(a){this.ya.globalAlpha=a});w.defineProperty(Uc,{lineCap:"lineCap"},function(){return this.ya.lineCap},function(a){this.ya.lineCap=a});w.defineProperty(Uc,{Hn:"lineDashOffset"},function(){return this.ya.Hn},function(a){this.ya.Hn=a});
w.defineProperty(Uc,{lineJoin:"lineJoin"},function(){return this.ya.lineJoin},function(a){this.ya.lineJoin=a});w.defineProperty(Uc,{lineWidth:"lineWidth"},function(){return this.ya.lineWidth},function(a){this.ya.lineWidth=a});w.defineProperty(Uc,{miterLimit:"miterLimit"},function(){return this.ya.miterLimit},function(a){this.ya.miterLimit=a});w.defineProperty(Uc,{shadowBlur:"shadowBlur"},function(){return this.ya.shadowBlur},function(a){this.ya.shadowBlur=a});
w.defineProperty(Uc,{shadowColor:"shadowColor"},function(){return this.ya.shadowColor},function(a){this.ya.shadowColor=a});w.defineProperty(Uc,{shadowOffsetX:"shadowOffsetX"},function(){return this.ya.shadowOffsetX},function(a){this.ya.shadowOffsetX=a});w.defineProperty(Uc,{shadowOffsetY:"shadowOffsetY"},function(){return this.ya.shadowOffsetY},function(a){this.ya.shadowOffsetY=a});
w.defineProperty(Uc,{strokeStyle:"strokeStyle"},function(){return this.ya.strokeStyle},function(a){this.Dy!==a&&(this.Dy=this.ya.strokeStyle=a)});w.defineProperty(Uc,{textAlign:"textAlign"},function(){return this.ya.textAlign},function(a){this.ya.textAlign=a});w.defineProperty(Uc,{sA:"imageSmoothingEnabled"},function(){return this.ya.sA},function(a){this.ya.sA=a});g=Uc.prototype;g.arc=function(a,b,c,d,e,f){this.ya.arc(a,b,c,d,e,f)};g.beginPath=function(){this.ya.beginPath()};
g.bezierCurveTo=function(a,b,c,d,e,f){this.ya.bezierCurveTo(a,b,c,d,e,f)};g.clearRect=function(a,b,c,d){this.ya.clearRect(a,b,c,d)};g.clip=function(){this.ya.clip()};g.closePath=function(){this.ya.closePath()};g.createLinearGradient=function(a,b,c,d){return this.ya.createLinearGradient(a,b,c,d)};g.createPattern=function(a,b){return this.ya.createPattern(a,b)};g.createRadialGradient=function(a,b,c,d,e,f){return this.ya.createRadialGradient(a,b,c,d,e,f)};
g.drawImage=function(a,b,c,d,e,f,h,k,l){void 0===d?this.ya.drawImage(a,b,c):this.ya.drawImage(a,b,c,d,e,f,h,k,l)};g.fill=function(){this.ya.fill()};g.fillRect=function(a,b,c,d){this.ya.fillRect(a,b,c,d)};g.fillText=function(a,b,c){this.ya.fillText(a,b,c)};g.getImageData=function(a,b,c,d){return this.ya.getImageData(a,b,c,d)};g.lineTo=function(a,b){this.ya.lineTo(a,b)};g.measureText=function(a){return this.ya.measureText(a)};g.moveTo=function(a,b){this.ya.moveTo(a,b)};
g.quadraticCurveTo=function(a,b,c,d){this.ya.quadraticCurveTo(a,b,c,d)};g.rect=function(a,b,c,d){this.ya.rect(a,b,c,d)};g.restore=function(){this.ya.restore()};Uc.prototype.rotate=function(a){this.ya.rotate(a)};g=Uc.prototype;g.save=function(){this.ya.save()};g.setTransform=function(a,b,c,d,e,f){this.ya.setTransform(a,b,c,d,e,f)};g.scale=function(a,b){this.ya.scale(a,b)};g.stroke=function(){this.ya.stroke()};
g.transform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||this.ya.transform(a,b,c,d,e,f)};g.translate=function(a,b){this.ya.translate(a,b)};g.Hg=function(a){if(a instanceof ga&&a.type===$c){var b=a.qo;a=a.Gy;a>b?(this.scale(b/a,1),this.translate((a-b)/2,0)):b>a&&(this.scale(1,a/b),this.translate(0,(b-a)/2));this.Tq?this.clip():this.fill();a>b?(this.translate(-(a-b)/2,0),this.scale(1/(b/a),1)):b>a&&(this.translate(0,-(b-a)/2),this.scale(1,1/(a/b)))}else this.Tq?this.clip():this.fill()};
g.Cj=function(){this.Tq||this.stroke()};w.defineProperty(Uc,{Kp:"clipInsteadOfFill"},function(){return this.Tq},function(a){this.Tq=a});g=Uc.prototype;g.hB=function(a,b,c){this.Xs=a;this.Ys=b;this.zg=c};g.Wn=function(){this.shadowBlur=this.shadowOffsetY=this.shadowOffsetX=0};g.Xn=function(){this.shadowOffsetX=this.Xs;this.shadowOffsetY=this.Ys;this.shadowBlur=this.zg};
g.dA=function(a,b){var c=this.ya;if(void 0!==c.setLineDash)c.setLineDash(a),c.lineDashOffset=b;else if(void 0!==c.webkitLineDash)c.webkitLineDash=a,c.webkitLineDashOffset=b;else if(void 0!==c.mozDash)c.mozDash=a,c.mozDashOffset=b;else return!1;return!0};g.aA=function(){var a=this.ya;void 0!==a.setLineDash?(a.setLineDash(w.fo),a.lineDashOffset=0):void 0!==a.webkitLineDash?(a.webkitLineDash=w.fo,a.webkitLineDashOffset=0):void 0!==a.mozDash&&(a.mozDash=null,a.mozDashOffset=0)};
g.Ee=function(a){a&&(this.Cy="");this.By=this.Dy=""};
var ad=(Math.sqrt(2)-1)/3*4,bd=(new z(0,0)).Ga(),cd=(new A(0,0,0,0)).Ga(),dd=(new eb(0,0,0,0)).Ga(),jd=(new eb(2,2,2,2)).Ga(),kd=(new z(6,6)).Ga(),ld=(new z(-Infinity,-Infinity)).Ga(),md=(new z(Infinity,Infinity)).Ga(),nd=(new ha(0,0)).Ga(),od=(new ha(1,1)).Ga(),yd=(new ha(6,6)).Ga(),zd=(new ha(8,8)).Ga(),Ad=(new ha(10,10)).Ga(),Bd=(new ha(Infinity,Infinity)).Ga(),Cd=(new z(NaN,NaN)).Ga(),Dd=(new ha(NaN,NaN)).Ga(),Qd=(new A(NaN,NaN,NaN,NaN)).Ga(),Rd=(new L(.156,.156)).Ga(),Sd=(new L(.844,.844)).Ga(),
Td=new sa,Ud=new sa,Vd=null;function Wd(a){if(0>=a)return 0;var b=Vd;if(null===b){for(var b=[],c=0;2E3>=c;c++)b[c]=Math.sqrt(c);Vd=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)}function K(a,b){var c=a-b;return.5>c&&-.5<c}function Xa(a,b){var c=a-b;return 5E-8>c&&-5E-8<c}
function Xd(a,b,c,d,e,f,h){0>=e&&(e=1E-6);var k=0,l=0,m=0,n=0;a<c?(l=a,k=c):(l=c,k=a);b<d?(n=b,m=d):(n=d,m=b);if(a===c)return n<=h&&h<=m&&a-e<=f&&f<=a+e;if(b===d)return l<=f&&f<=k&&b-e<=h&&h<=b+e;k+=e;l-=e;if(l<=f&&f<=k&&(m+=e,n-=e,n<=h&&h<=m))if(k-l>m-n)if(a-c>e||c-a>e){if(f=(d-b)/(c-a)*(f-a)+b,f-e<=h&&h<=f+e)return!0}else return!0;else if(b-d>e||d-b>e){if(h=(c-a)/(d-b)*(h-b)+a,h-e<=f&&f<=h+e)return!0}else return!0;return!1}
function Yd(a,b,c,d,e,f,h,k,l,m,n,p){if(Xd(a,b,h,k,p,c,d)&&Xd(a,b,h,k,p,e,f))return Xd(a,b,h,k,p,m,n);var q=(a+c)/2,r=(b+d)/2,s=(c+e)/2,u=(d+f)/2;e=(e+h)/2;f=(f+k)/2;d=(q+s)/2;c=(r+u)/2;var s=(s+e)/2,u=(u+f)/2,t=(d+s)/2,x=(c+u)/2;return Yd(a,b,q,r,d,c,t,x,l,m,n,p)||Yd(t,x,s,u,e,f,h,k,l,m,n,p)}
function Zd(a,b,c,d,e,f,h,k,l,m){if(Xd(a,b,h,k,l,c,d)&&Xd(a,b,h,k,l,e,f))bb(m,a,b,0,0),bb(m,h,k,0,0);else{var n=(a+c)/2,p=(b+d)/2,q=(c+e)/2,r=(d+f)/2;e=(e+h)/2;f=(f+k)/2;d=(n+q)/2;c=(p+r)/2;var q=(q+e)/2,r=(r+f)/2,s=(d+q)/2,u=(c+r)/2;Zd(a,b,n,p,d,c,s,u,l,m);Zd(s,u,q,r,e,f,h,k,l,m)}}
function $d(a,b,c,d,e,f,h,k,l,m){if(Xd(a,b,h,k,l,c,d)&&Xd(a,b,h,k,l,e,f))0===m.length&&(m.push(a),m.push(b)),m.push(h),m.push(k);else{var n=(a+c)/2,p=(b+d)/2,q=(c+e)/2,r=(d+f)/2;e=(e+h)/2;f=(f+k)/2;d=(n+q)/2;c=(p+r)/2;var q=(q+e)/2,r=(r+f)/2,s=(d+q)/2,u=(c+r)/2;$d(a,b,n,p,d,c,s,u,l,m);$d(s,u,q,r,e,f,h,k,l,m)}}
function he(a,b,c,d,e,f,h,k,l,m,n,p,q,r){var s=1-l;a=a*s+c*l;b=b*s+d*l;c=c*s+e*l;d=d*s+f*l;e=e*s+h*l;f=f*s+k*l;k=a*s+c*l;h=b*s+d*l;c=c*s+e*l;d=d*s+f*l;m.x=a;m.y=b;n.x=k;n.y=h;p.x=k*s+c*l;p.y=h*s+d*l;q.x=c;q.y=d;r.x=e;r.y=f}function ie(a,b,c,d,e,f,h,k,l,m){if(Xd(a,b,e,f,m,c,d))return Xd(a,b,e,f,m,k,l);var n=(a+c)/2,p=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var q=(n+c)/2,r=(p+d)/2;return ie(a,b,n,p,q,r,h,k,l,m)||ie(q,r,c,d,e,f,h,k,l,m)}
function je(a,b,c,d,e,f,h,k){if(Xd(a,b,e,f,h,c,d))bb(k,a,b,0,0),bb(k,e,f,0,0);else{var l=(a+c)/2,m=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var n=(l+c)/2,p=(m+d)/2;je(a,b,l,m,n,p,h,k);je(n,p,c,d,e,f,h,k)}}function ke(a,b,c,d,e,f,h,k){if(Xd(a,b,e,f,h,c,d))0===k.length&&(k.push(a),k.push(b)),k.push(e),k.push(f);else{var l=(a+c)/2,m=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var n=(l+c)/2,p=(m+d)/2;ke(a,b,l,m,n,p,h,k);ke(n,p,c,d,e,f,h,k)}}
function le(a,b,c,d,e,f,h,k,l,m,n,p,q,r){0>=q&&(q=1E-6);if(Xd(a,b,h,k,q,c,d)&&Xd(a,b,h,k,q,e,f)){var s=(a-h)*(m-p)-(b-k)*(l-n);if(0===s)return!1;q=((a*k-b*h)*(l-n)-(a-h)*(l*p-m*n))/s;s=((a*k-b*h)*(m-p)-(b-k)*(l*p-m*n))/s;if((l>n?l-n:n-l)<(m>p?m-p:p-m)){if(h=l=0,b<k?(l=b,h=k):(l=k,h=b),s<l||s>h)return!1}else if(a<h?l=a:(l=h,h=a),q<l||q>h)return!1;r.x=q;r.y=s;return!0}var s=(a+c)/2,u=(b+d)/2;c=(c+e)/2;d=(d+f)/2;e=(e+h)/2;f=(f+k)/2;var t=(s+c)/2,x=(u+d)/2;c=(c+e)/2;d=(d+f)/2;var v=(t+c)/2,B=(x+d)/2,
y=(n-l)*(n-l)+(p-m)*(p-m),H=!1;le(a,b,s,u,t,x,v,B,l,m,n,p,q,r)&&(b=(r.x-l)*(r.x-l)+(r.y-m)*(r.y-m),b<y&&(y=b,H=!0));a=r.x;s=r.y;le(v,B,c,d,e,f,h,k,l,m,n,p,q,r)&&(b=(r.x-l)*(r.x-l)+(r.y-m)*(r.y-m),b<y?H=!0:(r.x=a,r.y=s));return H}
function me(a,b,c,d,e,f,h,k,l,m,n,p,q){var r=0;0>=q&&(q=1E-6);if(Xd(a,b,h,k,q,c,d)&&Xd(a,b,h,k,q,e,f)){q=(a-h)*(m-p)-(b-k)*(l-n);if(0===q)return r;var s=((a*k-b*h)*(l-n)-(a-h)*(l*p-m*n))/q,u=((a*k-b*h)*(m-p)-(b-k)*(l*p-m*n))/q;if(s>=n)return r;if((l>n?l-n:n-l)<(m>p?m-p:p-m)){if(a=l=0,b<k?(l=b,a=k):(l=k,a=b),u<l||u>a)return r}else if(a<h?(l=a,a=h):l=h,s<l||s>a)return r;0<q?r++:0>q&&r--}else{var s=(a+c)/2,u=(b+d)/2,t=(c+e)/2,x=(d+f)/2;e=(e+h)/2;f=(f+k)/2;d=(s+t)/2;c=(u+x)/2;var t=(t+e)/2,x=(x+f)/2,
v=(d+t)/2,B=(c+x)/2,r=r+me(a,b,s,u,d,c,v,B,l,m,n,p,q),r=r+me(v,B,t,x,e,f,h,k,l,m,n,p,q)}return r}
function Ia(a,b,c,d,e,f,h){if(Xa(a,c)){var k=0;c=0;b<d?(k=b,c=d):(k=d,c=b);d=f;if(d<k)return h.x=a,h.y=k,!1;if(d>c)return h.x=a,h.y=c,!1;h.x=a;h.y=d;return!0}if(Xa(b,d)){a<c?k=a:(k=c,c=a);d=e;if(d<k)return h.x=k,h.y=b,!1;if(d>c)return h.x=c,h.y=b,!1;h.x=d;h.y=b;return!0}k=((a-e)*(a-c)+(b-f)*(b-d))/((c-a)*(c-a)+(d-b)*(d-b));if(-5E-6>k)return h.x=a,h.y=b,!1;if(1.000005<k)return h.x=c,h.y=d,!1;h.x=a+k*(c-a);h.y=b+k*(d-b);return!0}
function ne(a,b,c,d,e,f,h,k,l){if(K(a,c)&&K(b,d))return l.x=a,l.y=b,!1;if(Xa(e,h)){if(Xa(a,c))return Ia(a,b,c,d,e,f,l),!1;f=(d-b)/(c-a)*(e-a)+b;return Ia(a,b,c,d,e,f,l)}k=(k-f)/(h-e);if(Xa(a,c)){f=k*(a-e)+f;c=h=0;b<d?(h=b,c=d):(h=d,c=b);if(f<h)return l.x=a,l.y=h,!1;if(f>c)return l.x=a,l.y=c,!1;l.x=a;l.y=f;return!0}h=(d-b)/(c-a);if(Xa(k,h))return Ia(a,b,c,d,e,f,l),!1;e=(h*a-k*e+f-b)/(h-k);if(Xa(h,0)){a<c?h=a:(h=c,c=a);if(e<h)return l.x=h,l.y=b,!1;if(e>c)return l.x=c,l.y=b,!1;l.x=e;l.y=b;return!0}f=
h*(e-a)+b;return Ia(a,b,c,d,e,f,l)}function oe(a,b,c,d,e,f,h,k,l){var m=1E21,n=a,p=b;if(ne(a,b,a,d,e,f,h,k,l)){var q=(l.x-e)*(l.x-e)+(l.y-f)*(l.y-f);q<m&&(m=q,n=l.x,p=l.y)}ne(c,b,c,d,e,f,h,k,l)&&(q=(l.x-e)*(l.x-e)+(l.y-f)*(l.y-f),q<m&&(m=q,n=l.x,p=l.y));ne(a,b,c,b,e,f,h,k,l)&&(q=(l.x-e)*(l.x-e)+(l.y-f)*(l.y-f),q<m&&(m=q,n=l.x,p=l.y));ne(a,d,c,d,e,f,h,k,l)&&(q=(l.x-e)*(l.x-e)+(l.y-f)*(l.y-f),q<m&&(m=q,n=l.x,p=l.y));l.x=n;l.y=p;return 1E21>m}
function pe(a,b,c,d,e,f,h,k,l){c=a-c;var m=e-h,n=h=0;0===c||0===m?0===c?(k=(f-k)/m,h=a,n=k*h+(f-k*e)):(d=(b-d)/c,h=e,n=d*h+(b-d*a)):(d=(b-d)/c,k=(f-k)/m,a=b-d*a,h=(f-k*e-a)/(d-k),n=d*h+a);l.l(h,n);return l}
function qe(a,b,c){var d=b.x,e=b.y,f=c.x,h=c.y,k=a.left,l=a.right,m=a.top,n=a.bottom;return d===f?(f=a=0,e<h?(a=e,f=h):(a=h,f=e),k<=d&&d<=l&&a<=n&&f>=m):e===h?(d<f?a=d:(a=f,f=d),m<=e&&e<=n&&a<=l&&f>=k):a.Ha(b)||a.Ha(c)||re(k,m,l,m,d,e,f,h)||re(l,m,l,n,d,e,f,h)||re(l,n,k,n,d,e,f,h)||re(k,n,k,m,d,e,f,h)?!0:!1}function re(a,b,c,d,e,f,h,k){return 0>=Ae(a,b,c,d,e,f)*Ae(a,b,c,d,h,k)&&0>=Ae(e,f,h,k,a,b)*Ae(e,f,h,k,c,d)}
function Ae(a,b,c,d,e,f){c-=a;d-=b;a=e-a;b=f-b;f=a*d-b*c;0===f&&(f=a*c+b*d,0<f&&(f=(a-c)*c+(b-d)*d,0>f&&(f=0)));return 0>f?-1:0<f?1:0}function Be(a){0>a&&(a+=360);360<=a&&(a-=360);return a}
function Ce(a,b,c,d){var e=Math.PI;d||(b*=e/180,c*=e/180);d=b<c?1:-1;var f=[],h=e/2,k=b;for(b=Math.min(2*e,Math.abs(c-b));1E-5<b;){c=k+d*Math.min(b,h);var e=(c-k)/2,l=a*Math.cos(e),m=a*Math.sin(e),n=-m,p=l*l+n*n,q=p+l*l+n*m,p=4/3*(Math.sqrt(2*p*q)-q)/(l*m-n*l),m=l-p*n,l=n+p*l,n=-l,p=e+k,e=Math.cos(p),p=Math.sin(p);f.push([0+a*Math.cos(k),0+a*Math.sin(k),0+m*e-l*p,0+m*p+l*e,0+m*e-n*p,0+m*p+n*e,0+a*Math.cos(c),0+a*Math.sin(c)]);b-=Math.abs(c-k);k=c}return f}
function Ka(a,b,c,d,e,f,h){c=Math.floor((a-c)/e)*e+c;d=Math.floor((b-d)/f)*f+d;var k=c;c+e-a<e/2&&(k=c+e);a=d;d+f-b<f/2&&(a=d+f);h.l(k,a)}function De(a,b){var c=Math.max(a,b),d=Math.min(a,b),e=1,f=1;do e=c%d,c=f=d,d=e;while(0<e);return f}
function Ee(a,b,c,d){var e=0>c,f=0>d,h=0,k=h=0;a<b?(h=1,k=0):(h=0,k=1);var l=0,m=0,n=0,p=0,l=0===h?a:b,n=0===h?c:d;if(0===h?e:f)n=-n;h=k;m=0===h?a:b;p=0===h?c:d;if(0===h?e:f)p=-p;a=a=0;if(0<p)if(0<n){b=l*l;a=m*m;l*=n;c=m*p;d=-a+c;e=-a+Math.sqrt(l*l+c*c);m=d;for(f=0;9999999999>f;++f){m=.5*(d+e);if(m===d||m===e)break;k=l/(m+b);h=c/(m+a);k=k*k+h*h-1;if(0<k)d=m;else if(0>k)e=m;else break}n=b*n/(m+b)-n;p=a*p/(m+a)-p;a=Math.sqrt(n*n+p*p)}else a=Math.abs(p-m);else p=l*l-m*m,a=l*n,a<p?(p=a/p,a=m*Math.sqrt(Math.abs(1-
p*p)),n=l*p-n,a=Math.sqrt(n*n+a*a)):a=Math.abs(n-l);return a}function Fe(a){1<arguments.length&&w.k("Geometry constructor can take at most one optional argument, the Geometry type.");w.lc(this);this.Q=!1;void 0===a&&(a=Ge);this.ma=a;this.Fb=this.yb=this.Gc=this.wc=0;this.Nj=new I(He);this.xv=this.Nj.C;this.hv=(new A).freeze();this.bb=!0;this.Iq=this.jo=null;this.Jq=NaN;this.di=vb;this.ei=Kb;this.No=this.Po=NaN;this.Ci=Ie}w.fa("Geometry",Fe);w.ji(Fe);
Fe.prototype.copy=function(){var a=new Fe;a.ma=this.ma;a.wc=this.wc;a.Gc=this.Gc;a.yb=this.yb;a.Fb=this.Fb;for(var b=this.Nj.n,c=b.length,d=a.Nj,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.xv=this.xv;a.hv.assign(this.hv);a.bb=this.bb;a.jo=this.jo;a.Iq=this.Iq;a.Jq=this.Jq;a.di=this.di.S();a.ei=this.ei.S();a.Po=this.Po;a.No=this.No;a.Ci=this.Ci;return a};var Je;Fe.Line=Je=w.p(Fe,"Line",0);var Ke;Fe.Rectangle=Ke=w.p(Fe,"Rectangle",1);var Se;Fe.Ellipse=Se=w.p(Fe,"Ellipse",2);var Ge;
Fe.Path=Ge=w.p(Fe,"Path",3);Fe.prototype.Ga=function(){this.freeze();Object.freeze(this);return this};Fe.prototype.freeze=function(){this.Q=!0;var a=this.cc;a.freeze();for(var a=a.n,b=a.length,c=0;c<b;c++)a[c].freeze();return this};Fe.prototype.Ra=function(){Object.isFrozen(this)&&w.k("cannot thaw constant: "+this);this.Q=!1;var a=this.cc;a.Ra();for(var a=a.n,b=a.length,c=0;c<b;c++)a[c].Ra();return this};
Fe.prototype.equalsApprox=Fe.prototype.Ic=function(a){if(!(a instanceof Fe))return!1;if(this.type!==a.type)return this.type===Je&&a.type===Ge?Te(this,a):a.type===Je&&this.type===Ge?Te(a,this):!1;if(this.type===Ge){var b=this.cc.n;a=a.cc.n;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Ic(a[d]))return!1;return!0}return K(this.ia,a.ia)&&K(this.ga,a.ga)&&K(this.D,a.D)&&K(this.F,a.F)};
function Te(a,b){if(a.type!==Je||b.type!==Ge)return!1;if(1===b.cc.count){var c=b.cc.da(0);if(1===c.vb.count&&K(a.ia,c.ia)&&K(a.ga,c.ga)&&(c=c.vb.da(0),c.type===Ue&&K(a.D,c.D)&&K(a.F,c.F)))return!0}return!1}var Ve;Fe.stringify=Ve=function(a){return a.toString()};Fe.prototype.fc=function(a){a.De===Fe?this.type=a:w.Ej(this,a)};
Fe.prototype.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Je:return 0>a?"M"+this.ia.toString()+" "+this.ga.toString()+"L"+this.D.toString()+" "+this.F.toString():"M"+this.ia.toFixed(a)+" "+this.ga.toFixed(a)+"L"+this.D.toFixed(a)+" "+this.F.toFixed(a);case Ke:var b=new A(this.ia,this.ga,0,0);b.tG(this.D,this.F,0,0);return 0>a?"M"+b.x.toString()+" "+b.y.toString()+"H"+b.right.toString()+"V"+b.bottom.toString()+"H"+b.left.toString()+"z":"M"+b.x.toFixed(a)+" "+b.y.toFixed(a)+"H"+b.right.toFixed(a)+
"V"+b.bottom.toFixed(a)+"H"+b.left.toFixed(a)+"z";case Se:b=new A(this.ia,this.ga,0,0);b.tG(this.D,this.F,0,0);if(0>a){var c=b.left.toString()+" "+(b.y+b.height/2).toString(),d=b.right.toString()+" "+(b.y+b.height/2).toString();return"M"+c+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+d+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+c}c=b.left.toFixed(a)+" "+(b.y+b.height/2).toFixed(a);d=b.right.toFixed(a)+" "+(b.y+b.height/2).toFixed(a);return"M"+c+"A"+(b.width/
2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+d+"A"+(b.width/2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+c;case Ge:for(var b="",c=this.cc.n,d=c.length,e=0;e<d;e++){var f=c[e];0<e&&(b+=" x ");f.bu&&(b+="F ");b+=f.toString(a)}return b;default:return this.type.toString()}};
Fe.fillPath=function(a){"string"!==typeof a&&w.wd(a,"string",Fe,"fillPath:str");a=a.split(/[Xx]/);for(var b=a.length,c="",d=0;d<b;d++)var e=a[d],c=null!==e.match(/[Ff]/)?0===d?c+e:c+("X"+(" "===e[0]?"":" ")+e):c+((0===d?"":"X ")+"F"+(" "===e[0]?"":" ")+e);return c};var We;
Fe.parse=We=function(a,b){function c(){return m>=u-1?!0:null!==l[m+1].match(/[A-Za-z]/)}function d(){m++;return l[m]}function e(){var a=new z(parseFloat(d()),parseFloat(d()));n===n.toLowerCase()&&(a.x=s.x+a.x,a.y=s.y+a.y);return a}function f(){return s=e()}function h(){return r=e()}function k(){return"c"!==p.toLowerCase()&&"s"!==p.toLowerCase()?s:new z(2*s.x-r.x,2*s.y-r.y)}void 0===b&&(b=!1);"string"!==typeof a&&w.wd(a,"string",Fe,"parse:str");a=a.replace(/,/gm," ");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFf])([UuBbMmZzLlHhVvCcSsQqTtAaFf])/gm,
"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFf])([UuBbMmZzLlHhVvCcSsQqTtAaFf])/gm,"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFf])([^\s])/gm,"$1 $2");a=a.replace(/([^\s])([UuBbMmZzLlHhVvCcSsQqTtAaFf])/gm,"$1 $2");a=a.replace(/([0-9])([+\-])/gm,"$1 $2");a=a.replace(/(\.[0-9]*)(\.)/gm,"$1 $2");a=a.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm,"$1 $3 $4 ");a=a.replace(/[\s\r\t\n]+/gm," ");a=a.replace(/^\s+|\s+$/g,"");for(var l=a.split(" "),m=-1,n="",p="",q=new z(0,0),r=new z(0,0),s=new z(0,
0),u=l.length,t=w.s(),x=!1,v=!1,B=!0,y=null;!(m>=u-1);)if(p=n,n=d(),""!==n)switch(n.toUpperCase()){case "X":B=!0;v=x=!1;break;case "M":y=f();null===t.Ub||!0===B?(M(t,y.x,y.y,x,!1,!v),B=!1):t.moveTo(y.x,y.y);for(q=s;!c();)y=f(),t.lineTo(y.x,y.y);break;case "L":for(;!c();)y=f(),t.lineTo(y.x,y.y);break;case "H":for(;!c();)s=y=new z((n===n.toLowerCase()?s.x:0)+parseFloat(d()),s.y),t.lineTo(s.x,s.y);break;case "V":for(;!c();)s=y=new z(s.x,(n===n.toLowerCase()?s.y:0)+parseFloat(d())),t.lineTo(s.x,s.y);
break;case "C":for(;!c();){var H=e(),E=h(),y=f();N(t,H.x,H.y,E.x,E.y,y.x,y.y)}break;case "S":for(;!c();)H=k(),E=h(),y=f(),N(t,H.x,H.y,E.x,E.y,y.x,y.y);break;case "Q":for(;!c();)E=h(),y=f(),Xe(t,E.x,E.y,y.x,y.y);break;case "T":for(;!c();)r=E=k(),y=f(),Xe(t,E.x,E.y,y.x,y.y);break;case "B":for(;!c();){var y=parseFloat(d()),H=parseFloat(d()),E=parseFloat(d()),V=parseFloat(d()),ba=parseFloat(d()),Q=ba,$=!1;c()||(Q=parseFloat(d()),c()||($=0!==parseFloat(d())));n===n.toLowerCase()&&(E+=s.x,V+=s.y);t.arcTo(y,
H,E,V,ba,Q,$)}break;case "A":for(;!c();)H=Math.abs(parseFloat(d())),E=Math.abs(parseFloat(d())),V=parseFloat(d()),ba=!!parseFloat(d()),Q=!!parseFloat(d()),y=f(),Ye(t,H,E,V,ba,Q,y.x,y.y);break;case "Z":y=t.o.cc.n[t.o.cc.length-1];O(t);s=q;break;case "F":y="";for(H=1;l[m+H];)if(null!==l[m+H].match(/[Uu]/))H++;else if(null===l[m+H].match(/[A-Za-z]/))H++;else{y=l[m+H];break}y.match(/[Mm]/)?x=!0:Ze(t);break;case "U":y="";for(H=1;l[m+H];)if(null!==l[m+H].match(/[Ff]/))H++;else if(null===l[m+H].match(/[A-Za-z]/))H++;
else{y=l[m+H];break}y.match(/[Mm]/)?v=!0:t.$a(!1)}q=t.o;w.q(t);if(b)for(t=q.cc.i;t.next();)y=t.value,y.bu=!0;return q};function $e(a,b){for(var c=a.length,d=w.K(),e=0;e<c;e++){var f=a[e];d.x=f[0];d.y=f[1];b.nb(d);f[0]=d.x;f[1]=d.y;d.x=f[2];d.y=f[3];b.nb(d);f[2]=d.x;f[3]=d.y;d.x=f[4];d.y=f[5];b.nb(d);f[4]=d.x;f[5]=d.y;d.x=f[6];d.y=f[7];b.nb(d);f[6]=d.x;f[7]=d.y}w.v(d)}
Fe.prototype.wx=function(){if(this.bb||this.xv!==this.cc.C)return!0;for(var a=this.cc.n,b=a.length,c=0;c<b;c++)if(a[c].wx())return!0;return!1};Fe.prototype.my=function(){this.bb=!1;this.Iq=this.jo=null;this.Jq=NaN;this.xv=this.cc.C;for(var a=this.cc.n,b=a.length,c=0;c<b;c++)a[c].my()};Fe.prototype.sh=function(){var a=this.hv;a.Ra();isNaN(this.Po)||isNaN(this.No)?a.l(0,0,0,0):a.l(0,0,this.Po,this.No);af(this,a,!1);bb(a,0,0,0,0);a.freeze()};
Fe.prototype.computeBoundsWithoutOrigin=Fe.prototype.rH=function(){var a=new A;af(this,a,!0);return a};
function af(a,b,c){switch(a.type){case Je:case Ke:case Se:c?b.l(a.wc,a.Gc,0,0):bb(b,a.wc,a.Gc,0,0);bb(b,a.yb,a.Fb,0,0);break;case Ge:var d=a.cc;a=d.n;for(var d=d.length,e=0;e<d;e++){var f=a[e];c&&0===e?b.l(f.ia,f.ga,0,0):bb(b,f.ia,f.ga,0,0);for(var h=f.vb.n,k=h.length,l=f.ia,m=f.ga,n=0;n<k;n++){var p=h[n];switch(p.type){case Ue:case of:l=p.D;m=p.F;bb(b,l,m,0,0);break;case pf:Zd(l,m,p.rc,p.Oc,p.Ah,p.Bh,p.D,p.F,.5,b);l=p.D;m=p.F;break;case qf:je(l,m,p.rc,p.Oc,p.D,p.F,.5,b);l=p.D;m=p.F;break;case rf:case sf:var q=
p.type===rf?tf(p,f):uf(p,f,l,m),r=q.length;if(0===r){l=p.ja;m=p.ra;bb(b,l,m,0,0);break}for(var p=null,s=0;s<r;s++)p=q[s],Zd(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],.5,b);null!==p&&(l=p[6],m=p[7]);break;default:w.k("Unknown Segment type: "+p.type)}}}break;default:w.k("Unknown Geometry type: "+a.type)}}Fe.prototype.normalize=Fe.prototype.normalize=function(){this.Q&&w.la(this);var a=this.rH();this.offset(-a.x,-a.y);return new z(-a.x,-a.y)};
Fe.prototype.offset=Fe.prototype.offset=function(a,b){this.Q&&w.la(this);this.transform(1,0,0,1,a,b);return this};Fe.prototype.scale=Fe.prototype.scale=function(a,b){this.Q&&w.la(this);this.transform(a,0,0,b,0,0);return this};Fe.prototype.rotate=Fe.prototype.rotate=function(a,b,c){this.Q&&w.la(this);void 0===b&&(b=0);void 0===c&&(c=0);var d=w.Ef();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);w.ue(d);return this};
Fe.prototype.transform=Fe.prototype.transform=function(a,b,c,d,e,f){var h=0,k=0;switch(this.type){case Je:case Ke:case Se:h=this.wc;k=this.Gc;this.wc=h*a+k*c+e;this.Gc=h*b+k*d+f;h=this.yb;k=this.Fb;this.yb=h*a+k*c+e;this.Fb=h*b+k*d+f;break;case Ge:for(var l=this.cc.n,m=l.length,n=0;n<m;n++){var p=l[n],h=p.ia,k=p.ga;p.ia=h*a+k*c+e;p.ga=h*b+k*d+f;for(var p=p.vb.n,q=p.length,r=0;r<q;r++){var s=p[r];switch(s.type){case Ue:case of:h=s.D;k=s.F;s.D=h*a+k*c+e;s.F=h*b+k*d+f;break;case pf:h=s.rc;k=s.Oc;s.rc=
h*a+k*c+e;s.Oc=h*b+k*d+f;h=s.Ah;k=s.Bh;s.Ah=h*a+k*c+e;s.Bh=h*b+k*d+f;h=s.D;k=s.F;s.D=h*a+k*c+e;s.F=h*b+k*d+f;break;case qf:h=s.rc;k=s.Oc;s.rc=h*a+k*c+e;s.Oc=h*b+k*d+f;h=s.D;k=s.F;s.D=h*a+k*c+e;s.F=h*b+k*d+f;break;case rf:h=s.ja;k=s.ra;s.ja=h*a+k*c+e;s.ra=h*b+k*d+f;0!==b&&(h=180*Math.atan2(b,a)/Math.PI,0>h&&(h+=360),s.ye+=h);0>a&&(s.ye=180-s.ye,s.of=-s.of);0>d&&(s.ye=-s.ye,s.of=-s.of);s.radiusX*=Math.sqrt(a*a+c*c);void 0!==s.radiusY&&(s.radiusY*=Math.sqrt(b*b+d*d));break;case sf:h=s.D;k=s.F;s.D=h*
a+k*c+e;s.F=h*b+k*d+f;0!==b&&(h=180*Math.atan2(b,a)/Math.PI,0>h&&(h+=360),s.Gj+=h);0>a&&(s.Gj=180-s.Gj,s.Wl=!s.Wl);0>d&&(s.Gj=-s.Gj,s.Wl=!s.Wl);s.radiusX*=Math.sqrt(a*a+c*c);s.radiusY*=Math.sqrt(b*b+d*d);break;default:w.k("Unknown Segment type: "+s.type)}}}}this.bb=!0;return this};
Fe.prototype.Ha=function(a,b,c,d){var e=a.x,f=a.y,h=this.jb.x-20;a=a.y;for(var k=0,l=0,m=0,n=0,p=0,q=0,r=this.cc.n,s=r.length,u=0;u<s;u++){var t=r[u];if(t.bu){if(c&&t.Ha(e,f,b))return!0;for(var x=t.vb,l=t.ia,m=t.ga,v=l,B=m,y=x.n,H=0;H<=x.length;H++){var E,V;H!==x.length?(E=y[H],V=E.type,p=E.D,q=E.F):(V=Ue,p=v,q=B);switch(V){case of:n=vf(e,f,h,a,l,m,v,B);if(isNaN(n))return!0;k+=n;v=p;B=q;break;case Ue:n=vf(e,f,h,a,l,m,p,q);if(isNaN(n))return!0;k+=n;break;case pf:n=me(l,m,E.rc,E.Oc,E.Ah,E.Bh,p,q,h,
a,e,f,.5);k+=n;break;case qf:n=me(l,m,(l+2*E.rc)/3,(m+2*E.Oc)/3,(2*E.rc+p)/3,(2*E.Oc+q)/3,p,q,h,a,e,f,.5);k+=n;break;case rf:case sf:V=E.type===rf?tf(E,t):uf(E,t,l,m);var ba=V.length;if(0===ba){n=vf(e,f,h,a,l,m,E.ja,E.ra);if(isNaN(n))return!0;k+=n;break}for(var Q=null,$=0;$<ba;$++){Q=V[$];if(0===$){n=vf(e,f,h,a,l,m,Q[0],Q[1]);if(isNaN(n))return!0;k+=n}n=me(Q[0],Q[1],Q[2],Q[3],Q[4],Q[5],Q[6],Q[7],h,a,e,f,.5);k+=n}null!==Q&&(p=Q[6],q=Q[7]);break;default:w.k("Unknown Segment type: "+E.type)}l=p;m=q}if(0!==
k)return!0;k=0}else if(t.Ha(e,f,d?b:b+2))return!0}return 0!==k};function vf(a,b,c,d,e,f,h,k){if(Xd(e,f,h,k,.05,a,b))return NaN;var l=(a-c)*(f-k);if(0===l)return 0;var m=((a*d-b*c)*(e-h)-(a-c)*(e*k-f*h))/l;b=(a*d-b*c)*(f-k)/l;if(m>=a)return 0;if((e>h?e-h:h-e)<(f>k?f-k:k-f)){if(e=a=0,f<k?(a=f,e=k):(a=k,e=f),b<a||b>e)return 0}else if(e<h?(a=e,e=h):a=h,m<a||m>e)return 0;return 0<l?1:-1}function wf(a,b,c,d){a=a.cc.n;for(var e=a.length,f=0;f<e;f++)if(a[f].Ha(b,c,d))return!0;return!1}
Fe.prototype.getPointAlongPath=Fe.prototype.XH=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new z);if(this.type===Je)return b.l(this.ia+a*(this.D-this.ia),this.ga+a*(this.F-this.ga)),b;for(var c=this.gA,d=this.lx,e=c.length,f=this.hA*a,h=0,k=0;k<e;k++)for(var l=d[k],m=l.length,n=0;n<m;n++){var p=l[n];if(h+p>=f)return d=(f-h)/p,c=c[k],k=c[2*n],e=c[2*n+1],b.l(k+(c[2*n+2]-k)*d,e+(c[2*n+3]-e)*d),b;h+=p}b.l(NaN,NaN);return b};
Fe.prototype.getFractionForPoint=Fe.prototype.TH=function(a){if(this.type===Je){var b=this.ia,c=this.ga,d=this.D,e=this.F;if(b!==d||c!==e){var f=a.x;a=a.y;var h=0,k=0;return b===d?(c<e?(h=c,k=e):(h=e,k=c),a<=h?h===c?0:1:a>=k?k===c?0:1:Math.abs(a-c)/(k-h)):c===e?(b<d?(h=b,k=d):(h=d,k=b),f<=h?h===b?0:1:f>=k?k===b?0:1:Math.abs(f-b)/(k-h)):((f-b)*(f-b)+(a-c)*(a-c))/((d-b)*(d-b)+(e-c)*(e-c))}}else if(this.type===Ke){if(b=this.ia,c=this.ga,d=this.D,e=this.F,b!==d||c!==e){var h=d-b,k=e-c,l=2*h+2*k,f=a.x;
a=a.y;f=Math.min(Math.max(f,b),d);a=Math.min(Math.max(a,c),e);var b=Math.abs(f-b),d=Math.abs(f-d),c=Math.abs(a-c),e=Math.abs(a-e),m=Math.min(b,d,c,e);if(m===c)return f/l;if(m===d)return(h+a)/l;if(m===e)return(2*h+k-f)/l;if(m===b)return(2*h+2*k-a)/l}}else{for(var e=this.gA,h=this.lx,k=this.hA,l=w.K(),c=Infinity,b=d=0,f=e.length,n=m=0,p=0;p<f;p++)for(var q=e[p],r=h[p],s=q.length,u=0;u<s;u+=2){var t=q[u],x=q[u+1];if(0!==u){Ia(m,n,t,x,a.x,a.y,l);var v=(l.x-a.x)*(l.x-a.x)+(l.y-a.y)*(l.y-a.y);v<c&&(c=v,
d=b,d+=Math.sqrt((l.x-m)*(l.x-m)+(l.y-n)*(l.y-n)));b+=r[(u-2)/2]}m=t;n=x}w.v(l);a=d/k;return 0>a?0:1<a?1:a}return 0};w.u(Fe,{gA:null},function(){xf(this);return this.jo});
function xf(a){if(null===a.jo){a.wx()&&a.my();var b=a.jo=[],c=a.Iq=[],d=[],e=[];if(a.type===Je)d.push(a.ia),d.push(a.ga),d.push(a.D),d.push(a.F),b.push(d),e.push(Math.sqrt((a.ia-a.D)*(a.ia-a.D)+(a.ga-a.F)*(a.ga-a.F))),c.push(e);else if(a.type===Ke)d.push(a.ia),d.push(a.ga),d.push(a.D),d.push(a.ga),d.push(a.D),d.push(a.F),d.push(a.ia),d.push(a.F),d.push(a.ia),d.push(a.ga),b.push(d),e.push(Math.abs(a.ia-a.D)),e.push(Math.abs(a.ga-a.F)),e.push(Math.abs(a.ia-a.D)),e.push(Math.abs(a.ga-a.F)),c.push(e);
else if(a.type===Se){var f=new He;f.ia=a.D;f.ga=(a.ga+a.F)/2;var h=new yf(rf);h.ye=0;h.of=360;h.ja=(a.ia+a.D)/2;h.ra=(a.ga+a.F)/2;h.radiusX=Math.abs(a.ia-a.D)/2;h.radiusY=Math.abs(a.ga-a.F)/2;f.add(h);a=tf(h,f);e=a.length;if(0===e)d.push(h.ja),d.push(h.ra);else for(var h=f.ia,f=f.ga,k=0;k<e;k++){var l=a[k];$d(h,f,l[2],l[3],l[4],l[5],l[6],l[7],.5,d);h=l[6];f=l[7]}b.push(d);c.push(zf(d))}else for(var m=a.cc.i;m.next();){var n=m.value,d=[];d.push(n.ia);d.push(n.ga);for(var h=n.ia,f=n.ga,p=h,q=f,r=n.vb.n,
s=r.length,u=0;u<s;u++){var t=r[u];switch(t.ma){case of:4<=d.length&&(b.push(d),c.push(zf(d)));d=[];d.push(t.D);d.push(t.F);h=t.D;f=t.F;p=h;q=f;break;case Ue:d.push(t.D);d.push(t.F);h=t.D;f=t.F;break;case pf:$d(h,f,t.Ad,t.Ve,t.mh,t.yg,t.yb,t.Fb,.5,d);h=t.D;f=t.F;break;case qf:ke(h,f,t.Ad,t.Ve,t.yb,t.Fb,.5,d);h=t.D;f=t.F;break;case rf:a=tf(t,n);e=a.length;if(0===e){d.push(t.ja);d.push(t.ra);h=t.ja;f=t.ra;break}for(k=0;k<e;k++)l=a[k],$d(h,f,l[2],l[3],l[4],l[5],l[6],l[7],.5,d),h=l[6],f=l[7];break;case sf:a=
uf(t,n,h,f);e=a.length;if(0===e){d.push(t.ja);d.push(t.ra);h=t.ja;f=t.ra;break}for(k=0;k<e;k++)l=a[k],$d(h,f,l[2],l[3],l[4],l[5],l[6],l[7],.5,d),h=l[6],f=l[7];break;default:w.k("Segment not of valid type: "+t.ma)}t.Ph&&(d.push(p),d.push(q))}4<=d.length&&(b.push(d),c.push(zf(d)))}}}w.u(Fe,{lx:null},function(){xf(this);return this.Iq});
w.u(Fe,{hA:null},function(){var a=this.Jq;if(isNaN(a)){if(this.type===Je)var a=Math.abs(this.D-this.ia),b=Math.abs(this.F-this.ga),a=Math.sqrt(a*a+b*b);else if(this.type===Ke)a=Math.abs(this.D-this.ia),b=Math.abs(this.F-this.ga),a=2*a+2*b;else for(var b=this.lx,c=b.length,d=a=0;d<c;d++)for(var e=b[d],f=e.length,h=0;h<f;h++)a+=e[h];this.Jq=a}return a});function zf(a){for(var b=[],c=0,d=0,e=a.length,f=0;f<e;f+=2){var h=a[f],k=a[f+1];0!==f&&(c=Math.sqrt(Na(c,d,h,k)),b.push(c));c=h;d=k}return b}
w.defineProperty(Fe,{type:"type"},function(){return this.ma},function(a){this.ma!==a&&(this.Q&&w.la(this,a),this.ma=a,this.bb=!0)});w.defineProperty(Fe,{ia:"startX"},function(){return this.wc},function(a){this.wc!==a&&(this.Q&&w.la(this,a),this.wc=a,this.bb=!0)});w.defineProperty(Fe,{ga:"startY"},function(){return this.Gc},function(a){this.Gc!==a&&(this.Q&&w.la(this,a),this.Gc=a,this.bb=!0)});
w.defineProperty(Fe,{D:"endX"},function(){return this.yb},function(a){this.yb!==a&&(this.Q&&w.la(this,a),this.yb=a,this.bb=!0)});w.defineProperty(Fe,{F:"endY"},function(){return this.Fb},function(a){this.Fb!==a&&(this.Q&&w.la(this,a),this.Fb=a,this.bb=!0)});w.defineProperty(Fe,{cc:"figures"},function(){return this.Nj},function(a){this.Nj!==a&&(this.Q&&w.la(this,a),this.Nj=a,this.bb=!0)});Fe.prototype.add=Fe.prototype.add=function(a){this.Nj.add(a);return this};
Fe.prototype.setSpots=function(a,b,c,d,e,f,h,k){this.Q&&w.la(this);this.di=(new L(a,b,e,f)).freeze();this.ei=(new L(c,d,h,k)).freeze();return this};w.defineProperty(Fe,{A:"spot1"},function(){return this.di},function(a){this.Q&&w.la(this,a);this.di=a.S()});w.defineProperty(Fe,{B:"spot2"},function(){return this.ei},function(a){this.Q&&w.la(this,a);this.ei=a.S()});w.defineProperty(Fe,{Zd:"defaultStretch"},function(){return this.Ci},function(a){this.Q&&w.la(this,a);this.Ci=a});
w.u(Fe,{jb:"bounds"},function(){this.wx()&&(this.my(),this.sh());return this.hv});function He(a,b,c,d){w.lc(this);this.Q=!1;void 0===c&&(c=!0);this.Bm=c;void 0===d&&(d=!0);this.Qo=d;this.wc=void 0!==a?a:0;this.Gc=void 0!==b?b:0;this.mp=new I(yf);this.uw=this.mp.C;this.bb=!0}w.fa("PathFigure",He);w.ji(He);
He.prototype.copy=function(){var a=new He;a.Bm=this.Bm;a.Qo=this.Qo;a.wc=this.wc;a.Gc=this.Gc;for(var b=this.mp.n,c=b.length,d=a.mp,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.uw=this.uw;a.bb=this.bb;return a};He.prototype.equalsApprox=He.prototype.Ic=function(a){if(!(a instanceof He&&K(this.ia,a.ia)&&K(this.ga,a.ga)))return!1;var b=this.vb.n;a=a.vb.n;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Ic(a[d]))return!1;return!0};g=He.prototype;
g.toString=function(a){void 0===a&&(a=-1);for(var b=0>a?"M"+this.ia.toString()+" "+this.ga.toString():"M"+this.ia.toFixed(a)+" "+this.ga.toFixed(a),c=this.vb.n,d=c.length,e=0;e<d;e++)b+=" "+c[e].toString(a);return b};g.freeze=function(){this.Q=!0;var a=this.vb;a.freeze();for(var b=a.n,a=a.length,c=0;c<a;c++)b[c].freeze();return this};g.Ra=function(){this.Q=!1;var a=this.vb;a.Ra();for(var a=a.n,b=a.length,c=0;c<b;c++)a[c].Ra();return this};
g.wx=function(){if(this.bb)return!0;var a=this.vb;if(this.uw!==a.C)return!0;for(var a=a.n,b=a.length,c=0;c<b;c++)if(a[c].bb)return!0;return!1};g.my=function(){this.bb=!1;var a=this.vb;this.uw=a.C;for(var a=a.n,b=a.length,c=0;c<b;c++){var d=a[c];d.bb=!1;d.ig=null}};w.defineProperty(He,{bu:"isFilled"},function(){return this.Bm},function(a){this.Q&&w.la(this,a);this.Bm=a});w.defineProperty(He,{Zl:"isShadowed"},function(){return this.Qo},function(a){this.Q&&w.la(this,a);this.Qo=a});
w.defineProperty(He,{ia:"startX"},function(){return this.wc},function(a){this.Q&&w.la(this,a);this.wc=a;this.bb=!0});w.defineProperty(He,{ga:"startY"},function(){return this.Gc},function(a){this.Q&&w.la(this,a);this.Gc=a;this.bb=!0});w.defineProperty(He,{vb:"segments"},function(){return this.mp},function(a){this.Q&&w.la(this,a);this.mp=a;this.bb=!0});He.prototype.add=He.prototype.add=function(a){this.mp.add(a);return this};
He.prototype.Ha=function(a,b,c){for(var d=this.ia,e=this.ga,f=d,h=e,k=this.vb.n,l=k.length,m=0;m<l;m++){var n=k[m];switch(n.type){case of:f=n.D;h=n.F;d=n.D;e=n.F;break;case Ue:if(Xd(d,e,n.D,n.F,c,a,b))return!0;d=n.D;e=n.F;break;case pf:if(Yd(d,e,n.rc,n.Oc,n.Ah,n.Bh,n.D,n.F,.5,a,b,c))return!0;d=n.D;e=n.F;break;case qf:if(ie(d,e,n.rc,n.Oc,n.D,n.F,.5,a,b,c))return!0;d=n.D;e=n.F;break;case rf:case sf:var p=n.type===rf?tf(n,this):uf(n,this,d,e),q=p.length;if(0===q){if(Xd(d,e,n.ja,n.ra,c,a,b))return!0;
d=n.ja;e=n.ra;break}for(var r=null,s=0;s<q;s++)if(r=p[s],0===s&&Xd(d,e,r[0],r[1],c,a,b)||Yd(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],.5,a,b,c))return!0;null!==r&&(d=r[6],e=r[7]);break;default:w.k("Unknown Segment type: "+n.type)}if(n.tx&&(d!==f||e!==h)&&Xd(d,e,f,h,c,a,b))return!0}return!1};
function yf(a,b,c,d,e,f,h,k){w.lc(this);this.Q=!1;void 0===a&&(a=Ue);this.ma=a;this.yb=void 0!==b?b:0;this.Fb=void 0!==c?c:0;void 0===d&&(d=0);void 0===e&&(e=0);void 0===f&&(f=0);void 0===h&&(h=0);a===sf?(a=f%360,0>a&&(a+=360),this.Ad=a,this.Ve=0,this.mh=Math.max(d,0),this.yg=Math.max(e,0),this.Vo="boolean"===typeof h?!!h:!1,this.oo=!!k):(this.Ad=d,this.Ve=e,a===rf&&(f=Math.max(f,0)),this.mh=f,"number"===typeof h?(a===rf&&(h=Math.max(h,0)),this.yg=h):this.yg=0,this.oo=this.Vo=!1);this.Ph=!1;this.bb=
!0;this.ig=null}w.fa("PathSegment",yf);w.ji(yf);yf.prototype.copy=function(){var a=new yf;a.ma=this.ma;a.yb=this.yb;a.Fb=this.Fb;a.Ad=this.Ad;a.Ve=this.Ve;a.mh=this.mh;a.yg=this.yg;a.Vo=this.Vo;a.oo=this.oo;a.Ph=this.Ph;a.bb=this.bb;return a};
yf.prototype.equalsApprox=yf.prototype.Ic=function(a){if(!(a instanceof yf)||this.type!==a.type||this.tx!==a.tx)return!1;switch(this.type){case of:case Ue:return K(this.D,a.D)&&K(this.F,a.F);case pf:return K(this.D,a.D)&&K(this.F,a.F)&&K(this.rc,a.rc)&&K(this.Oc,a.Oc)&&K(this.Ah,a.Ah)&&K(this.Bh,a.Bh);case qf:return K(this.D,a.D)&&K(this.F,a.F)&&K(this.rc,a.rc)&&K(this.Oc,a.Oc);case rf:return K(this.ye,a.ye)&&K(this.of,a.of)&&K(this.ja,a.ja)&&K(this.ra,a.ra)&&K(this.radiusX,a.radiusX)&&K(this.radiusY,
a.radiusY);case sf:return this.Wl===a.Wl&&this.xx===a.xx&&K(this.Gj,a.Gj)&&K(this.D,a.D)&&K(this.F,a.F)&&K(this.radiusX,a.radiusX)&&K(this.radiusY,a.radiusY);default:return!1}};yf.prototype.fc=function(a){a.De===yf?this.type=a:w.Ej(this,a)};
yf.prototype.toString=function(a){void 0===a&&(a=-1);var b="";switch(this.type){case of:b=0>a?"M"+this.D.toString()+" "+this.F.toString():"M"+this.D.toFixed(a)+" "+this.F.toFixed(a);break;case Ue:b=0>a?"L"+this.D.toString()+" "+this.F.toString():"L"+this.D.toFixed(a)+" "+this.F.toFixed(a);break;case pf:b=0>a?"C"+this.rc.toString()+" "+this.Oc.toString()+" "+this.Ah.toString()+" "+this.Bh.toString()+" "+this.D.toString()+" "+this.F.toString():"C"+this.rc.toFixed(a)+" "+this.Oc.toFixed(a)+" "+this.Ah.toFixed(a)+
" "+this.Bh.toFixed(a)+" "+this.D.toFixed(a)+" "+this.F.toFixed(a);break;case qf:b=0>a?"Q"+this.rc.toString()+" "+this.Oc.toString()+" "+this.D.toString()+" "+this.F.toString():"Q"+this.rc.toFixed(a)+" "+this.Oc.toFixed(a)+" "+this.D.toFixed(a)+" "+this.F.toFixed(a);break;case rf:b=0>a?"B"+this.ye.toString()+" "+this.of.toString()+" "+this.ja.toString()+" "+this.ra.toString()+" "+this.radiusX:"B"+this.ye.toFixed(a)+" "+this.of.toFixed(a)+" "+this.ja.toFixed(a)+" "+this.ra.toFixed(a)+" "+this.radiusX;
break;case sf:b=0>a?"A"+this.radiusX.toString()+" "+this.radiusY.toString()+" "+this.Gj.toString()+" "+(this.xx?1:0)+" "+(this.Wl?1:0)+" "+this.D.toString()+" "+this.F.toString():"A"+this.radiusX.toFixed(a)+" "+this.radiusY.toFixed(a)+" "+this.Gj.toFixed(a)+" "+(this.xx?1:0)+" "+(this.Wl?1:0)+" "+this.D.toFixed(a)+" "+this.F.toFixed(a);break;default:b=this.type.toString()}return b+(this.Ph?"z":"")};var of;yf.Move=of=w.p(yf,"Move",0);var Ue;yf.Line=Ue=w.p(yf,"Line",1);var pf;
yf.Bezier=pf=w.p(yf,"Bezier",2);var qf;yf.QuadraticBezier=qf=w.p(yf,"QuadraticBezier",3);var rf;yf.Arc=rf=w.p(yf,"Arc",4);var sf;yf.SvgArc=sf=w.p(yf,"SvgArc",4);yf.prototype.freeze=function(){this.Q=!0;return this};yf.prototype.Ra=function(){this.Q=!1;return this};yf.prototype.close=yf.prototype.close=function(){this.Ph=!0;return this};
function tf(a,b){if(null!==a.ig&&!1===b.bb)return a.ig;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.ig=[],a.ig;var e=a.Ad,f=a.Ve,h=Ce(c<d?c:d,a.ye,a.ye+a.of,!1);if(c!==d){var k=w.Ef();k.reset();c<d?k.scale(1,d/c):k.scale(c/d,1);$e(h,k);w.ue(k)}c=h.length;for(d=0;d<c;d++)k=h[d],k[0]+=e,k[1]+=f,k[2]+=e,k[3]+=f,k[4]+=e,k[5]+=f,k[6]+=e,k[7]+=f;a.ig=h;return a.ig}
function uf(a,b,c,d){function e(a,b,c,d){return(a*d<b*c?-1:1)*Math.acos((a*c+b*d)/(Math.sqrt(a*a+b*b)*Math.sqrt(c*c+d*d)))}if(null!==a.ig&&!1===b.bb)return a.ig;b=a.mh;var f=a.yg;if(0===b||0===f)return a.ig=[],a.ig;var h=Math.PI/180*a.Ad,k=a.Vo,l=a.oo,m=a.yb,n=a.Fb,p=Math.cos(h),q=Math.sin(h),r=p*(c-m)/2+q*(d-n)/2,h=-q*(c-m)/2+p*(d-n)/2,s=r*r/(b*b)+h*h/(f*f);1<s&&(b*=Math.sqrt(s),f*=Math.sqrt(s));s=(k===l?-1:1)*Math.sqrt((b*b*f*f-b*b*h*h-f*f*r*r)/(b*b*h*h+f*f*r*r));isNaN(s)&&(s=0);k=s*b*h/f;s=s*-f*
r/b;isNaN(k)&&(k=0);isNaN(s)&&(s=0);c=(c+m)/2+p*k-q*s;d=(d+n)/2+q*k+p*s;n=e(1,0,(r-k)/b,(h-s)/f);p=(r-k)/b;m=(h-s)/f;r=(-r-k)/b;k=(-h-s)/f;h=e(p,m,r,k);r=(p*r+m*k)/(Math.sqrt(p*p+m*m)*Math.sqrt(r*r+k*k));-1>=r?h=Math.PI:1<=r&&(h=0);!l&&0<h&&(h-=2*Math.PI);l&&0>h&&(h+=2*Math.PI);l=b>f?1:b/f;r=b>f?f/b:1;b=Ce(b>f?b:f,n,n+h,!0);f=w.Ef();f.reset();f.translate(c,d);f.rotate(a.Ad,0,0);f.scale(l,r);$e(b,f);w.ue(f);a.ig=b;return a.ig}
w.defineProperty(yf,{tx:"isClosed"},function(){return this.Ph},function(a){this.Ph!==a&&(this.Ph=a,this.bb=!0)});w.defineProperty(yf,{type:"type"},function(){return this.ma},function(a){this.Q&&w.la(this,a);this.ma=a;this.bb=!0});w.defineProperty(yf,{D:"endX"},function(){return this.yb},function(a){this.Q&&w.la(this,a);this.yb=a;this.bb=!0});w.defineProperty(yf,{F:"endY"},function(){return this.Fb},function(a){this.Q&&w.la(this,a);this.Fb=a;this.bb=!0});
w.defineProperty(yf,{rc:"point1X"},function(){return this.Ad},function(a){this.Q&&w.la(this,a);this.Ad=a;this.bb=!0});w.defineProperty(yf,{Oc:"point1Y"},function(){return this.Ve},function(a){this.Q&&w.la(this,a);this.Ve=a;this.bb=!0});w.defineProperty(yf,{Ah:"point2X"},function(){return this.mh},function(a){this.Q&&w.la(this,a);this.mh=a;this.bb=!0});w.defineProperty(yf,{Bh:"point2Y"},function(){return this.yg},function(a){this.Q&&w.la(this,a);this.yg=a;this.bb=!0});
w.defineProperty(yf,{ja:"centerX"},function(){return this.Ad},function(a){this.Q&&w.la(this,a);this.Ad=a;this.bb=!0});w.defineProperty(yf,{ra:"centerY"},function(){return this.Ve},function(a){this.Q&&w.la(this,a);this.Ve=a;this.bb=!0});w.defineProperty(yf,{radiusX:"radiusX"},function(){return this.mh},function(a){0>a&&w.Ea(a,">= zero",yf,"radiusX");this.Q&&w.la(this,a);this.mh=a;this.bb=!0});
w.defineProperty(yf,{radiusY:"radiusY"},function(){return this.yg},function(a){0>a&&w.Ea(a,">= zero",yf,"radiusY");this.Q&&w.la(this,a);this.yg=a;this.bb=!0});w.defineProperty(yf,{ye:"startAngle"},function(){return this.yb},function(a){this.yb!==a&&(this.Q&&w.la(this,a),a%=360,0>a&&(a+=360),this.yb=a,this.bb=!0)});w.defineProperty(yf,{of:"sweepAngle"},function(){return this.Fb},function(a){this.Q&&w.la(this,a);360<a&&(a=360);-360>a&&(a=-360);this.Fb=a;this.bb=!0});
w.defineProperty(yf,{Wl:"isClockwiseArc"},function(){return this.oo},function(a){this.Q&&w.la(this,a);this.oo=a;this.bb=!0});w.defineProperty(yf,{xx:"isLargeArc"},function(){return this.Vo},function(a){this.Q&&w.la(this,a);this.Vo=a;this.bb=!0});w.defineProperty(yf,{Gj:"xAxisRotation"},function(){return this.Ad},function(a){a%=360;0>a&&(a+=360);this.Q&&w.la(this,a);this.Ad=a;this.bb=!0});
function Af(){this.Z=null;this.Hz=(new z(0,0)).freeze();this.Py=(new z(0,0)).freeze();this.ev=this.aw=0;this.fv=1;this.Qv="";this.Ew=this.tv=!1;this.qv=this.gv=0;this.Ij=this.Cv=this.Nv=!1;this.ur=null;this.Cw=0;this.Bg=this.Bw=null}w.fa("InputEvent",Af);
Af.prototype.copy=function(){var a=new Af;a.Z=this.Z;a.Hz.assign(this.bf);a.Py.assign(this.ca);a.aw=this.aw;a.ev=this.ev;a.fv=this.fv;a.Qv=this.Qv;a.tv=this.tv;a.Ew=this.Ew;a.gv=this.gv;a.qv=this.qv;a.Nv=this.Nv;a.Cv=this.Cv;a.Ij=this.Ij;a.ur=this.ur;a.Cw=this.Cw;a.Bw=this.Bw;a.Bg=this.Bg;return a};
Af.prototype.toString=function(){var a="^";0!==this.ud&&(a+="M:"+this.ud);0!==this.button&&(a+="B:"+this.button);""!==this.key&&(a+="K:"+this.key);0!==this.Fe&&(a+="C:"+this.Fe);0!==this.Ml&&(a+="D:"+this.Ml);this.Ac&&(a+="h");this.bubbles&&(a+="b");null!==this.ca&&(a+="@"+this.ca.toString());return a};w.defineProperty(Af,{g:"diagram"},function(){return this.Z},function(a){this.Z=a});w.defineProperty(Af,{bf:"viewPoint"},function(){return this.Hz},function(a){w.G(a,z,Af,"viewPoint");this.Hz.assign(a)});
w.defineProperty(Af,{ca:"documentPoint"},function(){return this.Py},function(a){w.G(a,z,Af,"documentPoint");this.Py.assign(a)});Af.prototype.getMultiTouchViewPoint=Af.prototype.nx=function(a,b){var c=this.g;if(null===c)return b;Bf(c,this.event,a,b);return b};Af.prototype.getMultiTouchDocumentPoint=function(a,b){var c=this.g;if(null===c)return b;Bf(c,this.event,a,b);b.assign(c.rB(b));return b};w.defineProperty(Af,{ud:"modifiers"},function(){return this.aw},function(a){this.aw=a});
w.defineProperty(Af,{button:"button"},function(){return this.ev},function(a){this.ev=a;if(null===this.event)switch(a){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2}});w.defineProperty(Af,{buttons:"buttons"},function(){return this.fv},function(a){this.fv=a});w.defineProperty(Af,{key:"key"},function(){return this.Qv},function(a){this.Qv=a});w.defineProperty(Af,{Nl:"down"},function(){return this.tv},function(a){this.tv=a});
w.defineProperty(Af,{up:"up"},function(){return this.Ew},function(a){this.Ew=a});w.defineProperty(Af,{Fe:"clickCount"},function(){return this.gv},function(a){this.gv=a});w.defineProperty(Af,{Ml:"delta"},function(){return this.qv},function(a){this.qv=a});w.defineProperty(Af,{du:"isMultiTouch"},function(){return this.Nv},function(a){this.Nv=a});w.defineProperty(Af,{Ac:"handled"},function(){return this.Cv},function(a){this.Cv=a});
w.defineProperty(Af,{bubbles:"bubbles"},function(){return this.Ij},function(a){this.Ij=a});w.defineProperty(Af,{event:"event"},function(){return this.ur},function(a){this.ur=a});w.u(Af,{tj:"isTouchEvent"},function(){var a=window.TouchEvent;return a&&this.event instanceof a?!0:(a=window.PointerEvent)&&this.event instanceof a&&"touch"===this.event.pointerType});w.u(Af,{Ek:"isMac"},function(){return w.Ek});w.defineProperty(Af,{timestamp:"timestamp"},function(){return this.Cw},function(a){this.Cw=a});
w.defineProperty(Af,{Ug:"targetDiagram"},function(){return this.Bw},function(a){this.Bw=a});w.defineProperty(Af,{Pe:"targetObject"},function(){return this.Bg},function(a){this.Bg=a});w.defineProperty(Af,{control:"control"},function(){return 0!==(this.ud&1)},function(a){this.ud=a?this.ud|1:this.ud&-2});w.defineProperty(Af,{shift:"shift"},function(){return 0!==(this.ud&4)},function(a){this.ud=a?this.ud|4:this.ud&-5});
w.defineProperty(Af,{alt:"alt"},function(){return 0!==(this.ud&2)},function(a){this.ud=a?this.ud|2:this.ud&-3});w.defineProperty(Af,{mu:"meta"},function(){return 0!==(this.ud&8)},function(a){this.ud=a?this.ud|8:this.ud&-9});w.defineProperty(Af,{left:"left"},function(){var a=this.event;return null!==a&&a instanceof MouseEvent&&("mousedown"===a.type||"mouseup"===a.type)?0===this.button:0!==(this.buttons&1)},function(a){this.buttons=a?this.buttons|1:this.buttons&-2});
w.defineProperty(Af,{right:"right"},function(){var a=this.event;return null!==a&&a instanceof MouseEvent&&("mousedown"===a.type||"mouseup"===a.type)?2===this.button:0!==(this.buttons&2)},function(a){this.buttons=a?this.buttons|2:this.buttons&-3});w.defineProperty(Af,{jL:"middle"},function(){var a=this.event;return null!==a&&a instanceof MouseEvent&&("mousedown"===a.type||"mouseup"===a.type)?1===this.button:0!==(this.buttons&4)},function(a){this.buttons=a?this.buttons|4:this.buttons&-5});
function Cf(){this.Z=null;this.Qb="";this.iw=this.zw=null;this.Qq=!1}w.fa("DiagramEvent",Cf);Cf.prototype.copy=function(){var a=new Cf;a.Z=this.Z;a.Qb=this.Qb;a.zw=this.zw;a.iw=this.iw;a.Qq=this.Qq;return a};Cf.prototype.toString=function(){var a="*"+this.name;null!==this.jB&&(a+=":"+this.jB.toString());null!==this.OA&&(a+="("+this.OA.toString()+")");return a};w.defineProperty(Cf,{g:"diagram"},function(){return this.Z},function(a){this.Z=a});
w.defineProperty(Cf,{name:"name"},function(){return this.Qb},function(a){this.Qb=a});w.defineProperty(Cf,{jB:"subject"},function(){return this.zw},function(a){this.zw=a});w.defineProperty(Cf,{OA:"parameter"},function(){return this.iw},function(a){this.iw=a});w.defineProperty(Cf,{cancel:"cancel"},function(){return this.Qq},function(a){this.Qq!==a&&w.Gt("DiagramEvent.cancel","2.0");this.Qq=a});function Lf(){this.Rq=Mf;this.Tm=this.$v="";this.qs=this.rs=this.us=this.vs=this.ts=this.Z=this.ke=null}
w.fa("ChangedEvent",Lf);var Nf;Lf.Transaction=Nf=w.p(Lf,"Transaction",-1);var Mf;Lf.Property=Mf=w.p(Lf,"Property",0);var Of;Lf.Insert=Of=w.p(Lf,"Insert",1);var Pf;Lf.Remove=Pf=w.p(Lf,"Remove",2);Lf.prototype.clear=Lf.prototype.clear=function(){this.qs=this.rs=this.us=this.vs=this.ts=this.Z=this.ke=null};
Lf.prototype.copy=function(){var a=new Lf;a.Rq=this.Rq;a.$v=this.$v;a.Tm=this.Tm;a.ke=this.ke;a.Z=this.Z;a.ts=this.ts;var b=this.vs;a.vs=w.Qa(b)&&"function"===typeof b.S?b.S():b;b=this.us;a.us=w.Qa(b)&&"function"===typeof b.S?b.S():b;b=this.rs;a.rs=w.Qa(b)&&"function"===typeof b.S?b.S():b;b=this.qs;a.qs=w.Qa(b)&&"function"===typeof b.S?b.S():b;return a};Lf.prototype.fc=function(a){a.De===Lf?this.xc=a:w.Ej(this,a)};
Lf.prototype.toString=function(){var a="",a=this.xc===Nf?a+"* ":this.xc===Mf?a+(null!==this.ba?"!m":"!d"):a+((null!==this.ba?"!m":"!d")+this.xc);this.propertyName&&"string"===typeof this.propertyName&&(a+=" "+this.propertyName);this.nf&&this.nf!==this.propertyName&&(a+=" "+this.nf);a+=": ";this.xc===Nf?null!==this.oldValue&&(a+=" "+this.oldValue):(null!==this.object&&(a+=Qf(this.object)),null!==this.oldValue&&(a+="  old: "+Qf(this.oldValue)),null!==this.zj&&(a+=" "+this.zj),null!==this.newValue&&
(a+="  new: "+Qf(this.newValue)),null!==this.yj&&(a+=" "+this.yj));return a};Lf.prototype.getValue=Lf.prototype.ka=function(a){return a?this.oldValue:this.newValue};Lf.prototype.getParam=function(a){return a?this.zj:this.yj};Lf.prototype.canUndo=Lf.prototype.canUndo=function(){return null!==this.ba||null!==this.g?!0:!1};Lf.prototype.undo=Lf.prototype.undo=function(){this.canUndo()&&(null!==this.ba?this.ba.ln(this,!0):null!==this.g&&this.g.ln(this,!0))};
Lf.prototype.canRedo=Lf.prototype.canRedo=function(){return null!==this.ba||null!==this.g?!0:!1};Lf.prototype.redo=Lf.prototype.redo=function(){this.canRedo()&&(null!==this.ba?this.ba.ln(this,!1):null!==this.g&&this.g.ln(this,!1))};w.defineProperty(Lf,{ba:"model"},function(){return this.ke},function(a){this.ke=a});w.defineProperty(Lf,{g:"diagram"},function(){return this.Z},function(a){this.Z=a});w.defineProperty(Lf,{xc:"change"},function(){return this.Rq},function(a){this.Rq=a});
w.defineProperty(Lf,{nf:"modelChange"},function(){return this.$v},function(a){this.$v=a});w.defineProperty(Lf,{propertyName:"propertyName"},function(){return this.Tm},function(a){this.Tm=a});w.u(Lf,{oF:"isTransactionFinished"},function(){return this.Rq===Nf&&("CommittedTransaction"===this.Tm||"FinishedUndo"===this.Tm||"FinishedRedo"===this.Tm)});w.defineProperty(Lf,{object:"object"},function(){return this.ts},function(a){this.ts=a});
w.defineProperty(Lf,{oldValue:"oldValue"},function(){return this.vs},function(a){this.vs=a});w.defineProperty(Lf,{zj:"oldParam"},function(){return this.us},function(a){this.us=a});w.defineProperty(Lf,{newValue:"newValue"},function(){return this.rs},function(a){this.rs=a});w.defineProperty(Lf,{yj:"newParam"},function(){return this.qs},function(a){this.qs=a});
function F(a){1<arguments.length&&w.k("Model constructor can only take one optional argument, the Array of node data.");w.lc(this);this.fr=this.Qb="";this.Ji=!1;this.lz={};this.Ce=[];this.Ec=new ka(null,Object);this.ek="key";this.to=this.Zo=null;this.Xq=this.Yq=!1;this.Hq=null;this.Om="category";this.Di=new ka(null,J);this.ak=null;this.cj=!1;this.Gz=null;this.oa=new Rf;void 0!==a&&(this.cg=a)}w.fa("Model",F);
F.prototype.cloneProtected=function(a){a.Qb=this.Qb;a.fr=this.fr;a.Ji=this.Ji;a.ek=this.ek;a.Zo=this.Zo;a.to=this.to;a.Yq=this.Yq;a.Xq=this.Xq;a.Hq=this.Hq;a.Om=this.Om};F.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};F.prototype.clear=F.prototype.clear=function(){this.Ce=[];this.Ec.clear();this.Di.clear();this.oa.clear()};g=F.prototype;
g.toString=function(a){void 0===a&&(a=0);if(1<a)return this.mB();var b=(""!==this.name?this.name:"")+" Model";if(0<a){b+="\n node data:";a=this.cg;for(var c=w.Ya(a),d=0;d<c;d++)var e=w.Da(a,d),b=b+(" "+this.ub(e)+":"+Qf(e))}return b};
g.bo=function(){var a="";""!==this.name&&(a+=',\n  "name": '+this.quote(this.name));""!==this.Kl&&(a+=',\n  "dataFormat": '+this.quote(this.Kl));this.cb&&(a+=',\n  "isReadOnly": '+this.cb);"key"!==this.bm&&"string"===typeof this.bm&&(a+=',\n  "nodeKeyProperty": '+this.quote(this.bm));this.Xz&&(a+=',\n  "copiesArrays": true');this.Wz&&(a+=',\n  "copiesArrayObjects": true');"category"!==this.Rn&&"string"===typeof this.Rn&&(a+=',\n  "nodeCategoryProperty": '+this.quote(this.Rn));return a};
g.wu=function(a){a.name&&(this.name=a.name);a.dataFormat&&(this.Kl=a.dataFormat);a.isReadOnly&&(this.cb=a.isReadOnly);a.nodeKeyProperty&&(this.bm=a.nodeKeyProperty);a.copiesArrays&&(this.Xz=a.copiesArrays);a.copiesArrayObjects&&(this.Wz=a.copiesArrayObjects);a.nodeCategoryProperty&&(this.Rn=a.nodeCategoryProperty)};function Sf(a){return',\n  "modelData": '+Tf(a,a.Fk)}function Uf(a,b){var c=b.modelData;w.Qa(c)&&(a.zu(c),a.Fk=c)}
g.zB=function(){var a=this.Fk,b=!1,c;for(c in a)if(!Vf(c,a[c])){b=!0;break}a="";b&&(a=Sf(this));return a+',\n  "nodeDataArray": '+Wf(this,this.cg,!0)};g.RA=function(a){Uf(this,a);a=a.nodeDataArray;w.isArray(a)&&(this.zu(a),this.cg=a)};
function Xf(a,b,c,d){if(b===c)return!0;if(typeof b!==typeof c||"function"===typeof b||"function"===typeof c)return!1;if(Array.isArray(b)&&Array.isArray(c)){if(d.ka(b)===c)return!0;d.add(b,c);if(b.length!==c.length)return!1;for(var e=0;e<b.length;e++)if(!Xf(a,b[e],c[e],d))return!1;return!0}if(w.Qa(b)&&w.Qa(c)){if(d.ka(b)===c)return!0;d.add(b,c);for(e in b){var f=b[e];if(!Vf(e,f)){var h=c[e];if(void 0===h||!Xf(a,f,h,d))return!1}}for(var k in c)if(h=c[k],!Vf(k,h)&&(f=b[k],void 0===f||!Xf(a,f,h,d)))return!1;
return!0}return!1}function Yf(a,b,c){a[c]!==b[c]&&w.k("Model.computeJsonDifference: Model."+c+' is not the same in both models: "'+a[c]+'" and "'+b[c]+'"')}
g.AB=function(a){Yf(this,a,"nodeKeyProperty");this instanceof Zf&&Yf(this,a,"nodeParentKeyProperty");for(var b=new J,c=new J,d=(new J).Hc(this.Ec.pF),e=new ka,f=a.cg,h=0;h<f.length;h++){var k=f[h],l=a.ub(k);if(void 0!==l){d.remove(l);var m=this.te(l);null===m?(b.add(l),c.add(k)):Xf(this,m,k,e)||c.add(k)}else this.DA(k),l=this.ub(k),b.add(l),c.add(k)}f="";Xf(this,this.Fk,a.Fk,e)||(f+=Sf(this));0<b.count&&(f+=this.xy+Wf(this,b.dc(),!0));0<c.count&&(f+=this.IB+Wf(this,c.dc(),!0));0<d.count&&(f+=this.zy+
Wf(this,d.dc(),!0));return f};F.prototype.computeJsonDifference=F.prototype.computeJSONDifference=function(a,b){w.G(a,F,F,"computeJsonDifference:newmodel");void 0===b&&(b=this.constructor===F?"go.Model":this.constructor===P?"go.GraphLinksModel":this.constructor===Zf?"go.TreeModel":w.hf(this));return'{ "class": '+this.quote(b)+', "incremental": 1'+this.bo()+this.AB(a)+"}"};g=F.prototype;g.xy=',\n  "insertedNodeKeys": ';g.IB=',\n  "modifiedNodeData": ';g.zy=',\n  "removedNodeKeys": ';
g.yB=function(a,b){var c=this,d=!1,e=new J,f=new J,h=new J;a.Pf.each(function(a){a.ba===c&&("nodeDataArray"===a.nf?a.xc===Of?e.add(a.newValue):a.xc===Pf&&h.add(a.oldValue):c.Ge(a.object)?f.add(a.object):c.Fk===a.object&&a.xc===Mf&&(d=!0))});var k=new J;e.each(function(a){k.add(c.ub(a));b||f.add(a)});var l=new J;h.each(function(a){l.add(c.ub(a));b&&f.add(a)});var m="";d&&(m+=Sf(this));0<k.count&&(m+=(b?this.zy:this.xy)+Wf(this,k.dc(),!0));0<f.count&&(m+=this.IB+Wf(this,f.dc(),!0));0<l.count&&(m+=(b?
this.xy:this.zy)+Wf(this,l.dc(),!0));return m};
g.QA=function(a){Uf(this,a);var b=a.insertedNodeKeys;if(w.isArray(b))for(var c=w.Ya(b),d=0;d<c;d++){var e=w.Da(b,d),f=this.te(e);null===f&&(f=this.copyNodeData({}),this.gy(f,e),this.Al(f))}e=a.modifiedNodeData;if(w.isArray(e))for(c=w.Ya(e),d=0;d<c;d++)if(b=w.Da(e,d),f=this.ub(b),f=this.te(f),null!==f)for(var h in b)"__gohashid"!==h&&h!==this.bm&&this.setDataProperty(f,h,b[h]);a=a.removedNodeKeys;if(w.isArray(a))for(c=w.Ya(a),d=0;d<c;d++)e=w.Da(a,d),f=this.te(e),null!==f&&this.Xx(f)};
F.prototype.toIncrementalJson=F.prototype.toIncrementalJSON=function(a,b){w.G(a,Lf,F,"toIncrementalJson:e");a.xc!==Nf&&w.k("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+a.toString());var c=a.object;if(!(a.oF&&c instanceof $f))return'{ "incremental": 0 }';void 0===b&&(b=this.constructor===F?"go.Model":this.constructor===P?"go.GraphLinksModel":this.constructor===Zf?"go.TreeModel":w.hf(this));return'{ "class": '+this.quote(b)+', "incremental": 1'+this.bo()+this.yB(c,"FinishedUndo"===
a.propertyName)+"}"};F.prototype.toJson=F.prototype.toJSON=F.prototype.mB=function(a){void 0===a&&(a=this.constructor===F?"go.Model":this.constructor===P?"go.GraphLinksModel":this.constructor===Zf?"go.TreeModel":w.hf(this));return'{ "class": '+this.quote(a)+this.bo()+this.zB()+"}"};
F.prototype.applyIncrementalJson=F.prototype.applyIncrementalJSON=function(a){var b=null;if("string"===typeof a)if(window.JSON&&window.JSON.parse)try{b=window.JSON.parse(a)}catch(c){}else w.trace("WARNING: no JSON.parse available");else"object"===typeof a?b=a:w.k("Unable to modify a Model from: "+a);var d=b.incremental;"number"!==typeof d&&w.k("Unable to apply non-incremental changes to Model: "+a);0!==d&&(this.Tb("applyIncrementalJson"),this.QA(b),this.Fd("applyIncrementalJson"))};
F.fromJson=F.fromJSON=function(a,b){void 0===b&&(b=null);null!==b&&w.G(b,F,F,"fromJson:model");var c=null;if("string"===typeof a)if(window.JSON&&window.JSON.parse)try{c=window.JSON.parse(a)}catch(d){}else w.trace("WARNING: no JSON.parse available");else"object"===typeof a?c=a:w.k("Unable to construct a Model from: "+a);if(null===b){var e;e=null;var f=c["class"];if("string"===typeof f)try{var h=null;0===f.indexOf("go.")?(f=f.substr(3),h=da[f]):(h=da[f],void 0===h&&(h=window[f]));"function"===typeof h&&
(e=new h)}catch(k){}null===e||e instanceof F?b=e:w.k("Unable to construct a Model of declared class: "+c["class"])}null===b&&(b=new P);b.wu(c);b.RA(c);return b};
F.prototype.replaceJsonObjects=F.prototype.zu=function(a){if(w.isArray(a))for(var b=w.Ya(a),c=0;c<b;c++){var d=w.Da(a,c);w.Qa(d)&&w.jE(a,c,this.zu(d))}else if(w.Qa(a)){for(c in a)d=a[c],w.Qa(d)&&(d=this.zu(d),a[c]=d);if("object"===typeof a){d=a;c=a["class"];if("NaN"===c)d=NaN;else if("Date"===c)d=new Date(a.value);else if("go.Point"===c)d=new z(ig(a.x),ig(a.y));else if("go.Size"===c)d=new ha(ig(a.width),ig(a.height));else if("go.Rect"===c)d=new A(ig(a.x),ig(a.y),ig(a.width),ig(a.height));else if("go.Margin"===
c)d=new eb(ig(a.top),ig(a.right),ig(a.bottom),ig(a.left));else if("go.Spot"===c)d="string"===typeof a["enum"]?rb(a["enum"]):new L(ig(a.x),ig(a.y),ig(a.offsetX),ig(a.offsetY));else if("go.Brush"===c){if(d=new ga,d.type=pa(ga,a.type),"string"===typeof a.color&&(d.color=a.color),a.start instanceof L&&(d.start=a.start),a.end instanceof L&&(d.end=a.end),"number"===typeof a.startRadius&&(d.Ku=ig(a.startRadius)),"number"===typeof a.endRadius&&(d.It=ig(a.endRadius)),a=a.colorStops,w.Qa(a))for(b in a)d.addColorStop(parseFloat(b),
a[b])}else"go.Geometry"===c?(b=null,b="string"===typeof a.path?We(a.path):new Fe,b.type=pa(Fe,a.type),"number"===typeof a.startX&&(b.ia=ig(a.startX)),"number"===typeof a.startY&&(b.ga=ig(a.startY)),"number"===typeof a.endX&&(b.D=ig(a.endX)),"number"===typeof a.endY&&(b.F=ig(a.endY)),a.spot1 instanceof L&&(b.A=a.spot1),a.spot2 instanceof L&&(b.B=a.spot2),d=b):"go.EnumValue"===c&&(b=a.classType,0===b.indexOf("go.")&&(b=b.substr(3)),d=pa(da[b],a.name));a=d}}return a};
F.prototype.quote=function(a){for(var b="",c=a.length,d=0;d<c;d++){var e=a[d];if('"'===e||"\\"===e)b+="\\"+e;else if("\b"===e)b+="\\b";else if("\f"===e)b+="\\f";else if("\n"===e)b+="\\n";else if("\r"===e)b+="\\r";else if("\t"===e)b+="\\t";else var f=a.charCodeAt(d),b=16>f?b+("\\u000"+a.charCodeAt(d).toString(16)):32>f?b+("\\u00"+a.charCodeAt(d).toString(16)):8232===f?b+"\\u2028":8233===f?b+"\\u2029":b+e}return'"'+b+'"'};
F.prototype.writeJsonValue=F.prototype.Pu=function(a){return void 0===a?"undefined":null===a?"null":!0===a?"true":!1===a?"false":"string"===typeof a?this.quote(a):"number"===typeof a?Infinity===a?"9e9999":-Infinity===a?"-9e9999":isNaN(a)?'{"class":"NaN"}':a.toString():a instanceof Date?'{"class":"Date", "value":"'+a.toJSON()+'"}':a instanceof Number?this.Pu(a.valueOf()):w.isArray(a)?Wf(this,a):w.Qa(a)?Tf(this,a):"function"===typeof a?"null":a.toString()};
function Wf(a,b,c){void 0===c&&(c=!1);var d=w.Ya(b);if(0>=d)return"[]";var e=new ra;e.add("[ ");c&&1<d&&e.add("\n");for(var f=0;f<d;f++){var h=w.Da(b,f);void 0!==h&&(0<f&&(e.add(","),c&&e.add("\n")),e.add(a.Pu(h)))}c&&1<d&&e.add("\n");e.add(" ]");return e.toString()}function Vf(a,b){return void 0===b||"__gohashid"===a||"_"===a[0]||"function"===typeof b?!0:!1}function jg(a){return isNaN(a)?"NaN":Infinity===a?"9e9999":-Infinity===a?"-9e9999":a}
function Tf(a,b){var c=b;if(c instanceof z)b={"class":"go.Point",x:jg(c.x),y:jg(c.y)};else if(c instanceof ha)b={"class":"go.Size",width:jg(c.width),height:jg(c.height)};else if(c instanceof A)b={"class":"go.Rect",x:jg(c.x),y:jg(c.y),width:jg(c.width),height:jg(c.height)};else if(c instanceof eb)b={"class":"go.Margin",top:jg(c.top),right:jg(c.right),bottom:jg(c.bottom),left:jg(c.left)};else if(c instanceof L)b=c.fd()?{"class":"go.Spot",x:jg(c.x),y:jg(c.y),offsetX:jg(c.offsetX),offsetY:jg(c.offsetY)}:
{"class":"go.Spot","enum":c.toString()};else if(c instanceof ga){b={"class":"go.Brush",type:c.type.name};if(c.type===kg)b.color=c.color;else if(c.type===lg||c.type===$c)b.start=c.start,b.end=c.end,c.type===$c&&(0!==c.Ku&&(b.startRadius=jg(c.Ku)),isNaN(c.It)||(b.endRadius=jg(c.It)));if(null!==c.tk){for(var d={},c=c.tk.i;c.next();)d[c.key]=c.value;b.colorStops=d}}else if(c instanceof Fe)b={"class":"go.Geometry",type:c.type.name},0!==c.ia&&(b.startX=jg(c.ia)),0!==c.ga&&(b.startY=jg(c.ga)),0!==c.D&&(b.endX=
jg(c.D)),0!==c.F&&(b.endY=jg(c.F)),c.A.L(vb)||(b.spot1=c.A),c.B.L(Kb)||(b.spot2=c.B),c.type===Ge&&(b.path=Ve(c));else if(c instanceof ea)b={"class":"go.EnumValue",classType:w.hf(c.De),name:c.name};else if(c instanceof G||c instanceof D||c instanceof mg||c instanceof F||c instanceof ng||c instanceof og||c instanceof pg||c instanceof qg||c instanceof Rf||c instanceof $f)return w.trace("ERROR: trying to convert a GraphObject or Diagram or Model or Tool or Layout or UndoManager into JSON text: "+c.toString()),
"{}";var d="{",c=!0,e;for(e in b){var f=w.rb(b,e);if(!Vf(e,f))if(c?c=!1:d+=", ",d+='"'+e+'":',"points"===e&&f instanceof I&&f.ma===z){for(var h="[",f=f.i;f.next();){var k=f.value;1<h.length&&(h+=",");h+=a.Pu(k.x);h+=",";h+=a.Pu(k.y)}h+="]";d+=h}else d+=a.Pu(f)}return d+"}"}function ig(a){return"number"===typeof a?a:"NaN"===a?NaN:"9e9999"===a?Infinity:"-9e9999"===a?-Infinity:parseFloat(a)}
w.defineProperty(F,{name:"name"},function(){return this.Qb},function(a){var b=this.Qb;b!==a&&(w.j(a,"string",F,"name"),this.Qb=a,this.h("name",b,a))});w.defineProperty(F,{Kl:"dataFormat"},function(){return this.fr},function(a){var b=this.fr;b!==a&&(w.j(a,"string",F,"dataFormat"),this.fr=a,this.h("dataFormat",b,a))});w.defineProperty(F,{cb:"isReadOnly"},function(){return this.Ji},function(a){var b=this.Ji;b!==a&&(w.j(a,"boolean",F,"isReadOnly"),this.Ji=a,this.h("isReadOnly",b,a))});
w.defineProperty(F,{Fk:"modelData"},function(){return this.lz},function(a){var b=this.lz;b!==a&&(w.j(a,"object",F,"modelData"),this.lz=a,this.h("modelData",b,a),this.Hb(a))});F.prototype.addChangedListener=F.prototype.fn=function(a){w.j(a,"function",F,"addChangedListener:listener");null===this.ak&&(this.ak=new I("function"));this.ak.add(a)};
F.prototype.removeChangedListener=F.prototype.xu=function(a){w.j(a,"function",F,"removeChangedListener:listener");null!==this.ak&&(this.ak.remove(a),0===this.ak.count&&(this.ak=null))};F.prototype.Rw=function(a){this.wb||this.oa.XE(a);if(null!==this.ak){var b=this.ak,c=b.length;if(1===c)b=b.da(0),b(a);else if(0!==c)for(var d=b.dc(),e=0;e<c;e++)b=d[e],b(a)}};F.prototype.raiseChangedEvent=F.prototype.Wc=function(a,b,c,d,e,f,h){rg(this,"",a,b,c,d,e,f,h)};
F.prototype.raiseChanged=F.prototype.h=function(a,b,c,d,e){rg(this,"",Mf,a,this,b,c,d,e)};F.prototype.raiseDataChanged=F.prototype.PA=function(a,b,c,d,e,f){rg(this,"",Mf,b,a,c,d,e,f)};function rg(a,b,c,d,e,f,h,k,l){void 0===k&&(k=null);void 0===l&&(l=null);var m=new Lf;m.ba=a;m.xc=c;m.nf=b;m.propertyName=d;m.object=e;m.oldValue=f;m.zj=k;m.newValue=h;m.yj=l;a.Rw(m)}
w.defineProperty(F,{oa:"undoManager"},function(){return this.Gz},function(a){var b=this.Gz;b!==a&&(w.G(a,Rf,F,"undoManager"),null!==b&&b.hJ(this),this.Gz=a,null!==a&&a.$G(this))});w.defineProperty(F,{wb:"skipsUndoManager"},function(){return this.cj},function(a){w.j(a,"boolean",F,"skipsUndoManager");this.cj=a});
F.prototype.ln=function(a,b){if(null!==a&&a.ba===this)if(a.xc===Mf){var c=a.object,d=a.propertyName,e=a.ka(b);w.Ma(c,d,e)}else a.xc===Of?(c=a.yj,"nodeDataArray"===a.nf?(d=a.newValue,w.Qa(d)&&"number"===typeof c&&(e=this.ub(d),b?(w.Da(this.Ce,c)===d&&w.Fg(this.Ce,c),void 0!==e&&this.Ec.remove(e)):(w.Da(this.Ce,c)!==d&&w.qh(this.Ce,c,d),void 0!==e&&this.Ec.add(e,d)))):""===a.nf?(d=a.object,!w.isArray(d)&&a.propertyName&&(d=w.rb(a.object,a.propertyName)),w.isArray(d)&&"number"===typeof c&&(e=a.newValue,
b?w.Fg(d,c):w.qh(d,c,e))):w.k("unknown ChangedEvent.Insert modelChange: "+a.toString())):a.xc===Pf?(c=a.zj,"nodeDataArray"===a.nf?(d=a.oldValue,w.Qa(d)&&"number"===typeof c&&(e=this.ub(d),b?(w.Da(this.Ce,c)!==d&&w.qh(this.Ce,c,d),void 0!==e&&this.Ec.add(e,d)):(w.Da(this.Ce,c)===d&&w.Fg(this.Ce,c),void 0!==e&&this.Ec.remove(e)))):""===a.nf?(d=a.object,!w.isArray(d)&&a.propertyName&&(d=w.rb(a.object,a.propertyName)),w.isArray(d)&&"number"===typeof c&&(e=a.oldValue,b?w.qh(d,c,e):w.Fg(d,c))):w.k("unknown ChangedEvent.Remove modelChange: "+
a.toString())):a.xc!==Nf&&w.k("unknown ChangedEvent: "+a.toString())};F.prototype.startTransaction=F.prototype.Tb=function(a){return this.oa.Tb(a)};F.prototype.commitTransaction=F.prototype.Fd=function(a){return this.oa.Fd(a)};F.prototype.rollbackTransaction=F.prototype.nq=function(){return this.oa.nq()};F.prototype.updateTargetBindings=F.prototype.Hb=function(a,b){void 0===b&&(b="");rg(this,"SourceChanged",Nf,b,a,null,null)};
w.defineProperty(F,{bm:"nodeKeyProperty"},function(){return this.ek},function(a){var b=this.ek;b!==a&&(sg(a,F,"nodeKeyProperty"),""===a&&w.k("Model.nodeKeyProperty may not be the empty string"),0<this.Ec.count&&w.k("Cannot set Model.nodeKeyProperty when there is existing node data"),this.ek=a,this.h("nodeKeyProperty",b,a))});function sg(a,b,c){"string"!==typeof a&&"function"!==typeof a&&w.wd(a,"string or function",b,c)}
F.prototype.getKeyForNodeData=F.prototype.ub=function(a){if(null!==a){var b=this.ek;if(""!==b&&(b=w.rb(a,b),void 0!==b)){if(tg(b))return b;w.k("Key value for node data "+a+" is not a number or a string: "+b)}}};
F.prototype.setKeyForNodeData=F.prototype.gy=function(a,b){void 0!==b&&null!==b&&tg(b)||w.wd(b,"number or string",F,"setKeyForNodeData:key");if(null!==a){var c=this.ek;if(""!==c)if(this.Ge(a)){var d=w.rb(a,c);d!==b&&null===this.te(b)&&(w.Ma(a,c,b),this.Ec.remove(d),this.Ec.add(b,a),rg(this,"nodeKey",Mf,c,a,d,b),"string"===typeof c&&this.Hb(a,c),this.yu(d,b))}else w.Ma(a,c,b)}};
w.defineProperty(F,{cL:"makeUniqueKeyFunction"},function(){return this.Zo},function(a){var b=this.Zo;b!==a&&(null!==a&&w.j(a,"function",F,"makeUniqueKeyFunction"),this.Zo=a,this.h("makeUniqueKeyFunction",b,a))});function tg(a){return"number"===typeof a||"string"===typeof a}F.prototype.containsNodeData=F.prototype.Ge=function(a){var b=this.ub(a);return void 0===b?!1:this.Ec.ka(b)===a};
F.prototype.findNodeDataForKey=F.prototype.te=function(a){null===a&&w.k("Model.findNodeDataForKey:key must not be null");return void 0!==a&&tg(a)?this.Ec.ka(a):null};
w.defineProperty(F,{cg:"nodeDataArray"},function(){return this.Ce},function(a){var b=this.Ce;if(b!==a){w.Qz(a,F,"nodeDataArray");this.Ec.clear();this.tB();for(var c=w.Ya(a),d=0;d<c;d++){var e=w.Da(a,d);if(!w.Qa(e)){w.k("Model.nodeDataArray must only contain Objects, not: "+e);return}w.Yp(e)}this.Ce=a;for(var f=new I(Object),d=0;d<c;d++){var e=w.Da(a,d),h=this.ub(e);void 0===h?f.add(e):null!==this.Ec.ka(h)?f.add(e):this.Ec.add(h,e)}for(d=f.i;d.next();)e=d.value,this.DA(e),f=this.ub(e),void 0!==f&&
this.Ec.add(f,e);rg(this,"nodeDataArray",Mf,"nodeDataArray",this,b,a);for(d=0;d<c;d++)e=w.Da(a,d),this.mq(e),this.lq(e);this.lE();w.rI(a)||(this.cb=!0)}});
F.prototype.makeNodeDataKeyUnique=F.prototype.DA=function(a){if(null!==a){var b=this.ek;if(""!==b){var c=this.ub(a);if(void 0===c||this.Ec.contains(c)){var d=this.Zo;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.Ec.contains(c))){w.Ma(a,b,c);return}if("string"===typeof c){for(d=2;this.Ec.contains(c+d);)d++;w.Ma(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(d=-this.Ec.count-1;this.Ec.contains(d);)d--;w.Ma(a,b,d)}else w.k("Model.getKeyForNodeData returned something other than a string or a number: "+
c)}}}};F.prototype.addNodeData=F.prototype.Al=function(a){null!==a&&(w.Yp(a),this.Ge(a)||ug(this,a,!0))};function ug(a,b,c){var d=a.ub(b);if(void 0===d||a.Ec.ka(d)!==b)a.DA(b),d=a.ub(b),void 0===d?w.k("Model.makeNodeDataKeyUnique failed on "+b+".  Data not added to Model."):(a.Ec.add(d,b),d=null,c&&(d=w.Ya(a.Ce),w.qh(a.Ce,d,b)),rg(a,"nodeDataArray",Of,"nodeDataArray",a,null,b,null,d),a.mq(b),a.lq(b))}
F.prototype.addNodeDataCollection=function(a){if(w.isArray(a))for(var b=w.Ya(a),c=0;c<b;c++)this.Al(w.Da(a,c));else for(a=a.i;a.next();)this.Al(a.value)};F.prototype.removeNodeData=F.prototype.Xx=function(a){null!==a&&vg(this,a,!0)};function vg(a,b,c){var d=a.ub(b);void 0!==d&&a.Ec.remove(d);d=null;if(c){d=w.El(a.Ce,b);if(0>d)return;w.Fg(a.Ce,d)}rg(a,"nodeDataArray",Pf,"nodeDataArray",a,b,null,d,null);a.Nu(b)}
F.prototype.removeNodeDataCollection=function(a){if(w.isArray(a))for(var b=w.Ya(a),c=0;c<b;c++)this.Xx(w.Da(a,c));else for(a=a.i;a.next();)this.Xx(a.value)};g=F.prototype;g.yu=function(a,b){var c=wg(this,a);c instanceof J&&this.Di.add(b,c)};g.tB=function(){};g.mq=function(){};g.lq=function(){};g.Nu=function(){};function Mg(a,b,c){if(void 0!==b){var d=a.Di.ka(b);null===d&&(d=new J(Object),a.Di.add(b,d));d.add(c)}}
function Ng(a,b,c){if(void 0!==b){var d=a.Di.ka(b);d instanceof J&&(void 0===c||null===c?a.Di.remove(b):(d.remove(c),0===d.count&&a.Di.remove(b)))}}function wg(a,b){if(void 0===b)return null;var c=a.Di.ka(b);return c instanceof J?c:null}F.prototype.clearUnresolvedReferences=F.prototype.lE=function(a){void 0===a?this.Di.clear():this.Di.remove(a)};
w.defineProperty(F,{xK:"copyNodeDataFunction"},function(){return this.to},function(a){var b=this.to;b!==a&&(null!==a&&w.j(a,"function",F,"copyNodeDataFunction"),this.to=a,this.h("copyNodeDataFunction",b,a))});w.defineProperty(F,{Xz:"copiesArrays"},function(){return this.Yq},function(a){var b=this.Yq;b!==a&&(null!==a&&w.j(a,"boolean",F,"copiesArrays"),this.Yq=a,this.h("copiesArrays",b,a))});
w.defineProperty(F,{Wz:"copiesArrayObjects"},function(){return this.Xq},function(a){var b=this.Xq;b!==a&&(null!==a&&w.j(a,"boolean",F,"copiesArrayObjects"),this.Xq=a,this.h("copiesArrayObjects",b,a))});F.prototype.copyNodeData=function(a){if(null===a)return null;var b=null,b=this.to,b=null!==b?b(a,this):Og(this,a,!0);w.Qa(b)&&w.lc(b);return b};
function Og(a,b,c){if(a.Xz&&Array.isArray(b)){var d=[];for(c=0;c<b.length;c++){var e=Og(a,b[c],a.Wz);d.push(e)}w.lc(d);return d}if(c&&w.Qa(b)){c=(c=b.constructor)?new c:{};for(d in b)if("__gohashid"!==d){var e=w.rb(b,d),f;f=e;f instanceof G||f instanceof D||f instanceof mg||f instanceof Pg||f instanceof Qg||f instanceof ng||f instanceof og||f instanceof pg||f instanceof Af||f instanceof Cf?("_"!==d[0]&&w.trace('Warning: found GraphObject or Diagram reference when copying model data on property "'+
d+'" of data object: '+b.toString()+"  \nModel data should not have any references to a Diagram or any part of a diagram, such as: "+f.toString()),f=!0):f=f instanceof F||f instanceof Rf||f instanceof $f||f instanceof Lf?!0:!1;f||(e=Og(a,e,!1));w.Ma(c,d,e)}w.lc(c);return c}return b instanceof z?b.copy():b instanceof ha?b.copy():b instanceof A?b.copy():b instanceof L?b.copy():b instanceof eb?b.copy():b}
w.defineProperty(F,{bH:"afterCopyFunction"},function(){return this.Hq},function(a){var b=this.Hq;b!==a&&(null!==a&&w.j(a,"function",F,"afterCopyFunction"),this.Hq=a,this.h("afterCopyFunction",b,a))});var Rg=!1;
F.prototype.setDataProperty=function(a,b,c){if(this.Ge(a))if(b===this.bm)this.gy(a,c);else{if(b===this.Rn){this.by(a,c);return}}else!Rg&&a instanceof G&&(Rg=!0,w.trace('Model.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),w.trace("  Is that really your intent?"));var d=w.rb(a,b);d!==c&&(w.Ma(a,b,c),this.PA(a,b,d,c))};F.prototype.addArrayItem=function(a,b){this.tA(a,-1,b)};
F.prototype.insertArrayItem=F.prototype.tA=function(a,b,c){a===this.Ce&&w.k("Model.insertArrayItem or Model.addArrayItem should not be called on the Model.nodeDataArray");0>b&&(b=w.Ya(a));w.qh(a,b,c);rg(this,"",Of,"",a,null,c,null,b)};F.prototype.removeArrayItem=F.prototype.KF=function(a,b){void 0===b&&(b=-1);a===this.Ce&&w.k("Model.removeArrayItem should not be called on the Model.nodeDataArray");-1===b&&(b=w.Ya(a)-1);var c=w.Da(a,b);w.Fg(a,b);rg(this,"",Pf,"",a,c,null,b,null)};
w.defineProperty(F,{Rn:"nodeCategoryProperty"},function(){return this.Om},function(a){var b=this.Om;b!==a&&(sg(a,F,"nodeCategoryProperty"),this.Om=a,this.h("nodeCategoryProperty",b,a))});F.prototype.getCategoryForNodeData=F.prototype.lA=function(a){if(null===a)return"";var b=this.Om;if(""===b)return"";b=w.rb(a,b);if(void 0===b)return"";if("string"===typeof b)return b;w.k("getCategoryForNodeData found a non-string category for "+a+": "+b);return""};
F.prototype.setCategoryForNodeData=F.prototype.by=function(a,b){w.j(b,"string",F,"setCategoryForNodeData:cat");if(null!==a){var c=this.Om;if(""!==c)if(this.Ge(a)){var d=w.rb(a,c);void 0===d&&(d="");d!==b&&(w.Ma(a,c,b),rg(this,"nodeCategory",Mf,c,a,d,b))}else w.Ma(a,c,b)}};
function P(a,b){F.call(this);2<arguments.length&&w.k("GraphLinksModel constructor can only take two optional arguments, the Array of node data and the Array of link data.");this.df=[];this.Pi=new J(Object);this.$c=new ka(null,Object);this.ll="";this.pm=this.so=this.$o=null;this.Sh="from";this.Th="to";this.Km=this.Jm="";this.Im="category";this.ug="";this.dp="isGroup";this.jh="group";this.Zq=!1;void 0!==a&&(this.cg=a);void 0!==b&&(this.Mg=b)}w.La(P,F);w.fa("GraphLinksModel",P);
P.prototype.cloneProtected=function(a){F.prototype.cloneProtected.call(this,a);a.ll=this.ll;a.$o=this.$o;a.so=this.so;a.Sh=this.Sh;a.Th=this.Th;a.Jm=this.Jm;a.Km=this.Km;a.Im=this.Im;a.ug=this.ug;a.dp=this.dp;a.jh=this.jh;a.Zq=this.Zq};P.prototype.clear=P.prototype.clear=function(){F.prototype.clear.call(this);this.df=[];this.$c.clear();this.Pi.clear()};g=P.prototype;
g.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.mB();var b=(""!==this.name?this.name:"")+" GraphLinksModel";if(0<a){b+="\n node data:";a=this.cg;for(var c=w.Ya(a),d=0,d=0;d<c;d++)var e=w.Da(a,d),b=b+(" "+this.ub(e)+":"+Qf(e));b+="\n link data:";a=this.Mg;c=w.Ya(a);for(d=0;d<c;d++)e=w.Da(a,d),b+=" "+this.Sl(e)+"--\x3e"+this.Tl(e)}return b};
g.bo=function(){var a=F.prototype.bo.call(this),b="";"category"!==this.hu&&"string"===typeof this.hu&&(b+=',\n  "linkCategoryProperty": '+this.quote(this.hu));""!==this.wj&&"string"===typeof this.wj&&(b+=',\n  "linkKeyProperty": '+this.quote(this.wj));"from"!==this.In&&"string"===typeof this.In&&(b+=',\n  "linkFromKeyProperty": '+this.quote(this.In));"to"!==this.Jn&&"string"===typeof this.Jn&&(b+=',\n  "linkToKeyProperty": '+this.quote(this.Jn));""!==this.iu&&"string"===typeof this.iu&&(b+=',\n  "linkFromPortIdProperty": '+
this.quote(this.iu));""!==this.ku&&"string"===typeof this.ku&&(b+=',\n  "linkToPortIdProperty": '+this.quote(this.ku));""!==this.ju&&"string"===typeof this.ju&&(b+=',\n  "linkLabelKeysProperty": '+this.quote(this.ju));"isGroup"!==this.su&&"string"===typeof this.su&&(b+=',\n  "nodeIsGroupProperty": '+this.quote(this.su));"group"!==this.ru&&"string"===typeof this.ru&&(b+=',\n  "nodeGroupKeyProperty": '+this.quote(this.ru));return a+b};
g.wu=function(a){F.prototype.wu.call(this,a);a.linkKeyProperty&&(this.wj=a.linkKeyProperty);a.linkFromKeyProperty&&(this.In=a.linkFromKeyProperty);a.linkToKeyProperty&&(this.Jn=a.linkToKeyProperty);a.linkFromPortIdProperty&&(this.iu=a.linkFromPortIdProperty);a.linkToPortIdProperty&&(this.ku=a.linkToPortIdProperty);a.linkCategoryProperty&&(this.hu=a.linkCategoryProperty);a.linkLabelKeysProperty&&(this.ju=a.linkLabelKeysProperty);a.nodeIsGroupProperty&&(this.su=a.nodeIsGroupProperty);a.nodeGroupKeyProperty&&
(this.ru=a.nodeGroupKeyProperty)};g.zB=function(){var a=F.prototype.zB.call(this),b=',\n  "linkDataArray": '+Wf(this,this.Mg,!0);return a+b};g.RA=function(a){F.prototype.RA.call(this,a);a=a.linkDataArray;w.isArray(a)&&(this.zu(a),this.Mg=a)};
g.AB=function(a){if(!(a instanceof P))return w.k("Model.computeJsonDifference: newmodel must be a GraphLinksModel"),"";""===this.wj&&w.k("GraphLinksModel.linkKeyProperty must not be an empty string for .computeJsonDifference() to succeed.");var b=F.prototype.AB.call(this,a);Yf(this,a,"linkKeyProperty");Yf(this,a,"linkFromKeyProperty");Yf(this,a,"linkToKeyProperty");Yf(this,a,"linkLabelKeysProperty");Yf(this,a,"nodeIsGroupProperty");Yf(this,a,"nodeGroupKeyProperty");for(var c=new J,d=new J,e=(new J).Hc(this.$c.pF),
f=new ka,h=a.Mg,k=0;k<h.length;k++){var l=h[k],m=a.Rf(l);if(void 0!==m){e.remove(m);var n=this.Up(m);null===n?(c.add(m),d.add(l)):Xf(this,n,l,f)||d.add(l)}else this.CA(l),m=this.Rf(l),c.add(m),d.add(l)}a=b;0<c.count&&(a+=this.wy+Wf(this,c.dc(),!0));0<d.count&&(a+=this.HB+Wf(this,d.dc(),!0));0<e.count&&(a+=this.yy+Wf(this,e.dc(),!0));return a};g.wy=',\n  "insertedLinkKeys": ';g.HB=',\n  "modifiedLinkData": ';g.yy=',\n  "removedLinkKeys": ';
g.yB=function(a,b){""===this.wj&&w.k("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalJson() to succeed.");var c=F.prototype.yB.call(this,a,b),d=this,e=new J,f=new J,h=new J;a.Pf.each(function(a){a.ba===d&&("linkDataArray"===a.nf?a.xc===Of?e.add(a.newValue):a.xc===Pf&&h.add(a.oldValue):d.th(a.object)&&f.add(a.object))});var k=new J;e.each(function(a){k.add(d.Rf(a));b||f.add(a)});var l=new J;h.each(function(a){l.add(d.Rf(a));b&&f.add(a)});0<k.count&&(c+=(b?this.yy:this.wy)+
Wf(this,k.dc(),!0));0<f.count&&(c+=this.HB+Wf(this,f.dc(),!0));0<l.count&&(c+=(b?this.wy:this.yy)+Wf(this,l.dc(),!0));return c};
g.QA=function(a){F.prototype.QA.call(this,a);var b=a.insertedLinkKeys;if(w.isArray(b))for(var c=w.Ya(b),d=0;d<c;d++){var e=w.Da(b,d),f=this.Up(e);null===f&&(f=this.Uw({}),this.cG(f,e),this.vt(f))}e=a.modifiedLinkData;if(w.isArray(e))for(c=w.Ya(e),d=0;d<c;d++)if(b=w.Da(e,d),f=this.Rf(b),f=this.Up(f),null!==f)for(var h in b)"__gohashid"!==h&&h!==this.wj&&this.setDataProperty(f,h,b[h]);a=a.removedLinkKeys;if(w.isArray(a))for(c=w.Ya(a),d=0;d<c;d++)e=w.Da(a,d),f=this.Up(e),null!==f&&this.Wx(f)};
g.ln=function(a,b){if(a.xc===Of){var c=a.yj;if("linkDataArray"===a.nf){var d=a.newValue;if(w.Qa(d)&&"number"===typeof c){var e=this.Rf(d);b?(this.Pi.remove(d),w.Da(this.df,c)===d&&w.Fg(this.df,c),void 0!==e&&this.$c.remove(e)):(this.Pi.add(d),w.Da(this.df,c)!==d&&w.qh(this.df,c,d),void 0!==e&&this.$c.add(e,d))}return}if("linkLabelKeys"===a.nf){d=this.Ak(a.object);w.isArray(d)&&"number"===typeof c&&(b?(c=w.El(d,a.newValue),0<=c&&w.Fg(d,c)):0>w.El(d,a.newValue)&&w.qh(d,c,a.newValue));return}}else if(a.xc===
Pf){c=a.zj;if("linkDataArray"===a.nf){d=a.oldValue;w.Qa(d)&&"number"===typeof c&&(e=this.Rf(d),b?(this.Pi.add(d),w.Da(this.df,c)!==d&&w.qh(this.df,c,d),void 0!==e&&this.$c.add(e,d)):(this.Pi.remove(d),w.Da(this.df,c)===d&&w.Fg(this.df,c),void 0!==e&&this.$c.remove(e)));return}if("linkLabelKeys"===a.nf){d=this.Ak(a.object);w.isArray(d)&&"number"===typeof c&&(b?0>w.El(d,a.newValue)&&w.qh(d,c,a.newValue):(c=w.El(d,a.newValue),0<=c&&w.Fg(d,c)));return}}F.prototype.ln.call(this,a,b)};
w.defineProperty(P,{Oz:"archetypeNodeData"},function(){return this.pm},function(a){var b=this.pm;b!==a&&(null!==a&&w.G(a,Object,P,"archetypeNodeData"),this.pm=a,this.h("archetypeNodeData",b,a))});P.prototype.Kn=function(a){if(void 0!==a){var b=this.pm;if(null!==b){var c=this.te(a);null===c&&(c=this.copyNodeData(b),w.Ma(c,this.ek,a),this.Al(c))}return a}};
w.defineProperty(P,{In:"linkFromKeyProperty"},function(){return this.Sh},function(a){var b=this.Sh;b!==a&&(sg(a,P,"linkFromKeyProperty"),this.Sh=a,this.h("linkFromKeyProperty",b,a))});P.prototype.getFromKeyForLinkData=P.prototype.Sl=function(a){if(null!==a){var b=this.Sh;if(""!==b&&(b=w.rb(a,b),void 0!==b)){if(tg(b))return b;w.k("FromKey value for link data "+a+" is not a number or a string: "+b)}}};
P.prototype.setFromKeyForLinkData=P.prototype.$A=function(a,b){null===b&&(b=void 0);void 0===b||tg(b)||w.wd(b,"number or string",P,"setFromKeyForLinkData:key");if(null!==a){var c=this.Sh;if(""!==c)if(b=this.Kn(b),this.th(a)){var d=w.rb(a,c);d!==b&&(Ng(this,d,a),w.Ma(a,c,b),null===this.te(b)&&Mg(this,b,a),rg(this,"linkFromKey",Mf,c,a,d,b),"string"===typeof c&&this.Hb(a,c))}else w.Ma(a,c,b)}};
w.defineProperty(P,{Jn:"linkToKeyProperty"},function(){return this.Th},function(a){var b=this.Th;b!==a&&(sg(a,P,"linkToKeyProperty"),this.Th=a,this.h("linkToKeyProperty",b,a))});P.prototype.getToKeyForLinkData=P.prototype.Tl=function(a){if(null!==a){var b=this.Th;if(""!==b&&(b=w.rb(a,b),void 0!==b)){if(tg(b))return b;w.k("ToKey value for link data "+a+" is not a number or a string: "+b)}}};
P.prototype.setToKeyForLinkData=P.prototype.fB=function(a,b){null===b&&(b=void 0);void 0===b||tg(b)||w.wd(b,"number or string",P,"setToKeyForLinkData:key");if(null!==a){var c=this.Th;if(""!==c)if(b=this.Kn(b),this.th(a)){var d=w.rb(a,c);d!==b&&(Ng(this,d,a),w.Ma(a,c,b),null===this.te(b)&&Mg(this,b,a),rg(this,"linkToKey",Mf,c,a,d,b),"string"===typeof c&&this.Hb(a,c))}else w.Ma(a,c,b)}};
w.defineProperty(P,{iu:"linkFromPortIdProperty"},function(){return this.Jm},function(a){var b=this.Jm;b!==a&&(sg(a,P,"linkFromPortIdProperty"),a!==this.In&&a!==this.Jn||w.k("linkFromPortIdProperty name must not be the same as the GraphLinksModel.linkFromKeyProperty or linkToKeyProperty: "+a),this.Jm=a,this.h("linkFromPortIdProperty",b,a))});P.prototype.getFromPortIdForLinkData=P.prototype.UH=function(a){if(null===a)return"";var b=this.Jm;if(""===b)return"";a=w.rb(a,b);return void 0===a?"":a};
P.prototype.setFromPortIdForLinkData=P.prototype.aB=function(a,b){w.j(b,"string",P,"setFromPortIdForLinkData:portname");if(null!==a){var c=this.Jm;if(""!==c)if(this.th(a)){var d=w.rb(a,c);void 0===d&&(d="");d!==b&&(w.Ma(a,c,b),rg(this,"linkFromPortId",Mf,c,a,d,b),"string"===typeof c&&this.Hb(a,c))}else w.Ma(a,c,b)}};
w.defineProperty(P,{ku:"linkToPortIdProperty"},function(){return this.Km},function(a){var b=this.Km;b!==a&&(sg(a,P,"linkToPortIdProperty"),a!==this.In&&a!==this.Jn||w.k("linkFromPortIdProperty name must not be the same as the GraphLinksModel.linkFromKeyProperty or linkToKeyProperty: "+a),this.Km=a,this.h("linkToPortIdProperty",b,a))});P.prototype.getToPortIdForLinkData=P.prototype.YH=function(a){if(null===a)return"";var b=this.Km;if(""===b)return"";a=w.rb(a,b);return void 0===a?"":a};
P.prototype.setToPortIdForLinkData=P.prototype.gB=function(a,b){w.j(b,"string",P,"setToPortIdForLinkData:portname");if(null!==a){var c=this.Km;if(""!==c)if(this.th(a)){var d=w.rb(a,c);void 0===d&&(d="");d!==b&&(w.Ma(a,c,b),rg(this,"linkToPortId",Mf,c,a,d,b),"string"===typeof c&&this.Hb(a,c))}else w.Ma(a,c,b)}};w.defineProperty(P,{ju:"linkLabelKeysProperty"},function(){return this.ug},function(a){var b=this.ug;b!==a&&(sg(a,P,"linkLabelKeysProperty"),this.ug=a,this.h("linkLabelKeysProperty",b,a))});
P.prototype.getLabelKeysForLinkData=P.prototype.Ak=function(a){if(null===a)return w.fo;var b=this.ug;if(""===b)return w.fo;a=w.rb(a,b);return void 0===a?w.fo:a};
P.prototype.setLabelKeysForLinkData=P.prototype.dG=function(a,b){w.Qz(b,P,"setLabelKeysForLinkData:arr");if(null!==a){var c=this.ug;if(""!==c)if(this.th(a)){var d=w.rb(a,c);void 0===d&&(d=w.fo);if(d!==b){for(var e=w.Ya(d),f=0;f<e;f++){var h=w.Da(d,f);Ng(this,h,a)}w.Ma(a,c,b);e=w.Ya(b);for(f=0;f<e;f++)h=w.Da(b,f),null===this.te(h)&&Mg(this,h,a);rg(this,"linkLabelKeys",Mf,c,a,d,b);"string"===typeof c&&this.Hb(a,c)}}else w.Ma(a,c,b)}};
P.prototype.addLabelKeyForLinkData=P.prototype.cE=function(a,b){if(null!==b&&void 0!==b&&(tg(b)||w.wd(b,"number or string",P,"addLabelKeyForLinkData:key"),null!==a)){var c=this.ug;if(""!==c){var d=w.rb(a,c);if(void 0===d)c=[],c.push(b),this.dG(a,c);else if(w.isArray(d)){var e=w.El(d,b);0<=e||(e=w.Ya(d),w.qh(d,Infinity,b),this.th(a)&&(null===this.te(b)&&Mg(this,b,a),rg(this,"linkLabelKeys",Of,c,a,null,b,null,e)))}else w.k(c+" property is not an Array; cannot addLabelKeyForLinkData: "+a)}}};
P.prototype.removeLabelKeyForLinkData=P.prototype.gJ=function(a,b){if(null!==b&&void 0!==b&&(tg(b)||w.wd(b,"number or string",P,"removeLabelKeyForLinkData:key"),null!==a)){var c=this.ug;if(""!==c){var d=w.rb(a,c);if(w.isArray(d)){var e=w.El(d,b);0>e||(w.Fg(d,e),this.th(a)&&(Ng(this,b,a),rg(this,"linkLabelKeys",Pf,c,a,b,null,e,null)))}else void 0!==d&&w.k(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}};
w.defineProperty(P,{Mg:"linkDataArray"},function(){return this.df},function(a){var b=this.df;if(b!==a){w.Qz(a,P,"linkDataArray");this.$c.clear();for(var c=w.Ya(a),d=0;d<c;d++){var e=w.Da(a,d);if(!w.Qa(e)){w.k("GraphLinksModel.linkDataArray must only contain Objects, not: "+e);return}w.Yp(e)}this.df=a;if(""!==this.wj){for(var f=new I(Object),d=0;d<c;d++){var e=w.Da(a,d),h=this.Rf(e);void 0===h?f.add(e):null!==this.$c.ka(h)?f.add(e):this.$c.add(h,e)}for(d=f.i;d.next();)e=d.value,this.CA(e),f=this.Rf(e),
void 0!==f&&this.$c.add(f,e)}f=new J(Object);for(d=0;d<c;d++)e=w.Da(a,d),f.add(e);this.Pi=f;rg(this,"linkDataArray",Mf,"linkDataArray",this,b,a);for(d=0;d<c;d++)e=w.Da(a,d),Sg(this,e)}});w.defineProperty(P,{wj:"linkKeyProperty"},function(){return this.ll},function(a){var b=this.ll;if(b!==a){sg(a,P,"linkKeyProperty");this.ll=a;this.$c.clear();for(var c=w.Ya(this.Mg),d=0;d<c;d++){var e=w.Da(this.Mg,d),f=this.Rf(e);void 0!==f&&this.$c.add(f,e)}this.h("linkKeyProperty",b,a)}});
P.prototype.getKeyForLinkData=P.prototype.Rf=function(a){if(null!==a){var b=this.ll;if(""!==b&&(b=w.rb(a,b),void 0!==b)){if(tg(b))return b;w.k("Key value for link data "+a+" is not a number or a string: "+b)}}};
P.prototype.setKeyForLinkData=P.prototype.cG=function(a,b){void 0!==b&&null!==b&&tg(b)||w.wd(b,"number or string",P,"setKeyForLinkData:key");if(null!==a){var c=this.ll;if(""!==c)if(this.th(a)){var d=w.rb(a,c);d!==b&&null===this.Up(b)&&(w.Ma(a,c,b),this.$c.remove(d),this.$c.add(b,a),rg(this,"linkKey",Mf,c,a,d,b),"string"===typeof c&&this.Hb(a,c))}else w.Ma(a,c,b)}};
w.defineProperty(P,{dL:"makeUniqueLinkKeyFunction"},function(){return this.$o},function(a){var b=this.$o;b!==a&&(null!==a&&w.j(a,"function",P,"makeUniqueLinkKeyFunction"),this.$o=a,this.h("makeUniqueLinkKeyFunction",b,a))});P.prototype.findLinkDataForKey=P.prototype.Up=function(a){null===a&&w.k("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&tg(a)?this.$c.ka(a):null};
P.prototype.makeLinkDataKeyUnique=P.prototype.CA=function(a){if(null!==a){var b=this.ll;if(""!==b){var c=this.Rf(a);if(void 0===c||this.$c.contains(c)){var d=this.$o;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.$c.contains(c))){w.Ma(a,b,c);return}if("string"===typeof c){for(d=2;this.$c.contains(c+d);)d++;w.Ma(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(d=-this.$c.count-1;this.$c.contains(d);)d--;w.Ma(a,b,d)}else w.k("GraphLinksModel.getKeyForLinkData returned something other than a string or a number: "+
c)}}}};P.prototype.containsLinkData=P.prototype.th=function(a){return null===a?!1:this.Pi.contains(a)};P.prototype.addLinkData=P.prototype.vt=function(a){null!==a&&(w.Yp(a),this.th(a)||Tg(this,a,!0))};
function Tg(a,b,c){if(""!==a.wj){var d=a.Rf(b);if(void 0!==d&&a.$c.ka(d)===b)return;a.CA(b);d=a.Rf(b);if(void 0===d){w.k("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");return}a.$c.add(d,b)}a.Pi.add(b);d=null;c&&(d=w.Ya(a.df),w.qh(a.df,d,b));rg(a,"linkDataArray",Of,"linkDataArray",a,null,b,null,d);Sg(a,b)}P.prototype.addLinkDataCollection=function(a){if(w.isArray(a))for(var b=w.Ya(a),c=0;c<b;c++)this.vt(w.Da(a,c));else for(a=a.i;a.next();)this.vt(a.value)};
P.prototype.removeLinkData=P.prototype.Wx=function(a){null!==a&&Ug(this,a,!0)};function Ug(a,b,c){a.Pi.remove(b);var d=a.Rf(b);void 0!==d&&a.$c.remove(d);d=null;if(c){d=w.El(a.df,b);if(0>d)return;w.Fg(a.df,d)}rg(a,"linkDataArray",Pf,"linkDataArray",a,b,null,d,null);c=a.Sl(b);Ng(a,c,b);c=a.Tl(b);Ng(a,c,b);d=a.Ak(b);if(w.isArray(d))for(var e=w.Ya(d),f=0;f<e;f++)c=w.Da(d,f),Ng(a,c,b)}
P.prototype.removeLinkDataCollection=function(a){if(w.isArray(a))for(var b=w.Ya(a),c=0;c<b;c++)this.Wx(w.Da(a,c));else for(a=a.i;a.next();)this.Wx(a.value)};function Sg(a,b){var c=a.Sl(b),c=a.Kn(c);null===a.te(c)&&Mg(a,c,b);c=a.Tl(b);c=a.Kn(c);null===a.te(c)&&Mg(a,c,b);var d=a.Ak(b);if(w.isArray(d))for(var e=w.Ya(d),f=0;f<e;f++)c=w.Da(d,f),null===a.te(c)&&Mg(a,c,b)}
w.defineProperty(P,{wK:"copyLinkDataFunction"},function(){return this.so},function(a){var b=this.so;b!==a&&(null!==a&&w.j(a,"function",P,"copyLinkDataFunction"),this.so=a,this.h("copyLinkDataFunction",b,a))});P.prototype.copyLinkData=P.prototype.Uw=function(a){if(null===a)return null;var b=null,b=this.so,b=null!==b?b(a,this):Og(this,a,!0);w.Qa(b)&&(w.lc(b),""!==this.Sh&&w.Ma(b,this.Sh,void 0),""!==this.Th&&w.Ma(b,this.Th,void 0),""!==this.ug&&w.Ma(b,this.ug,[]));return b};
w.defineProperty(P,{su:"nodeIsGroupProperty"},function(){return this.dp},function(a){var b=this.dp;b!==a&&(sg(a,P,"nodeIsGroupProperty"),this.dp=a,this.h("nodeIsGroupProperty",b,a))});P.prototype.isGroupForNodeData=P.prototype.wA=function(a){if(null===a)return!1;var b=this.dp;return""===b?!1:w.rb(a,b)?!0:!1};w.defineProperty(P,{ru:"nodeGroupKeyProperty"},function(){return this.jh},function(a){var b=this.jh;b!==a&&(sg(a,P,"nodeGroupKeyProperty"),this.jh=a,this.h("nodeGroupKeyProperty",b,a))});
w.defineProperty(P,{pn:"copiesGroupKeyOfNodeData"},function(){return this.Zq},function(a){this.Zq!==a&&(w.j(a,"boolean",P,"copiesGroupKeyOfNodeData"),this.Zq=a)});P.prototype.getGroupKeyForNodeData=P.prototype.yn=function(a){if(null!==a){var b=this.jh;if(""!==b&&(b=w.rb(a,b),void 0!==b)){if(tg(b))return b;w.k("GroupKey value for node data "+a+" is not a number or a string: "+b)}}};
P.prototype.setGroupKeyForNodeData=P.prototype.bB=function(a,b){null===b&&(b=void 0);void 0===b||tg(b)||w.wd(b,"number or string",P,"setGroupKeyForNodeData:key");if(null!==a){var c=this.jh;if(""!==c)if(this.Ge(a)){var d=w.rb(a,c);d!==b&&(Ng(this,d,a),w.Ma(a,c,b),null===this.te(b)&&Mg(this,b,a),rg(this,"nodeGroupKey",Mf,c,a,d,b),"string"===typeof c&&this.Hb(a,c))}else w.Ma(a,c,b)}};
P.prototype.copyNodeData=function(a){if(null===a)return null;a=F.prototype.copyNodeData.call(this,a);this.pn||""===this.jh||void 0===w.rb(a,this.jh)||w.Ma(a,this.jh,void 0);return a};
P.prototype.setDataProperty=function(a,b,c){if(this.Ge(a))if(b===this.bm)this.gy(a,c);else{if(b===this.Rn){this.by(a,c);return}if(b===this.ru){this.bB(a,c);return}b===this.su&&w.k("GraphLinksModel.setDataProperty: property name must not be the nodeIsGroupProperty: "+b)}else if(this.th(a)){if(b===this.In){this.$A(a,c);return}if(b===this.Jn){this.fB(a,c);return}if(b===this.iu){this.aB(a,c);return}if(b===this.ku){this.gB(a,c);return}if(b===this.wj){this.cG(a,c);return}if(b===this.hu){this.bG(a,c);return}if(b===
this.ju){this.dG(a,c);return}}else!Rg&&a instanceof G&&(Rg=!0,w.trace('GraphLinksModel.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),w.trace("  Is that really your intent?"));var d=w.rb(a,b);d!==c&&(w.Ma(a,b,c),this.PA(a,b,d,c))};g=P.prototype;
g.yu=function(a,b){F.prototype.yu.call(this,a,b);for(var c=this.Ec.i;c.next();)this.UA(c.value,a,b);for(c=this.Pi.i;c.next();){var d=c.value,e=a,f=b;if(this.Sl(d)===e){var h=this.Sh;w.Ma(d,h,f);rg(this,"linkFromKey",Mf,h,d,e,f);"string"===typeof h&&this.Hb(d,h)}this.Tl(d)===e&&(h=this.Th,w.Ma(d,h,f),rg(this,"linkToKey",Mf,h,d,e,f),"string"===typeof h&&this.Hb(d,h));h=this.Ak(d);if(w.isArray(h))for(var k=w.Ya(h),l=this.ug,m=0;m<k;m++)w.Da(h,m)===e&&(w.jE(h,m,f),rg(this,"linkLabelKeys",Of,l,d,e,f,m,
m))}};g.UA=function(a,b,c){if(this.yn(a)===b){var d=this.jh;w.Ma(a,d,c);rg(this,"nodeGroupKey",Mf,d,a,b,c);"string"===typeof d&&this.Hb(a,d)}};g.tB=function(){F.prototype.tB.call(this);for(var a=this.Mg,b=w.Ya(a),c=0;c<b;c++){var d=w.Da(a,c);Sg(this,d)}};
g.mq=function(a){F.prototype.mq.call(this,a);a=this.ub(a);var b=wg(this,a);if(null!==b){for(var c=new I(Object),b=b.i;b.next();){var d=b.value;if(this.Ge(d)){if(this.yn(d)===a){var e=this.jh;rg(this,"nodeGroupKey",Mf,e,d,a,a);"string"===typeof e&&this.Hb(d,e);c.add(d)}}else if(this.Sl(d)===a&&(e=this.Sh,rg(this,"linkFromKey",Mf,e,d,a,a),"string"===typeof e&&this.Hb(d,e),c.add(d)),this.Tl(d)===a&&(e=this.Th,rg(this,"linkToKey",Mf,e,d,a,a),"string"===typeof e&&this.Hb(d,e),c.add(d)),e=this.Ak(d),w.isArray(e))for(var f=
w.Ya(e),h=this.ug,k=0;k<f;k++)w.Da(e,k)===a&&(rg(this,"linkLabelKeys",Of,h,d,a,a,k,k),c.add(d))}for(c=c.i;c.next();)Ng(this,a,c.value)}};g.lq=function(a){F.prototype.lq.call(this,a);var b=this.yn(a);null===this.te(b)&&Mg(this,b,a)};g.Nu=function(a){F.prototype.Nu.call(this,a);var b=this.yn(a);Ng(this,b,a)};w.defineProperty(P,{hu:"linkCategoryProperty"},function(){return this.Im},function(a){var b=this.Im;b!==a&&(sg(a,P,"linkCategoryProperty"),this.Im=a,this.h("linkCategoryProperty",b,a))});
P.prototype.getCategoryForLinkData=P.prototype.mx=function(a){if(null===a)return"";var b=this.Im;if(""===b)return"";b=w.rb(a,b);if(void 0===b)return"";if("string"===typeof b)return b;w.k("getCategoryForLinkData found a non-string category for "+a+": "+b);return""};
P.prototype.setCategoryForLinkData=P.prototype.bG=function(a,b){w.j(b,"string",P,"setCategoryForLinkData:cat");if(null!==a){var c=this.Im;if(""!==c)if(this.th(a)){var d=w.rb(a,c);void 0===d&&(d="");d!==b&&(w.Ma(a,c,b),rg(this,"linkCategory",Mf,c,a,d,b),"string"===typeof c&&this.Hb(a,c))}else w.Ma(a,c,b)}};
function Zf(a){1<arguments.length&&w.k("TreeModel constructor can only take one optional argument, the Array of node data.");F.call(this);this.kh="parent";this.$q=!1;this.Rm="parentLinkCategory";void 0!==a&&(this.cg=a)}w.La(Zf,F);w.fa("TreeModel",Zf);Zf.prototype.cloneProtected=function(a){F.prototype.cloneProtected.call(this,a);a.kh=this.kh;a.$q=this.$q;a.Rm=this.Rm};
Zf.prototype.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.mB();var b=(""!==this.name?this.name:"")+" TreeModel";if(0<a){b+="\n node data:";a=this.cg;for(var c=w.Ya(a),d=0;d<c;d++)var e=w.Da(a,d),b=b+(" "+this.ub(e)+":"+Qf(e))}return b};Zf.prototype.bo=function(){var a=F.prototype.bo.call(this),b="";"parent"!==this.tu&&"string"===typeof this.tu&&(b+=',\n  "nodeParentKeyProperty": '+this.quote(this.tu));return a+b};
Zf.prototype.wu=function(a){F.prototype.wu.call(this,a);a.nodeParentKeyProperty&&(this.tu=a.nodeParentKeyProperty)};Zf.prototype.Kn=function(a){return a};w.defineProperty(Zf,{tu:"nodeParentKeyProperty"},function(){return this.kh},function(a){var b=this.kh;b!==a&&(sg(a,Zf,"nodeParentKeyProperty"),this.kh=a,this.h("nodeParentKeyProperty",b,a))});
w.defineProperty(Zf,{qn:"copiesParentKeyOfNodeData"},function(){return this.$q},function(a){this.$q!==a&&(w.j(a,"boolean",Zf,"copiesParentKeyOfNodeData"),this.$q=a)});Zf.prototype.getParentKeyForNodeData=Zf.prototype.An=function(a){if(null!==a){var b=this.kh;if(""!==b&&(b=w.rb(a,b),void 0!==b)){if(tg(b))return b;w.k("ParentKey value for node data "+a+" is not a number or a string: "+b)}}};
Zf.prototype.setParentKeyForNodeData=Zf.prototype.oi=function(a,b){null===b&&(b=void 0);void 0===b||tg(b)||w.wd(b,"number or string",Zf,"setParentKeyForNodeData:key");if(null!==a){var c=this.kh;if(""!==c)if(b=this.Kn(b),this.Ge(a)){var d=w.rb(a,c);d!==b&&(Ng(this,d,a),w.Ma(a,c,b),null===this.te(b)&&Mg(this,b,a),rg(this,"nodeParentKey",Mf,c,a,d,b),"string"===typeof c&&this.Hb(a,c))}else w.Ma(a,c,b)}};
w.defineProperty(Zf,{vL:"parentLinkCategoryProperty"},function(){return this.Rm},function(a){var b=this.Rm;b!==a&&(sg(a,Zf,"parentLinkCategoryProperty"),this.Rm=a,this.h("parentLinkCategoryProperty",b,a))});Zf.prototype.getParentLinkCategoryForNodeData=Zf.prototype.WH=function(a){if(null===a)return"";var b=this.Rm;if(""===b)return"";b=w.rb(a,b);if(void 0===b)return"";if("string"===typeof b)return b;w.k("getParentLinkCategoryForNodeData found a non-string category for "+a+": "+b);return""};
Zf.prototype.setParentLinkCategoryForNodeData=Zf.prototype.wJ=function(a,b){w.j(b,"string",Zf,"setParentLinkCategoryForNodeData:cat");if(null!==a){var c=this.Rm;if(""!==c)if(this.Ge(a)){var d=w.rb(a,c);void 0===d&&(d="");d!==b&&(w.Ma(a,c,b),rg(this,"parentLinkCategory",Mf,c,a,d,b),"string"===typeof c&&this.Hb(a,c))}else w.Ma(a,c,b)}};
Zf.prototype.copyNodeData=function(a){if(null===a)return null;a=F.prototype.copyNodeData.call(this,a);this.qn||""===this.kh||void 0===w.rb(a,this.kh)||w.Ma(a,this.kh,void 0);return a};
Zf.prototype.setDataProperty=function(a,b,c){if(this.Ge(a))if(b===this.bm)this.gy(a,c);else{if(b===this.Rn){this.by(a,c);return}if(b===this.tu){this.oi(a,c);return}}else!Rg&&a instanceof G&&(Rg=!0,w.trace('TreeModel.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),w.trace("  Is that really your intent?"));var d=w.rb(a,b);d!==c&&(w.Ma(a,b,c),this.PA(a,b,d,c))};g=Zf.prototype;g.yu=function(a,b){F.prototype.yu.call(this,a,b);for(var c=this.Ec.i;c.next();)this.UA(c.value,a,b)};
g.UA=function(a,b,c){if(this.An(a)===b){var d=this.kh;w.Ma(a,d,c);rg(this,"nodeParentKey",Mf,d,a,b,c);"string"===typeof d&&this.Hb(a,d)}};g.mq=function(a){F.prototype.mq.call(this,a);a=this.ub(a);var b=wg(this,a);if(null!==b){for(var c=new I(Object),b=b.i;b.next();){var d=b.value;if(this.Ge(d)&&this.An(d)===a){var e=this.kh;rg(this,"nodeParentKey",Mf,e,d,a,a);"string"===typeof e&&this.Hb(d,e);c.add(d)}}for(c=c.i;c.next();)Ng(this,a,c.value)}};
g.lq=function(a){F.prototype.lq.call(this,a);var b=this.An(a),b=this.Kn(b);null===this.te(b)&&Mg(this,b,a)};g.Nu=function(a){F.prototype.Nu.call(this,a);var b=this.An(a);Ng(this,b,a)};
function Vg(a,b,c){w.lc(this);this.Q=!1;void 0===a?a="":w.j(a,"string",Vg,"constructor:targetprop");void 0===b?b=a:w.j(b,"string",Vg,"constructor:sourceprop");void 0===c?c=null:null!==c&&w.j(c,"function",Vg,"constructor:conv");this.DD=-1;this.Bg=null;this.yp=a;this.xp=this.it=0;this.ww=null;this.Pr=!1;this.op=b;this.Wq=c;this.hs=Wg;this.Pq=null;this.Xy=new J}w.fa("Binding",Vg);
Vg.prototype.copy=function(){var a=new Vg;a.yp=this.yp;a.it=this.it;a.xp=this.xp;a.ww=this.ww;a.Pr=this.Pr;a.op=this.op;a.Wq=this.Wq;a.hs=this.hs;a.Pq=this.Pq;return a};var Wg;Vg.OneWay=Wg=w.p(Vg,"OneWay",1);var Xg;Vg.TwoWay=Xg=w.p(Vg,"TwoWay",2);Vg.parseEnum=function(a,b){w.j(a,"function",Vg,"parseEnum:ctor");w.mb(b,a,Vg,"parseEnum:defval");return function(c){c=pa(a,c);return null===c?b:c}};Vg.prototype.fc=function(a){a.De===Vg?this.mode=a:w.Ej(this,a)};var Qf;
Vg.toString=Qf=function(a){var b=a;w.Qa(a)&&(a.text?b=a.text:a.name?b=a.name:void 0!==a.key?b=a.key:void 0!==a.id?b=a.id:a.constructor===Object&&(a.Text?b=a.Text:a.Name?b=a.Name:void 0!==a.Key?b=a.Key:void 0!==a.Id?b=a.Id:void 0!==a.ID&&(b=a.ID)));return void 0===b?"undefined":null===b?"null":b.toString()};Vg.prototype.toString=function(){return"Binding("+this.jy+":"+this.gG+(-1!==this.hm?" "+this.hm:"")+" "+this.mode.name+")"};Vg.prototype.freeze=function(){this.Q=!0;return this};
Vg.prototype.Ra=function(){this.Q=!1;return this};w.defineProperty(Vg,{hm:null},function(){return this.DD},function(a){this.Q&&w.la(this);w.j(a,"number",Vg,"targetId");this.DD=a});w.defineProperty(Vg,{jy:"targetProperty"},function(){return this.yp},function(a){this.Q&&w.la(this);w.j(a,"string",Vg,"targetProperty");this.yp=a});w.defineProperty(Vg,{yq:"sourceName"},function(){return this.ww},function(a){this.Q&&w.la(this);null!==a&&w.j(a,"string",Vg,"sourceName");this.ww=a;null!==a&&(this.Pr=!1)});
w.defineProperty(Vg,{zx:"isToModel"},function(){return this.Pr},function(a){this.Q&&w.la(this);w.j(a,"boolean",Vg,"isToModel");this.Pr=a});w.defineProperty(Vg,{gG:"sourceProperty"},function(){return this.op},function(a){this.Q&&w.la(this);w.j(a,"string",Vg,"sourceProperty");this.op=a});w.defineProperty(Vg,{uH:"converter"},function(){return this.Wq},function(a){this.Q&&w.la(this);null!==a&&w.j(a,"function",Vg,"converter");this.Wq=a});
w.defineProperty(Vg,{hH:"backConverter"},function(){return this.Pq},function(a){this.Q&&w.la(this);null!==a&&w.j(a,"function",Vg,"backConverter");this.Pq=a});w.defineProperty(Vg,{mode:"mode"},function(){return this.hs},function(a){this.Q&&w.la(this);w.mb(a,Vg,Vg,"mode");this.hs=a});Vg.prototype.makeTwoWay=Vg.prototype.HI=function(a){void 0===a&&(a=null);null!==a&&w.j(a,"function",Vg,"makeTwoWay");this.mode=Xg;this.hH=a;return this};
Vg.prototype.ofObject=Vg.prototype.Kx=function(a){void 0===a&&(a="");this.yq=a;this.zx=!1;return this};Vg.prototype.ofModel=function(){this.yq=null;this.zx=!0;return this};function Yg(a,b,c){a=a.yq;var d=null;return d=null===a||""===a?b:"/"===a?c.U:"."===a?c:".."===a?c.O:b.sd(a)}
Vg.prototype.updateTarget=Vg.prototype.vG=function(a,b,c){var d=this.op;if(void 0===c||""===d||d===c){c=this.yp;var e=this.Wq;if(null===e&&""===c)w.trace("Binding error: target property is the empty string: "+this.toString());else{var f=b;""!==d&&(f=w.rb(b,d));if(void 0!==f)if(null===e)""!==c&&w.Ma(a,c,f);else try{if(""!==c){var h=e(f,a);w.Ma(a,c,h)}else e(f,a)}catch(k){}}}};
Vg.prototype.updateSource=Vg.prototype.ky=function(a,b,c,d){if(this.hs===Xg){var e=this.yp;if(void 0===c||e===c){c=this.op;var f=this.Pq,h=a;""!==e&&(h=w.rb(a,e));if(void 0!==h&&!this.Xy.contains(a))try{this.Xy.add(a);var k=null!==d?d.g:null,l=null!==k?k.ba:null;if(null===f)if(""!==c)null!==l?l.setDataProperty(b,c,h):w.Ma(b,c,h);else{if(null!==l&&null!==d&&0<=d.fu&&null!==d.O&&Array.isArray(d.O.eq)){var m=d.fu,n=d.O.eq;l.KF(n,m);l.tA(n,m,h)}}else try{if(""!==c){var p=f(h,b,l);null!==l?l.setDataProperty(b,
c,p):w.Ma(b,c,p)}else p=f(h,b,l),void 0!==p&&null!==l&&null!==d&&0<=d.fu&&null!==d.O&&Array.isArray(d.O.eq)&&(m=d.fu,n=d.O.eq,l.KF(n,m),l.tA(n,m,p))}catch(q){}}finally{this.Xy.remove(a)}}}};function $f(){this.BG=(new I(Lf)).freeze();this.Qb="";this.IC=!1}w.fa("Transaction",$f);$f.prototype.toString=function(a){var b="Transaction: "+this.name+" "+this.Pf.count.toString()+(this.$t?"":", incomplete");if(void 0!==a&&0<a){a=this.Pf.count;for(var c=0;c<a;c++){var d=this.Pf.da(c);null!==d&&(b+="\n  "+d.toString())}}return b};
$f.prototype.clear=$f.prototype.clear=function(){var a=this.Pf;a.Ra();for(var b=a.count-1;0<=b;b--){var c=a.da(b);null!==c&&c.clear()}a.clear();a.freeze()};$f.prototype.canUndo=$f.prototype.canUndo=function(){return this.$t};$f.prototype.undo=$f.prototype.undo=function(){if(this.canUndo())for(var a=this.Pf.count-1;0<=a;a--){var b=this.Pf.da(a);null!==b&&b.undo()}};$f.prototype.canRedo=$f.prototype.canRedo=function(){return this.$t};
$f.prototype.redo=$f.prototype.redo=function(){if(this.canRedo())for(var a=this.Pf.count,b=0;b<a;b++){var c=this.Pf.da(b);null!==c&&c.redo()}};w.u($f,{Pf:"changes"},function(){return this.BG});w.defineProperty($f,{name:"name"},function(){return this.Qb},function(a){this.Qb=a});w.defineProperty($f,{$t:"isComplete"},function(){return this.IC},function(a){this.IC=a});
function Rf(){this.mz=new J(F);this.cf=!1;this.FG=(new I($f)).freeze();this.dh=-1;this.XC=999;this.Ki=!1;this.pv=null;this.xl=0;this.SB=!1;this.ih=(new I("string")).freeze();this.cp=new I("number");this.Yy=!0;this.hz=!1}w.fa("UndoManager",Rf);
Rf.prototype.toString=function(a){for(var b="UndoManager "+this.pj+"<"+this.history.count+"<="+this.uF,b=b+"[",c=this.zF.count,d=0;d<c;d++)0<d&&(b+=" "),b+=this.zF.da(d);b+="]";if(void 0!==a&&0<a)for(c=this.history.count,d=0;d<c;d++)b+="\n "+this.history.da(d).toString(a-1);return b};
Rf.prototype.clear=Rf.prototype.clear=function(){var a=this.history;a.Ra();for(var b=a.count-1;0<=b;b--){var c=a.da(b);null!==c&&c.clear()}a.clear();this.dh=-1;a.freeze();this.Ki=!1;this.pv=null;this.xl=0;this.ih.Ra();this.ih.clear();this.ih.freeze();this.cp.clear()};Rf.prototype.addModel=Rf.prototype.$G=function(a){this.mz.add(a)};Rf.prototype.removeModel=Rf.prototype.hJ=function(a){this.mz.remove(a)};
Rf.prototype.startTransaction=Rf.prototype.Tb=function(a){void 0===a&&(a="");null===a&&(a="");if(this.fb)return!1;!0===this.Yy&&(this.Yy=!1,this.xl++,this.bd("StartingFirstTransaction",a,this.kj),0<this.xl&&this.xl--);this.isEnabled&&(this.ih.Ra(),this.ih.add(a),this.ih.freeze(),null===this.kj?this.cp.add(0):this.cp.add(this.kj.Pf.count));this.xl++;var b=1===this.Fh;b&&this.bd("StartedTransaction",a,this.kj);return b};
Rf.prototype.commitTransaction=Rf.prototype.Fd=function(a){void 0===a&&(a="");return Zg(this,!0,a)};Rf.prototype.rollbackTransaction=Rf.prototype.nq=function(){return Zg(this,!1,"")};
function Zg(a,b,c){if(a.fb)return!1;a.Rz&&1>a.Fh&&w.trace("Ending transaction without having started a transaction: "+c);var d=1===a.Fh;d&&b&&a.bd("CommittingTransaction",c,a.kj);var e=0;if(0<a.Fh&&(a.xl--,a.isEnabled)){var f=a.ih.count;0<f&&(""===c&&(c=a.ih.da(0)),a.ih.Ra(),a.ih.Xc(f-1),a.ih.freeze());f=a.cp.count;0<f&&(e=a.cp.da(f-1),a.cp.Xc(f-1))}f=a.kj;if(d){if(b){a.hz=!1;if(a.isEnabled&&null!==f){b=f;b.$t=!0;b.name=c;d=a.history;d.Ra();for(e=d.count-1;e>a.pj;e--)f=d.da(e),null!==f&&f.clear(),
d.Xc(e),a.hz=!0;e=a.uF;0===e&&(e=1);0<e&&d.count>=e&&(f=d.da(0),null!==f&&f.clear(),d.Xc(0),a.dh--);d.add(b);a.dh++;d.freeze();f=b}a.bd("CommittedTransaction",c,f)}else{a.Ki=!0;try{a.isEnabled&&null!==f&&(f.$t=!0,f.undo())}finally{a.bd("RolledBackTransaction",c,f),a.Ki=!1}null!==f&&f.clear()}a.pv=null;return!0}if(a.isEnabled&&!b&&null!==f){a=e;c=f.Pf;for(b=c.count-1;b>=a;b--)d=c.da(b),null!==d&&d.undo(),c.Ra(),c.Xc(b);c.freeze()}return!1}
Rf.prototype.canUndo=Rf.prototype.canUndo=function(){if(!this.isEnabled||0<this.Fh||this.fb)return!1;var a=this.qG;return null!==a&&a.canUndo()?!0:!1};Rf.prototype.undo=Rf.prototype.undo=function(){if(this.canUndo()){var a=this.qG;try{this.bd("StartingUndo","Undo",a),this.Ki=!0,this.dh--,a.undo()}catch(b){w.trace("undo error: "+b.toString())}finally{this.Ki=!1,this.bd("FinishedUndo","Undo",a)}}};
Rf.prototype.canRedo=Rf.prototype.canRedo=function(){if(!this.isEnabled||0<this.Fh||this.fb)return!1;var a=this.pG;return null!==a&&a.canRedo()?!0:!1};Rf.prototype.redo=Rf.prototype.redo=function(){if(this.canRedo()){var a=this.pG;try{this.bd("StartingRedo","Redo",a),this.Ki=!0,this.dh++,a.redo()}catch(b){w.trace("redo error: "+b.toString())}finally{this.Ki=!1,this.bd("FinishedRedo","Redo",a)}}};
Rf.prototype.bd=function(a,b,c){void 0===c&&(c=null);var d=new Lf;d.xc=Nf;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.SI;a.next();)b=a.value,d.ba=b,b.Rw(d)};Rf.prototype.handleChanged=Rf.prototype.XE=function(a){if(this.isEnabled&&!this.fb&&!this.skipsEvent(a)){var b=this.kj;null===b&&(this.pv=b=new $f);var c=a.copy(),b=b.Pf;b.Ra();b.add(c);b.freeze();this.Rz&&0>=this.Fh&&!this.Yy&&(a=a.g,null!==a&&!1===a.Fn||w.trace("Change not within a transaction: "+c.toString()))}};
Rf.prototype.skipsEvent=function(a){if(null===a||0>a.xc.value)return!0;a=a.object;if(a instanceof G){if(a=a.layer,null!==a&&a.Jc)return!0}else if(a instanceof mg&&a.Jc)return!0;return!1};w.u(Rf,{SI:"models"},function(){return this.mz.i});w.defineProperty(Rf,{isEnabled:"isEnabled"},function(){return this.cf},function(a){this.cf=a});w.u(Rf,{qG:"transactionToUndo"},function(){return 0<=this.pj&&this.pj<=this.history.count-1?this.history.da(this.pj):null});
w.u(Rf,{pG:"transactionToRedo"},function(){return this.pj<this.history.count-1?this.history.da(this.pj+1):null});w.u(Rf,{fb:"isUndoingRedoing"},function(){return this.Ki});w.u(Rf,{history:"history"},function(){return this.FG});w.defineProperty(Rf,{uF:"maxHistoryLength"},function(){return this.XC},function(a){this.XC=a});w.u(Rf,{pj:"historyIndex"},function(){return this.dh});w.u(Rf,{kj:"currentTransaction"},function(){return this.pv});w.u(Rf,{Fh:"transactionLevel"},function(){return this.xl});
w.u(Rf,{jF:"isInTransaction"},function(){return 0<this.xl});w.defineProperty(Rf,{Rz:"checksTransactionLevel"},function(){return this.SB},function(a){this.SB=a});w.u(Rf,{zF:"nestedTransactionNames"},function(){return this.ih});function og(){0<arguments.length&&w.hd(og);w.lc(this);this.Z=null;this.VB=!1;this.pC=this.WB=!0;this.YB=this.ZB=this.qC=this.$B=!1;this.ol=this.LB=null;this.XD=1.05;this.mC=1;this.iz=NaN;this.TC=null;this.Kz=NaN;this.Jz=cd;this.bj=null}w.fa("CommandHandler",og);
var $g=null,ah="";og.prototype.toString=function(){return"CommandHandler"};w.u(og,{g:"diagram"},function(){return this.Z});og.prototype.Pc=function(a){this.Z=a};
og.prototype.doKeyDown=function(){var a=this.g;if(null!==a){var b=a.R,c=w.Ek?b.mu:b.control,d=b.shift,e=b.alt,f=b.key;!c||"C"!==f&&"Insert"!==f?c&&"X"===f||d&&"Del"===f?this.canCutSelection()&&this.cutSelection():c&&"V"===f||d&&"Insert"===f?this.canPasteSelection()&&this.pasteSelection():c&&"Y"===f||e&&d&&"Backspace"===f?this.canRedo()&&this.redo():c&&"Z"===f||e&&"Backspace"===f?this.canUndo()&&this.undo():"Del"===f||"Backspace"===f?this.canDeleteSelection()&&this.deleteSelection():c&&"A"===f?this.canSelectAll()&&
this.selectAll():"Esc"===f?this.canStopCommand()&&this.stopCommand():"Up"===f?a.ne&&(c?a.scroll("pixel","up"):a.scroll("line","up")):"Down"===f?a.ne&&(c?a.scroll("pixel","down"):a.scroll("line","down")):"Left"===f?a.me&&(c?a.scroll("pixel","left"):a.scroll("line","left")):"Right"===f?a.me&&(c?a.scroll("pixel","right"):a.scroll("line","right")):"PageUp"===f?d&&a.me?a.scroll("page","left"):a.ne&&a.scroll("page","up"):"PageDown"===f?d&&a.me?a.scroll("page","right"):a.ne&&a.scroll("page","down"):"Home"===
f?c&&a.ne?a.scroll("document","up"):!c&&a.me&&a.scroll("document","left"):"End"===f?c&&a.ne?a.scroll("document","down"):!c&&a.me&&a.scroll("document","right"):" "===f?this.canScrollToPart()&&this.scrollToPart():"Subtract"===f?this.canDecreaseZoom()&&this.decreaseZoom():"Add"===f?this.canIncreaseZoom()&&this.increaseZoom():c&&"0"===f?this.canResetZoom()&&this.resetZoom():d&&"Z"===f?this.canZoomToFit()&&this.zoomToFit():c&&!d&&"G"===f?this.canGroupSelection()&&this.groupSelection():c&&d&&"G"===f?this.canUngroupSelection()&&
this.ungroupSelection():b.event&&113===b.event.which?this.canEditTextBlock()&&this.editTextBlock():b.event&&93===b.event.which?this.canShowContextMenu()&&this.showContextMenu():b.bubbles=!0:this.canCopySelection()&&this.copySelection()}};og.prototype.doKeyUp=function(){var a=this.g;null!==a&&(a.R.bubbles=!0)};og.prototype.stopCommand=function(){var a=this.g;if(null!==a){var b=a.Za;b instanceof bh&&a.tf&&a.Sw();null!==b&&b.doCancel()}};og.prototype.canStopCommand=function(){return!0};
og.prototype.selectAll=function(){var a=this.g;if(null!==a){a.na();try{a.bc="wait";a.Ba("ChangingSelection");for(var b=a.Hk;b.next();)b.value.eb=!0;for(var c=a.dg;c.next();)c.value.eb=!0;for(var d=a.links;d.next();)d.value.eb=!0}finally{a.Ba("ChangedSelection"),a.bc=""}}};og.prototype.canSelectAll=function(){var a=this.g;return null!==a&&a.tf};
og.prototype.deleteSelection=function(){var a=this.g;if(null!==a&&!a.Ba("SelectionDeleting",a.selection))try{a.bc="wait";a.Tb("Delete");a.Ba("ChangingSelection");for(var b=new J(S),c=a.selection.i;c.next();)ch(b,c.value,!0,this.FH?Infinity:0,this.zE,function(a){return a.canDelete()});a.TA(b,!0);a.Ba("SelectionDeleted",b)}finally{a.Ba("ChangedSelection"),a.Fd("Delete"),a.bc=""}};og.prototype.canDeleteSelection=function(){var a=this.g;return null===a||a.cb||a.xf||!a.gn||0===a.selection.count?!1:!0};
function ch(a,b,c,d,e,f){void 0===f&&(f=null);if(!(a.contains(b)||null!==f&&!f(b)||b instanceof dh))if(a.add(b),b instanceof T){if(c&&b instanceof U)for(var h=b.Mc;h.next();)ch(a,h.value,c,d,e,f);if(e)for(h=b.fe;h.next();){var k=h.value;if(!a.contains(k)){var l=k.W,m=k.$;null!==l&&a.contains(l)&&null!==m&&a.contains(m)?ch(a,k,c,d,e,f):null!==l&&null!==m||ch(a,k,c,d,e,f)}}if(1<d)for(b=b.KE();b.next();)ch(a,b.value,c,d-1,e,f)}else if(b instanceof W)for(b=b.Vf;b.next();)ch(a,b.value,c,d,e,f)}
og.prototype.Np=function(a,b,c){var d=new ka(S,S);for(a=a.i;a.next();)eh(this,a.value,b,d,c);if(null!==b){c=b.ba;a=!1;null!==b.ab.re&&(a=b.ab.re.mj);for(var e=new J(W),f=new ka(W,W),h=d.i;h.next();){var k=h.value;if(k instanceof W){var l=k;a||null!==l.W&&null!==l.$||e.add(l)}else if(c instanceof Zf&&k instanceof T&&null!==k.data){var l=c,m=k,k=h.key,n=k.Ql();null!==n&&(n=d.ka(n),null!==n?(l.oi(m.data,l.ub(n.data)),l=b.Qf(m.data),k=k.vn(),null!==k&&null!==l&&f.add(k,l)):l.oi(m.data,void 0))}}0<e.count&&
b.TA(e,!1);if(0<f.count)for(c=f.i;c.next();)d.add(c.key,c.value)}if(null!==b&&null!==this.g&&(b=b.ba,c=b.bH,null!==c)){var p=new ka;d.each(function(a){null!==a.key.data&&p.add(a.key.data,a.value.data)});c(p,b,this.g.ba)}for(b=d.i;b.next();)b.value.Hb();return d};
function eh(a,b,c,d,e){if(null===b||e&&!b.canCopy())return null;if(d.contains(b))return d.ka(b);var f=null,h=b.data;if(null!==h&&null!==c){var k=c.ba;b instanceof W?k instanceof P&&(h=k.Uw(h),w.Qa(h)&&(k.vt(h),f=c.Qf(h))):(h=k.copyNodeData(h),w.Qa(h)&&(k.Al(h),f=c.vh(h)))}else fh(b),f=b.copy(),null!==f&&(null!==c?c.add(f):null!==h&&null!==a.g&&a.vH&&(k=a.g.ba,h=f instanceof W&&k instanceof P?k.Uw(h):k.copyNodeData(h),w.Qa(h)&&(f.data=h)));if(!(f instanceof S))return null;f.eb=!1;f.Lg=!1;d.add(b,f);
if(b instanceof T){for(h=b.fe;h.next();){k=h.value;if(k.W===b){var l=d.ka(k);null!==l&&(l.W=f)}k.$===b&&(l=d.ka(k),null!==l&&(l.$=f))}if(b instanceof U&&f instanceof U)for(h=f,b=b.Mc;b.next();)k=eh(a,b.value,c,d,e),k instanceof W||null===k||(k.Ka=h)}else if(b instanceof W&&f instanceof W)for(h=b.W,null!==h&&(h=d.ka(h),null!==h&&(f.W=h)),h=b.$,null!==h&&(h=d.ka(h),null!==h&&(f.$=h)),b=b.Vf;b.next();)h=eh(a,b.value,c,d,e),null!==h&&h instanceof T&&(h.Lc=f);return f}
og.prototype.copySelection=function(){var a=this.g;if(null!==a){for(var b=new J(S),a=a.selection.i;a.next();)ch(b,a.value,!0,this.yH?Infinity:0,this.wH,function(a){return a.canCopy()});this.copyToClipboard(b)}};og.prototype.canCopySelection=function(){var a=this.g;return null!==a&&a.sk&&a.Mz&&0!==a.selection.count?!0:!1};og.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};
og.prototype.canCutSelection=function(){var a=this.g;return null!==a&&!a.cb&&!a.xf&&a.sk&&a.gn&&a.Mz&&0!==a.selection.count?!0:!1};og.prototype.copyToClipboard=function(a){var b=this.g;if(null!==b){var c=null;if(null===a)$g=null,ah="";else{var c=b.ba,d=!1,e=!1,f=null;try{if(c instanceof Zf){var h=c,d=h.qn;h.qn=this.sE}c instanceof P&&(h=c,e=h.pn,h.pn=this.rE);f=b.Np(a,null,!0)}finally{c instanceof Zf&&(c.qn=d),c instanceof P&&(c.pn=e),c=new I(S),c.Hc(f),$g=c,ah=b.ba.Kl}}b.Ba("ClipboardChanged",c)}};
og.prototype.pasteFromClipboard=function(){var a=new J(S),b=$g;if(null===b)return a;var c=this.g;if(null===c||ah!==c.ba.Kl)return a;var d=c.ba,e=!1,f=!1,h=null;try{if(d instanceof Zf){var k=d,e=k.qn;k.qn=this.sE}d instanceof P&&(k=d,f=k.pn,k.pn=this.rE);h=c.Np(b,c,!1)}finally{for(d instanceof Zf&&(d.qn=e),d instanceof P&&(d.pn=f),b=h.i;b.next();)c=b.value,d=b.key,c.location.H()||(d.location.H()?c.location=d.location:!c.position.H()&&d.position.H()&&(c.position=d.position)),a.add(c)}return a};
og.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.g;if(null!==b)try{b.bc="wait";b.Tb("Paste");b.Ba("ChangingSelection");var c=this.pasteFromClipboard();0<c.count&&gh(b);for(var d=c.i;d.next();)d.value.eb=!0;b.Ba("ChangedSelection");if(null!==a){var e=b.computePartsBounds(b.selection);if(e.H()){var f=b.ab.re;null===f&&(f=new hh,f.Pc(b));var h=f.computeEffectiveCollection(b.selection);f.moveParts(h,new z(a.x-e.ja,a.y-e.ra),!1)}}b.Ba("ClipboardPasted",c)}finally{b.Fd("Paste"),b.bc=
""}};og.prototype.canPasteSelection=function(){var a=this.g;return null===a||a.cb||a.xf||!a.Ep||!a.Mz||null===$g||ah!==a.ba.Kl?!1:!0};og.prototype.undo=function(){var a=this.g;null!==a&&a.oa.undo()};og.prototype.canUndo=function(){var a=this.g;return null===a||a.cb||a.xf?!1:a.fE&&a.oa.canUndo()};og.prototype.redo=function(){var a=this.g;null!==a&&a.oa.redo()};og.prototype.canRedo=function(){var a=this.g;return null===a||a.cb||a.xf?!1:a.fE&&a.oa.canRedo()};
og.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.ny);w.Ed(a,og,"decreaseZoom:factor");var b=this.g;null!==b&&b.Fl===ih&&(a*=b.scale,a<b.yh||a>b.xh||(b.scale=a))};og.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.ny);w.Ed(a,og,"canDecreaseZoom:factor");var b=this.g;if(null===b||b.Fl!==ih)return!1;a*=b.scale;return a<b.yh||a>b.xh?!1:b.Qw};
og.prototype.increaseZoom=function(a){void 0===a&&(a=this.ny);w.Ed(a,og,"increaseZoom:factor");var b=this.g;null!==b&&b.Fl===ih&&(a*=b.scale,a<b.yh||a>b.xh||(b.scale=a))};og.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.ny);w.Ed(a,og,"canIncreaseZoom:factor");var b=this.g;if(null===b||b.Fl!==ih)return!1;a*=b.scale;return a<b.yh||a>b.xh?!1:b.Qw};og.prototype.resetZoom=function(a){void 0===a&&(a=this.Yw);w.Ed(a,og,"resetZoom:newscale");var b=this.g;null===b||a<b.yh||a>b.xh||(b.scale=a)};
og.prototype.canResetZoom=function(a){void 0===a&&(a=this.Yw);w.Ed(a,og,"canResetZoom:newscale");var b=this.g;return null===b||a<b.yh||a>b.xh?!1:b.Qw};og.prototype.zoomToFit=function(){var a=this.g;if(null!==a){var b=a.scale,c=a.position;b===this.Kz&&!isNaN(this.iz)&&a.qe.L(this.Jz)?(a.scale=this.iz,a.position=this.TC,this.Kz=NaN,this.Jz=cd):(this.iz=b,this.TC=c.copy(),a.zoomToFit(),this.Kz=a.scale,this.Jz=a.qe.copy())}};og.prototype.canZoomToFit=function(){var a=this.g;return null===a?!1:a.Qw};
og.prototype.scrollToPart=function(a){void 0===a&&(a=null);null!==a&&w.G(a,S,og,"part");var b=this.g;if(null!==b){if(null===a){try{null!==this.bj&&(this.bj.next()?a=this.bj.value:this.bj=null)}catch(c){this.bj=null}null===a&&(0<b.Ul.count?this.bj=b.Ul.i:0<b.selection.count&&(this.bj=b.selection.i),null!==this.bj&&this.bj.next()&&(a=this.bj.value))}if(null!==a){var d=b.Pa;d.Sn("Scroll To Part");var e=b.position.copy();b.iH(a.Y);e.Ic(b.position)&&d.pi()}}};
og.prototype.canScrollToPart=function(a){void 0===a&&(a=null);if(null!==a&&!(a instanceof S))return!1;a=this.g;return null===a||0===a.selection.count&&0===a.Ul.count?!1:a.me&&a.ne};
og.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.g;if(null!==b)try{b.Tb("Collapse Tree");b.Pa.Sn("Collapse Tree");var c=new I(T);if(null!==a&&a.gd)a.collapseTree(),c.add(a);else for(var d=b.selection.i;d.next();){var e=d.value;e instanceof T&&(a=e,a.gd&&(a.collapseTree(),c.add(a)))}b.Ba("TreeCollapsed",c)}finally{b.Fd("Collapse Tree")}};
og.prototype.canCollapseTree=function(a){void 0===a&&(a=null);var b=this.g;if(null===b||b.cb)return!1;if(null!==a){if(!(a instanceof T&&a.gd))return!1;if(0<a.kx().count)return!0}else for(a=b.selection.i;a.next();)if(b=a.value,b instanceof T&&b.gd&&0<b.kx().count)return!0;return!1};
og.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.g;if(null!==b)try{b.Tb("Expand Tree");b.Pa.Sn("Expand Tree");var c=new I(T);if(null===a||a.gd)for(var d=b.selection.i;d.next();){var e=d.value;e instanceof T&&(a=e,a.gd||(a.expandTree(),c.add(a)))}else a.expandTree(),c.add(a);b.Ba("TreeExpanded",c)}finally{b.Fd("Expand Tree")}};
og.prototype.canExpandTree=function(a){void 0===a&&(a=null);var b=this.g;if(null===b||b.cb)return!1;if(null!==a){if(!(a instanceof T)||a.gd)return!1;if(0<a.kx().count)return!0}else for(a=b.selection.i;a.next();)if(b=a.value,b instanceof T&&!b.gd&&0<b.kx().count)return!0;return!1};
og.prototype.groupSelection=function(){var a=this.g;if(null!==a){var b=a.ba;if(b instanceof P){var c=this.gE;if(null!==c){var d=null;try{a.bc="wait";a.Tb("Group");a.Ba("ChangingSelection");for(var e=new I(S),f=a.selection.i;f.next();){var h=f.value;h.de()&&h.canGroup()&&e.add(h)}for(var k=new I(S),l=e.i;l.next();){for(var m=l.value,f=!1,n=e.i;n.next();)if(m.mi(n.value)){f=!0;break}f||k.add(m)}if(0<k.count){var p=k.first().Ka;if(null!==p)for(;null!==p;){for(var e=!1,q=k.i;q.next();)if(!q.value.mi(p)){e=
!0;break}if(e)p=p.Ka;else break}if(c instanceof U)fh(c),d=c.copy(),null!==d&&a.add(d);else if(b.wA(c)){var r=b.copyNodeData(c);w.Qa(r)&&(b.Al(r),d=a.jx(r))}if(null!==d){null!==p&&this.isValidMember(p,d)&&(d.Ka=p);for(var s=k.i;s.next();){var u=s.value;this.isValidMember(d,u)&&(u.Ka=d)}a.select(d)}}a.Ba("ChangedSelection");a.Ba("SelectionGrouped",d)}finally{a.Fd("Group"),a.bc=""}}}}};
og.prototype.canGroupSelection=function(){var a=this.g;if(null===a||a.cb||a.xf||!a.Ep||!a.Lw||!(a.ba instanceof P)||null===this.gE)return!1;for(a=a.selection.i;a.next();){var b=a.value;if(b.de()&&b.canGroup())return!0}return!1};function Bh(a){var b=w.lb();for(a=a.i;a.next();){var c=a.value;c instanceof W||b.push(c)}a=new J(S);for(var c=b.length,d=0;d<c;d++){for(var e=b[d],f=!0,h=0;h<c;h++)if(e.mi(b[h])){f=!1;break}f&&a.add(e)}w.va(b);return a}
og.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof W)return!1;if(null!==a){if(a===b||a.mi(b))return!1;var c=a.FA;if(null!==c&&!c(a,b)||null===a.data&&null!==b.data||null!==a.data&&null===b.data)return!1}c=this.FA;return null!==c?c(a,b):!0};
og.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.g;if(null!==b){var c=b.ba;if(c instanceof P)try{b.bc="wait";b.Tb("Ungroup");b.Ba("ChangingSelection");var d=new I(U);if(null!==a)d.add(a);else for(var e=b.selection.i;e.next();){var f=e.value;f instanceof U&&(a=f,a.canUngroup()&&d.add(a))}if(0<d.count){b.Sw();for(var h=d.i;h.next();){var k=h.value;k.expandSubGraph();var l=k.Ka,m=null!==l&&null!==l.data?c.ub(l.data):void 0,n=new I(S);n.Hc(k.Mc);for(var p=n.i;p.next();){var q=
p.value;q.eb=!0;if(!(q instanceof W)){var r=q.data;null!==r?c.bB(r,m):q.Ka=l}}b.remove(k)}}b.Ba("ChangedSelection");b.Ba("SelectionUngrouped",d,n)}finally{b.Fd("Ungroup"),b.bc=""}}};og.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.g;if(null===b||b.cb||b.xf||!b.gn||!b.Pw||!(b.ba instanceof P))return!1;if(null!==a){if(!(a instanceof U))return!1;if(a.canUngroup())return!0}else for(a=b.selection.i;a.next();)if(b=a.value,b instanceof U&&b.canUngroup())return!0;return!1};
og.prototype.addTopLevelParts=function(a,b){for(var c=!0,d=Bh(a).i;d.next();){var e=d.value;null!==e.Ka&&(!b||this.isValidMember(null,e)?e.Ka=null:c=!1)}return c};
og.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.g;if(null!==b)try{b.Tb("Collapse SubGraph");b.Pa.Sn("Collapse SubGraph");var c=new I(U);if(null!==a&&a.we)a.collapseSubGraph(),c.add(a);else for(var d=b.selection.i;d.next();){var e=d.value;e instanceof U&&(a=e,a.we&&(a.collapseSubGraph(),c.add(a)))}b.Ba("SubGraphCollapsed",c)}finally{b.Fd("Collapse SubGraph")}};
og.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.g;if(null===b||b.cb)return!1;if(null!==a)return a instanceof U&&a.we?!0:!1;for(a=b.selection.i;a.next();)if(b=a.value,b instanceof U&&b.we)return!0;return!1};
og.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.g;if(null!==b)try{b.Tb("Expand SubGraph");b.Pa.Sn("Expand SubGraph");var c=new I(U);if(null===a||a.we)for(var d=b.selection.i;d.next();){var e=d.value;e instanceof U&&(a=e,a.we||(a.expandSubGraph(),c.add(a)))}else a.expandSubGraph(),c.add(a);b.Ba("SubGraphExpanded",c)}finally{b.Fd("Expand SubGraph")}};
og.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.g;if(null===b||b.cb)return!1;if(null!==a)return a instanceof U&&!a.we?!0:!1;for(a=b.selection.i;a.next();)if(b=a.value,b instanceof U&&!b.we)return!0;return!1};
og.prototype.editTextBlock=function(a){void 0===a&&(a=null);null!==a&&w.G(a,Ch,og,"editTextBlock");var b=this.g;if(null!==b){var c=b.ab.kB;if(null!==c){if(null===a){a=null;for(var d=b.selection.i;d.next();){var e=d.value;if(e.canEdit()){a=e;break}}if(null===a)return;a=a.Kt(function(a){return a instanceof Ch&&a.cA})}null!==a&&(b.Za=null,c.Xg=a,b.Za=c)}}};
og.prototype.canEditTextBlock=function(a){void 0===a&&(a=null);var b=this.g;if(null===b||b.cb||b.xf||!b.Ow||null===b.ab.kB)return!1;if(null!==a){if(!(a instanceof Ch))return!1;a=a.U;if(null!==a&&a.canEdit())return!0}else for(b=b.selection.i;b.next();)if(a=b.value,a.canEdit()&&(a=a.Kt(function(a){return a instanceof Ch&&a.cA}),null!==a))return!0;return!1};
og.prototype.showContextMenu=function(a){var b=this.g;if(null!==b){var c=b.ab.Vz;if(null!==c&&(void 0===a&&(a=0<b.selection.count?b.selection.first():b),a=c.findObjectWithContextMenu(a),null!==a)){var d=new Af,e=null;a instanceof G?e=a.Wa(Fb):b.sI||(e=b.sb,e=new z(e.x+e.width/2,e.y+e.height/2));null!==e&&(d.g=b,d.bf=b.rG(e),d.ca=e,d.left=!1,d.right=!0,d.up=!0,b.R=d);b.Za=c;Dh(c,!1,a)}}};
og.prototype.canShowContextMenu=function(a){var b=this.g;if(null===b)return!1;var c=b.ab.Vz;if(null===c)return!1;void 0===a&&(a=0<b.selection.count?b.selection.first():b);return null===c.findObjectWithContextMenu(a)?!1:!0};w.defineProperty(og,{vH:"copiesClipboardData"},function(){return this.VB},function(a){w.j(a,"boolean",og,"copiesClipboardData");this.VB=a});
w.defineProperty(og,{wH:"copiesConnectedLinks"},function(){return this.WB},function(a){w.j(a,"boolean",og,"copiesConnectedLinks");this.WB=a});w.defineProperty(og,{zE:"deletesConnectedLinks"},function(){return this.pC},function(a){w.j(a,"boolean",og,"deletesConnectedLinks");this.pC=a});w.defineProperty(og,{yH:"copiesTree"},function(){return this.$B},function(a){w.j(a,"boolean",og,"copiesTree");this.$B=a});
w.defineProperty(og,{FH:"deletesTree"},function(){return this.qC},function(a){w.j(a,"boolean",og,"deletesTree");this.qC=a});w.defineProperty(og,{sE:"copiesParentKey"},function(){return this.ZB},function(a){w.j(a,"boolean",og,"copiesParentKey");this.ZB=a});w.defineProperty(og,{rE:"copiesGroupKey"},function(){return this.YB},function(a){w.j(a,"boolean",og,"copiesGroupKey");this.YB=a});
w.defineProperty(og,{gE:"archetypeGroupData"},function(){return this.LB},function(a){null!==a&&w.G(a,Object,og,"archetypeGroupData");var b=this.g;null!==b&&(b=b.ba,b instanceof P&&(a instanceof U||b.wA(a)||w.k("CommandHandler.archetypeGroupData must be either a Group or a data object for which GraphLinksModel.isGroupForNodeData is true: "+a)));this.LB=a});w.defineProperty(og,{FA:"memberValidation"},function(){return this.ol},function(a){null!==a&&w.j(a,"function",og,"memberValidation");this.ol=a});
w.defineProperty(og,{Yw:"defaultScale"},function(){return this.mC},function(a){w.Ed(a,og,"defaultScale");0<a||w.k("defaultScale must be larger than zero, not: "+a);this.mC=a});w.defineProperty(og,{ny:"zoomFactor"},function(){return this.XD},function(a){w.Ed(a,og,"zoomFactor");1<a||w.k("zoomFactor must be larger than 1.0, not: "+a);this.XD=a});og.prototype.ft=function(a){if(null!==a)for(a=a.i;a.next();){var b=a.key;b instanceof W&&(b.Dj=!0)}};
og.prototype.jp=function(a){if(null!==a)for(a=a.i;a.next();){var b=a.key;b instanceof W&&(b.Dj=!1,Eh(b)&&b.Xb())}};function ng(){0<arguments.length&&w.hd(ng);w.lc(this);this.Z=null;this.Qb="";this.cf=!0;this.GC=!1;this.RD=null;this.Hw=-1}w.fa("Tool",ng);ng.prototype.Pc=function(a){this.Z=a};ng.prototype.toString=function(){return""!==this.name?this.name+" Tool":w.hf(Object.getPrototypeOf(this))};ng.prototype.updateAdornments=function(){};ng.prototype.canStart=function(){return this.isEnabled};
ng.prototype.doStart=function(){};ng.prototype.doActivate=function(){this.sa=!0};ng.prototype.doDeactivate=function(){this.sa=!1};ng.prototype.doStop=function(){};ng.prototype.doCancel=function(){this.stopTool()};ng.prototype.stopTool=function(){var a=this.g;null!==a&&a.Za===this&&(a.Za=null,a.bc="")};ng.prototype.doMouseDown=function(){!this.sa&&this.canStart()&&this.doActivate()};ng.prototype.doMouseMove=function(){};ng.prototype.doMouseUp=function(){this.stopTool()};ng.prototype.doMouseWheel=function(){};
ng.prototype.canStartMultiTouch=function(){return!0};ng.prototype.standardPinchZoomStart=function(){var a=this.g;if(null!==a){var b=a.R,c=b.nx(0,w.xb(NaN,NaN)),d=b.nx(1,w.xb(NaN,NaN));if(c.H()&&d.H()&&(this.doCancel(),a.Ut("hasGestureZoom"))){a.gD=a.scale;var e=d.x-c.x,f=d.y-c.y;a.yD=Math.sqrt(e*e+f*f);b.bubbles=!1}w.v(c);w.v(d)}};
ng.prototype.standardPinchZoomMove=function(){var a=this.g;if(null!==a){var b=a.R,c=b.nx(0,w.xb(NaN,NaN)),d=b.nx(1,w.xb(NaN,NaN));if(c.H()&&d.H()&&(this.doCancel(),a.Ut("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y,f=Math.sqrt(e*e+f*f)/a.yD,e=new z((Math.min(d.x,c.x)+Math.max(d.x,c.x))/2,(Math.min(d.y,c.y)+Math.max(d.y,c.y))/2),f=a.gD*f,h=a.ob;if(f!==a.scale&&h.canResetZoom(f)){var k=a.lm;a.lm=e;h.resetZoom(f);a.lm=k}b.bubbles=!1}w.v(c);w.v(d)}};
ng.prototype.doKeyDown=function(){var a=this.g;null!==a&&"Esc"===a.R.key&&this.doCancel()};ng.prototype.doKeyUp=function(){};ng.prototype.startTransaction=ng.prototype.Tb=function(a){void 0===a&&(a=this.name);this.Ff=null;var b=this.g;return null===b?!1:b.Tb(a)};ng.prototype.stopTransaction=ng.prototype.Jk=function(){var a=this.g;return null===a?!1:null===this.Ff?a.nq():a.Fd(this.Ff)};
ng.prototype.standardMouseSelect=function(){var a=this.g;if(null!==a&&a.tf){var b=a.R,c=a.Nt(b.ca,!1);if(null!==c)if(w.Ek?b.mu:b.control){a.Ba("ChangingSelection");for(b=c;null!==b&&!b.canSelect();)b=b.Ka;null!==b&&(b.eb=!b.eb);a.Ba("ChangedSelection")}else if(b.shift){if(!c.eb){a.Ba("ChangingSelection");for(b=c;null!==b&&!b.canSelect();)b=b.Ka;null!==b&&(b.eb=!0);a.Ba("ChangedSelection")}}else{if(!c.eb){for(b=c;null!==b&&!b.canSelect();)b=b.Ka;null!==b&&a.select(b)}}else!b.left||(w.Ek?b.mu:b.control)||
b.shift||a.Sw()}};ng.prototype.standardMouseClick=function(a,b){void 0===a&&(a=null);void 0===b&&(b=function(a){return!a.layer.Jc});var c=this.g;if(null===c)return!1;var d=c.R,e=c.Je(d.ca,a,b);d.Pe=e;Fh(e,d,c);return d.Ac};
function Fh(a,b,c){b.Ac=!1;if(null===a||a.au()){var d=0;b.left?d=1===b.Fe?1:2===b.Fe?2:1:b.right&&1===b.Fe&&(d=3);var e="";if(null!==a){switch(d){case 1:e="ObjectSingleClicked";break;case 2:e="ObjectDoubleClicked";break;case 3:e="ObjectContextClicked"}0!==d&&c.Ba(e,a)}else{switch(d){case 1:e="BackgroundSingleClicked";break;case 2:e="BackgroundDoubleClicked";break;case 3:e="BackgroundContextClicked"}0!==d&&c.Ba(e)}if(null!==a)for(;null!==a;){c=null;switch(d){case 1:c=a.click;break;case 2:c=a.Ht?a.Ht:
a.click;break;case 3:c=a.Uz}if(null!==c&&(c(b,a),b.Ac))break;a=a.O}else{a=null;switch(d){case 1:a=c.click;break;case 2:a=c.Ht?c.Ht:c.click;break;case 3:a=c.Uz}null!==a&&a(b)}}}
ng.prototype.standardMouseOver=function(){var a=this.g;if(null!==a){var b=a.R;if(null!==b.g&&!0!==a.Pa.oc){var c=a.wb;a.wb=!0;var d=a.Je(b.ca,null,null);b.Pe=d;var e=!1;if(d!==a.uo){var f=a.uo,h=f;a.uo=d;this.doCurrentObjectChanged(f,d);for(b.Ac=!1;null!==f;){var k=f.ou;if(null!==k){if(d===f)break;if(null!==d&&d.Xl(f))break;k(b,f,d);e=!0;if(b.Ac)break}f=f.O}f=h;for(b.Ac=!1;null!==d;){k=d.nu;if(null!==k){if(f===d)break;if(null!==f&&f.Xl(d))break;k(b,d,f);e=!0;if(b.Ac)break}d=d.O}d=a.uo}if(null!==d){f=
d;for(h="";null!==f;){h=f.cursor;if(""!==h)break;f=f.O}a.bc=h;b.Ac=!1;for(f=d;null!==f;){d=f.JA;if(null!==d&&(d(b,f),e=!0,b.Ac))break;f=f.O}}else a.bc="",d=a.JA,null!==d&&(d(b),e=!0);e&&a.Le();a.wb=c}}};ng.prototype.doCurrentObjectChanged=function(){};
ng.prototype.standardMouseWheel=function(){var a=this.g;if(null!==a){var b=a.R,c=b.Ml;if(0!==c&&a.qe.H()){var d=a.ob,e=a.ab.pu;if((e===Gh&&!b.shift||e===Hh&&b.control)&&(0<c?d.canIncreaseZoom():d.canDecreaseZoom()))e=a.lm,a.lm=b.bf,0<c?d.increaseZoom():d.decreaseZoom(),a.lm=e,b.bubbles=!1;else if(e===Gh&&b.shift||e===Hh&&!b.control){var d=a.position.copy(),e=0<c?c:-c,f=b.event.deltaX,h=b.event.deltaY;void 0===f||void 0===h||0===f&&0===h||b.shift?!b.shift&&a.ne?(f=a.Du,e=e/40*f,0<c?a.scroll("pixel",
"up",e):a.scroll("pixel","down",e)):b.shift&&a.me&&(f=a.Cu,e=e/40*f,0<c?a.scroll("pixel","left",e):a.scroll("pixel","right",e)):(0!==f&&a.me&&(0<f?a.scroll("pixel","left",-f):a.scroll("pixel","right",f)),0!==h&&a.ne&&(0<h?a.scroll("pixel","up",-h):a.scroll("pixel","down",h)));a.position.L(d)||(b.bubbles=!1)}}}};ng.prototype.standardWaitAfter=function(a,b){w.j(a,"number",ng,"standardWaitAfter:delay");this.cancelWaitAfter();var c=this,d=b.copy();this.Hw=w.setTimeout(function(){c.doWaitAfter(d)},a)};
ng.prototype.cancelWaitAfter=function(){-1!==this.Hw&&w.clearTimeout(this.Hw);this.Hw=-1};ng.prototype.doWaitAfter=function(){};ng.prototype.findToolHandleAt=function(a,b){var c=this.g;if(null===c)return null;c=c.Je(a,function(a){for(;null!==a&&!(a.O instanceof dh);)a=a.O;return a});return null===c?null:c.U.rd===b?c:null};
ng.prototype.isBeyondDragSize=function(a,b){var c=this.g;if(null===c)return!1;void 0===a&&(a=c.zc.bf);void 0===b&&(b=c.R.bf);var d=c.ab.JH,e=d.width,d=d.height;c.zc.tj&&(e+=6,d+=6);return Math.abs(b.x-a.x)>e||Math.abs(b.y-a.y)>d};w.u(ng,{g:"diagram"},function(){return this.Z});w.defineProperty(ng,{name:"name"},function(){return this.Qb},function(a){w.j(a,"string",ng,"name");this.Qb=a});
w.defineProperty(ng,{isEnabled:"isEnabled"},function(){return this.cf},function(a){w.j(a,"boolean",ng,"isEnabled");this.cf=a});w.defineProperty(ng,{sa:"isActive"},function(){return this.GC},function(a){w.j(a,"boolean",ng,"isActive");this.GC=a});w.defineProperty(ng,{Ff:"transactionResult"},function(){return this.RD},function(a){null!==a&&w.j(a,"string",ng,"transactionResult");this.RD=a});
function hh(){ng.call(this);0<arguments.length&&w.hd(hh);this.name="Dragging";this.XB=this.KC=!0;this.Jr=this.wC=!1;this.OC=!0;this.Zy=(new ha(NaN,NaN)).freeze();this.$y=vb;this.az=(new z(NaN,NaN)).freeze();this.vC=!1;this.tC=this.UB=this.uC=this.eC=this.$i=null;this.pr=this.MC=!1;this.rp=new z(NaN,NaN);this.xw=new z;this.Aw=!1;this.JC=!0;this.Ao=100;this.Mj=[];this.EG=(new J(S)).freeze()}w.La(hh,ng);w.fa("DraggingTool",hh);
w.defineProperty(hh,{eF:"isCopyEnabled"},function(){return this.KC},function(a){w.j(a,"boolean",hh,"isCopyEnabled");this.KC=a});w.defineProperty(hh,{xH:"copiesEffectiveCollection"},function(){return this.XB},function(a){w.j(a,"boolean",hh,"copiesEffectiveCollection");this.XB=a});w.defineProperty(hh,{KH:"dragsTree"},function(){return this.wC},function(a){w.j(a,"boolean",hh,"dragsTree");this.wC=a});
w.defineProperty(hh,{vx:"isGridSnapEnabled"},function(){return this.Jr},function(a){w.j(a,"boolean",hh,"isGridSnapEnabled");this.Jr=a});w.defineProperty(hh,{nI:"isComplexRoutingRealtime"},function(){return this.JC},function(a){w.j(a,"boolean",hh,"isComplexRoutingRealtime");this.JC=a});w.defineProperty(hh,{pI:"isGridSnapRealtime"},function(){return this.OC},function(a){w.j(a,"boolean",hh,"isGridSnapRealtime");this.OC=a});
w.defineProperty(hh,{WE:"gridSnapCellSize"},function(){return this.Zy},function(a){w.G(a,ha,hh,"gridSnapCellSize");this.Zy.L(a)||(this.Zy=a=a.S())});w.defineProperty(hh,{ZH:"gridSnapCellSpot"},function(){return this.$y},function(a){w.G(a,L,hh,"gridSnapCellSpot");this.$y.L(a)||(this.$y=a=a.S())});w.defineProperty(hh,{$H:"gridSnapOrigin"},function(){return this.az},function(a){w.G(a,z,hh,"gridSnapOrigin");this.az.L(a)||(this.az=a=a.S())});
w.defineProperty(hh,{mj:"dragsLink"},function(){return this.vC},function(a){w.j(a,"boolean",hh,"dragsLink");this.vC=a});w.defineProperty(hh,{sn:"currentPart"},function(){return this.eC},function(a){null!==a&&w.G(a,S,hh,"currentPart");this.eC=a});w.defineProperty(hh,{ac:"copiedParts"},function(){return this.UB},function(a){this.UB=a});w.defineProperty(hh,{Wb:"draggedParts"},function(){return this.uC},function(a){this.uC=a});
w.u(hh,{MK:"draggingParts"},function(){return null!==this.ac?this.ac.Fj():null!==this.Wb?this.Wb.Fj():this.EG});w.defineProperty(hh,{dd:"draggedLink"},function(){return this.tC},function(a){null!==a&&w.G(a,W,hh,"draggedLink");this.tC=a});w.defineProperty(hh,{ux:"isDragOutStarted"},function(){return this.MC},function(a){this.MC=a});w.defineProperty(hh,{Ik:"startPoint"},function(){return this.xw},function(a){w.G(a,z,hh,"startPoint");this.xw.L(a)||(this.xw=a=a.S())});
w.defineProperty(hh,{vE:"delay"},function(){return this.Ao},function(a){w.j(a,"number",hh,"delay");this.Ao=a});hh.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;if(null===a||a.cb&&!a.zt||!a.Dl&&!a.sk&&!a.zt||!a.tf)return!1;var b=a.R;return!b.left||a.Za!==this&&(!this.isBeyondDragSize()||b.tj&&b.timestamp-a.zc.timestamp<this.Ao)?!1:null!==this.findDraggablePart()};
hh.prototype.findDraggablePart=function(){var a=this.g;if(null===a)return null;a=a.Nt(a.zc.ca,!1);if(null===a)return null;for(;null!==a&&!a.canSelect();)a=a.Ka;return null!==a&&(a.canMove()||a.canCopy())?a:null};hh.prototype.standardMouseSelect=function(){var a=this.g;if(null!==a&&a.tf){var b=a.Nt(a.zc.ca,!1);if(null!==b){for(;null!==b&&!b.canSelect();)b=b.Ka;this.sn=b;this.sn.eb||(a.Ba("ChangingSelection"),b=a.R,(w.Ek?b.mu:b.control)||b.shift||gh(a),this.sn.eb=!0,a.Ba("ChangedSelection"))}}};
hh.prototype.doActivate=function(){var a=this.g;if(null!==a){null===this.sn&&this.standardMouseSelect();var b=this.sn;null!==b&&(b.canMove()||b.canCopy())&&(this.sa=!0,this.rp.set(a.position),Ih(this,a.selection),this.Mj.length=0,this.Wb=this.computeEffectiveCollection(a.selection),a.Ju=!0,this.ft(this.Wb),this.Tb("Drag"),this.Ik=a.zc.ca,a.$e=!0,a.zt&&(this.ux=!0,this.pr=!1,Jh=this,Kh=this.g,this.doSimulatedDragOut()))}};
function Ih(a,b){if(a.mj){var c=a.g;null!==c&&c.hn&&(c.ba instanceof P&&1===b.count&&b.first()instanceof W?(a.dd=b.first(),a.dd.canRelinkFrom()&&a.dd.canRelinkTo()&&a.dd.Ct(),a.$i=c.ab.JF,null===a.$i&&(a.$i=new Lh,a.$i.Pc(c))):(a.dd=null,a.$i=null))}}
hh.prototype.computeEffectiveCollection=function(a){var b=null!==this.g&&this.g.Za===this,c=new ka(S);if(null===a)return c;for(var d=a.i;d.next();)Mh(this,c,d.value,b);if(null!==this.dd&&this.mj)return c;for(d=a.i;d.next();)a=d.value,a instanceof W&&(b=a.W,null===b||c.contains(b)?(b=a.$,null===b||c.contains(b)||c.remove(a)):c.remove(a));return c};function Nh(a){return void 0===a?new Oh(bd):new Oh(a.copy())}
function Mh(a,b,c,d){if(!b.contains(c)&&(!d||c.canMove()||c.canCopy()))if(c instanceof T){b.add(c,Nh(c.location));if(c instanceof U)for(var e=c.Mc;e.next();)Mh(a,b,e.value,d);for(e=c.fe;e.next();){var f=e.value;if(!b.contains(f)){var h=f.W,k=f.$;null!==h&&b.contains(h)&&null!==k&&b.contains(k)&&Mh(a,b,f,d)}}if(a.KH)for(c=c.KE();c.next();)Mh(a,b,c.value,d)}else if(c instanceof W)for(f=c,b.add(f,Nh()),c=f.Vf;c.next();)Mh(a,b,c.value,d);else c instanceof dh||b.add(c,Nh(c.location))}
hh.prototype.doDeactivate=function(){this.sa=!1;var a=this.g;null!==a&&Ph(a);Qh(this);this.jp(this.Wb);this.Wb=this.sn=null;this.pr=this.ux=!1;if(0<Rh.count){for(var b=Rh.length,c=0;c<b;c++){var d=Rh.da(c);Sh(d);Th(d);Qh(d);null!==d.g&&Ph(d.g)}Rh.clear()}Sh(this);this.rp.l(NaN,NaN);Jh=Kh=null;Th(this);a.$e=!1;a.bc="";a.Ju=!1;this.Jk()};function Qh(a){var b=a.g;if(null!==b){var c=b.wb;b.wb=!0;Uh(a,b.R,null);b.wb=c}a.Mj.length=0}
function Vh(){var a=Jh;Th(a);ii(a);var b=a.g;null!==b&&a.rp.H()&&(b.position=a.rp);null!==b&&Ph(b)}hh.prototype.doCancel=function(){Th(this);ii(this);var a=this.g;null!==a&&this.rp.H()&&(a.position=this.rp);this.stopTool()};hh.prototype.ft=function(a){if(null!==a)for(this.Aw=!0,a=a.i;a.next();){var b=a.key;b instanceof W&&(b.Dj=!0)}};hh.prototype.jp=function(a){if(null!==a){for(a=a.i;a.next();){var b=a.key;b instanceof W&&(b.Dj=!1,Eh(b)&&b.Xb())}this.Aw=!1}};
hh.prototype.doKeyDown=function(){var a=this.g;null!==a&&(a=a.R,null!==a&&this.sa&&("Esc"===a.key?this.doCancel():this.doMouseMove()))};hh.prototype.doKeyUp=function(){var a=this.g;null!==a&&null!==a.R&&this.sa&&this.doMouseMove()};function vi(a,b){for(var c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,h=a.i;h.next();){var k=h.value;if(k.de()&&k.isVisible()){var l=k.location,k=l.x,l=l.y;isNaN(k)||isNaN(l)||(k<c&&(c=k),l<d&&(d=l),k>e&&(e=k),l>f&&(f=l))}}Infinity===c?b.l(0,0,0,0):b.l(c,d,e-c,f-d)}
function wi(a,b){if(null===a.ac){var c=a.g;if(!(null===c||b&&(c.cb||c.xf))&&null!==a.Wb){var d=c.oa;d.isEnabled&&d.jF?null!==d.kj&&0<d.kj.Pf.count&&(c.oa.nq(),c.Tb("Drag")):ii(a);c.wb=!b;c.Fq=!b;a.Ik=c.zc.ca;d=a.xH?a.Wb.Fj():c.selection;d=c.Np(d,c,!0);for(c=d.i;c.next();)c.value.location=c.key.location;c=w.Df();vi(d,c);w.Gb(c);for(var c=new ka(S),e=a.Wb.i;e.next();){var f=e.key;f.de()&&f.canCopy()&&(f=d.ka(f),null!==f&&(f.Ze(),c.add(f,Nh(f.location))))}for(d=d.i;d.next();)e=d.value,e instanceof W&&
e.canCopy()&&c.add(e,Nh());a.ac=c;Ih(a,c.Fj());null!==a.dd&&(c=a.dd,d=c.Un,c.am(a.Ik.x-(d.x+d.width/2),a.Ik.y-(d.y+d.height/2)))}}}function Th(a){var b=a.g;if(null!==b){if(null!==a.ac&&(b.TA(a.ac.Fj(),!1),a.ac=null,null!==a.Wb))for(var c=a.Wb.i;c.next();)c.key instanceof W&&(c.value.point=new z(0,0));b.wb=!1;b.Fq=!1;a.Ik=b.zc.ca}}function Sh(a){if(null!==a.dd){if(a.mj&&null!==a.$i){var b=a.$i;null!==b.g&&(b.g.remove(b.Qd),b.g.remove(b.Rd))}a.dd=null;a.$i=null}}
function xi(a,b,c){var d=a.g;if(null!==d){var e=a.Ik,f=w.K();f.assign(d.R.ca);a.moveParts(b,f.Yn(e),c);w.v(f)}}
hh.prototype.moveParts=function(a,b,c){if(null!==a&&(w.G(a,ka,hh,"moveParts:parts"),0!==a.count)){var d=w.K(),e=w.K();e.assign(b);isNaN(e.x)&&(e.x=0);isNaN(e.y)&&(e.y=0);(b=this.Aw)||this.ft(a);for(var f=new I(yi),h=new I(Ca),k=a.i;k.next();){var l=k.key;if(l.de()){var m=zi(this,l,a);if(null!==m)f.add(new yi(l,k.value,m));else if(!c||l.canMove()){m=k.value.point;d.assign(m);var n=w.K(),p=this.computeMove(l,d.add(e),a,n);l.location=p;k.value.eG=n.Yn(m);w.v(n)}}else k.key instanceof W&&h.add(k.Va)}for(c=
f.i;c.next();)f=c.value,m=f.info.point,d.assign(m),f.Nc.location=d.add(f.aI.eG);c=w.K();m=w.K();for(h=h.i;h.next();)if(k=h.value,f=k.key,f instanceof W)if(f.Dj)l=f.W,n=f.$,null!==this.dd&&this.mj?(k=k.value.point,a.add(f,Nh(e)),l=e.x-k.x,k=e.y-k.y,f.am(l,k)):(null!==l&&(c.assign(l.location),p=a.ka(l),null!==p&&c.Yn(p.point)),null!==n&&(m.assign(n.location),p=a.ka(n),null!==p&&m.Yn(p.point)),null!==l&&null!==n?c.Ic(m)?(k=k.value.point,l=d,l.assign(c),l.Yn(k),a.add(f,Nh(c)),f.am(l.x,l.y)):(f.Dj=!1,
f.Xb()):(k=k.value.point,n=null!==l?c:null!==n?m:e,a.add(f,Nh(n)),l=n.x-k.x,k=n.y-k.y,f.am(l,k)));else if(null===f.W||null===f.$)k=k.value.point,a.add(f,Nh(e)),l=e.x-k.x,k=e.y-k.y,f.am(l,k);w.v(d);w.v(e);w.v(c);w.v(m);b||(Ai(this.g),this.jp(a))}};function zi(a,b,c){b=b.Ka;if(null!==b){a=zi(a,b,c);if(null!==a)return a;a=c.ka(b);if(null!==a)return a}return null}
function ii(a){if(null!==a.Wb){for(var b=a.g,c=a.Wb.i;c.next();){var d=c.key;d.de()&&(d.location=c.value.point)}for(c=a.Wb.i;c.next();)if(d=c.key,d instanceof W&&d.Dj){var e=c.value.point;a.Wb.add(d,Nh());d.am(-e.x,-e.y)}b.Yf()}}
hh.prototype.computeMove=function(a,b,c,d){void 0===d&&(d=new z);d.assign(b);if(null===a)return d;void 0===c&&(c=null);var e=b;if(this.vx&&(this.pI||null===c||null!==this.g&&this.g.R.up)&&(e=w.K(),c=e,c.assign(b),null!==a)){var f=this.g;if(null!==f){var h=f.Bn,k=this.WE,f=k.width,k=k.height,l=this.$H,m=l.x,l=l.y,n=this.ZH;if(null!==h){var p=h.px;isNaN(f)&&(f=p.width);isNaN(k)&&(k=p.height);h=h.VE;isNaN(m)&&(m=h.x);isNaN(l)&&(l=h.y)}h=w.xb(0,0);h.Hu(0,0,f,k,n);Ka(b.x,b.y,m+h.x,l+h.y,f,k,c);w.v(h)}}c=
null!==a.AE?a.AE(a,b,e):e;k=a.RI;f=k.x;isNaN(f)&&(f=a.location.x);k=k.y;isNaN(k)&&(k=a.location.y);h=a.KI;m=h.x;isNaN(m)&&(m=a.location.x);h=h.y;isNaN(h)&&(h=a.location.y);d.l(Math.max(f,Math.min(c.x,m)),Math.max(k,Math.min(c.y,h)));e!==b&&w.v(e);return d};function Bi(a,b){if(null===b)return!0;var c=b.U;return null===c||c instanceof dh||c.layer.Jc||a.Wb&&a.Wb.contains(c)||a.ac&&a.ac.contains(c)?!0:!1}
function Ci(a,b,c,d){var e=a.g;if(null!==e){a.mj&&(null!==a.dd&&(a.dd.W=null,a.dd.$=null),Di(a,!1));var f=Ei(e,b,null,function(b){return!Bi(a,b)}),h=e.R;h.Pe=f;var k=e.wb,l=!1;try{e.wb=!0;l=Uh(a,h,f);if(!a.sa&&null===Jh)return;if(null===f){var m=e.VI;null!==m&&(m(h),l=!0)}if(!a.sa&&null===Jh)return;a.doDragOver(b,f);if(!a.sa&&null===Jh)return}finally{e.wb=k,l&&e.Yf()}(e.me||e.ne)&&(c||d)&&e.bA(h.bf)}}
function Uh(a,b,c){var d=!1,e=a.Mj.length,f=0<e?a.Mj[0]:null;if(c===f)return!1;b.Ac=!1;for(var h=0;h<e;h++){var k=a.Mj[h],l=k.UI;if(null!==l&&(l(b,k,c),d=!0,b.Ac))break}a.Mj.length=0;if(!a.sa&&null===Jh||null===c)return d;for(b.Ac=!1;null!==c;)a.Mj.push(c),c=Fi(c);e=a.Mj.length;for(h=0;h<e&&(k=a.Mj[h],l=k.TI,null===l||(l(b,k,f),d=!0,!b.Ac));h++);return d}function Fi(a){var b=a.O;return null!==b?b:a instanceof S&&!(a instanceof U)&&(a=a.Ka,null!==a&&a.dI)?a:null}
function Gi(a,b,c){var d=a.$i;if(null===d)return null;var e=a.g.un(b,d.HF,function(a){return d.findValidLinkablePort(a,c)});a=w.K();for(var f=Infinity,h=null,e=e.i;e.next();){var k=e.value;if(null!==k.U){var l=k.Wa(Fb,a),l=b.uf(l);l<f&&(h=k,f=l)}}w.v(a);return h}
function Di(a,b){var c=a.dd;if(null!==c&&!(2>c.qa)){var d=a.g;if(null!==d&&!d.cb&&(d=a.$i,null!==d)){var e=null,f=null;null===c.W&&(e=Gi(a,c.m(0),!1),null!==e&&(f=e.U));var h=null,k=null;null===c.$&&(h=Gi(a,c.m(c.qa-1),!0),null!==h&&(k=h.U));d.isValidLink(f,e,k,h)?b?(c.Op=c.m(0),c.Pp=c.m(c.qa-1),c.Dj=!1,c.W=f,null!==e&&(c.Jg=e.Pd),c.$=k,null!==h&&(c.Eh=h.Pd)):Hi(d,f,e,k,h):Hi(d,null,null,null,null)}}}hh.prototype.doDragOver=function(){};
function Ii(a,b){var c=a.g;if(null!==c){a.mj&&Di(a,!0);Qh(a);var d=Ei(c,b,null,function(b){return!Bi(a,b)}),e=c.R;e.Pe=d;if(null!==d){e.Ac=!1;for(var f=d;null!==f;){var h=f.GA;if(null!==h&&(h(e,f),e.Ac))break;f=Fi(f)}}else f=c.GA,null!==f&&f(e);if(a.sa||null!==Jh){for(e=(a.ac||a.Wb).i;e.next();)f=e.key,f instanceof T&&f.fe.each(function(a){a.Dj=!1});a.doDropOnto(b,d);if(a.sa||null!==Jh){d=w.Df();for(e=c.selection.i;e.next();)f=e.value,f instanceof T&&Ji(c,f.getAvoidableRect(d));w.Gb(d)}}}}
hh.prototype.doDropOnto=function(){};hh.prototype.doMouseMove=function(){if(this.sa){var a=this.g;if(null!==a&&null!==this.sn&&null!==this.Wb){var b=!1,c=!1;this.mayCopy()?(b=!0,a.bc="copy",wi(this,!1),this.ft(this.ac),xi(this,this.ac,!1),this.jp(this.ac)):this.mayMove()?(c=!0,a.bc="default",Th(this),xi(this,this.Wb,!0)):this.mayDragOut()?(a.bc="no-drop",wi(this,!1),xi(this,this.ac,!1)):Th(this);Ci(this,a.R.ca,c,b)}}};
hh.prototype.doMouseUp=function(){if(this.sa){var a=this.g;if(null!==a){var b=!1,c=this.mayCopy();c&&null!==this.ac?(Th(this),wi(this,!0),this.ft(this.ac),xi(this,this.ac,!1),this.jp(this.ac),null!==this.ac&&a.$F(this.ac.Fj())):(b=!0,Th(this),this.mayMove()&&(xi(this,this.Wb,!0),Ci(this,a.R.ca,!0,!1)));this.pr=!0;Ii(this,a.R.ca);if(this.sa){this.ac=null;if(b&&null!==this.Wb)for(b=this.Wb.i;b.next();){var d=b.key;d instanceof T&&(d=d.Ka,null===d||null===d.placeholder||this.Wb.contains(d)||d.placeholder.I())}a.qc();
this.jp(this.Wb);this.Ff=c?"Copy":"Move";a.Ba(c?"SelectionCopied":"SelectionMoved",a.selection)}this.stopTool()}}};hh.prototype.mayCopy=function(){if(!this.eF)return!1;var a=this.g;if(null===a||a.cb||a.xf||!a.Ep||!a.sk||(w.Ek?!a.R.alt:!a.R.control))return!1;for(a=a.selection.i;a.next();){var b=a.value;if(b.de()&&b.canCopy())return!0}return null!==this.dd&&this.mj&&this.dd.canCopy()?!0:!1};
hh.prototype.mayDragOut=function(){if(!this.eF)return!1;var a=this.g;if(null===a||!a.zt||!a.sk||a.Dl)return!1;for(a=a.selection.i;a.next();){var b=a.value;if(b.de()&&b.canCopy())return!0}return null!==this.dd&&this.mj&&this.dd.canCopy()?!0:!1};hh.prototype.mayMove=function(){var a=this.g;if(null===a||a.cb||!a.Dl)return!1;for(a=a.selection.i;a.next();){var b=a.value;if(b.de()&&b.canMove())return!0}return null!==this.dd&&this.mj&&this.dd.canMove()?!0:!1};var Rh=new I(hh),Jh=null,Kh=null;
hh.prototype.getDraggingSource=function(){return Jh};hh.prototype.mayDragIn=function(){var a=this.g;if(null===a||!a.eE||a.cb||a.xf||!a.Ep)return!1;var b=Jh;return null===b||null===b.g||b.g.ba.Kl!==a.ba.Kl?!1:!0};hh.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.g;a.Pa.pi();Ki(a);a=Jh;null!==a&&null!==a.g&&(a.g.bc="copy")}};hh.prototype.doSimulatedDragLeave=function(){var a=Jh;null!==a&&a.doSimulatedDragOut();this.doCancel()};
hh.prototype.doSimulatedDragOver=function(){var a=this.g;if(null!==a){var b=Jh;null!==b&&null!==b.Wb&&this.mayDragIn()&&(a.bc="copy",Li(this,b.Wb.Fj(),!1),xi(this,this.ac,!1),Ci(this,a.R.ca,!1,!0))}};
hh.prototype.doSimulatedDrop=function(){var a=this.g;if(null!==a){var b=Jh;if(null!==b){var c=b.g;b.pr=!0;Th(this);this.mayDragIn()&&(this.Tb("Drop"),Li(this,b.Wb.Fj(),!0),xi(this,this.ac,!1),null!==this.ac&&a.$F(this.ac.Fj()),Ii(this,a.R.ca),a.qc(),b=a.selection,null!==this.ac?this.Ff="ExternalCopy":b=new J(S),this.ac=null,a.doFocus(),a.Ba("ExternalObjectsDropped",b,c),this.Jk())}}};
function Li(a,b,c){if(null===a.ac){var d=a.g;if(null!==d&&!d.cb&&!d.xf){d.wb=!c;d.Fq=!c;a.Ik=d.R.ca;d=d.Np(b,d,!0);c=w.Df();vi(b,c);var e=c.x+c.width/2,f=c.y+c.height/2;w.Gb(c);var h=a.xw;c=new ka(S);var k=w.K();for(b=b.i;b.next();){var l=b.value;if(l.de()&&l.canCopy()){var m=l.location,l=d.ka(l);k.l(h.x-(e-m.x),h.y-(f-m.y));l.location=k;l.Ze();c.add(l,Nh(k))}}w.v(k);for(d=d.i;d.next();)e=d.value,e instanceof W&&e.canCopy()&&c.add(e,Nh());a.ac=c;Ih(a,c.Fj());null!==a.dd&&(c=a.dd,d=c.Un,c.am(a.Ik.x-
(d.x+d.width/2),a.Ik.y-(d.y+d.height/2)))}}}hh.prototype.doSimulatedDragOut=function(){var a=this.g;null!==a&&(this.mayCopy()||this.mayMove()?a.bc="":a.bc="no-drop")};function Oh(a){this.point=a;this.eG=bd}w.fa("DraggingInfo",Oh);function yi(a,b,c){this.Nc=a;this.info=b;this.aI=c}
function Mi(){0<arguments.length&&w.hd(Mi);ng.call(this);this.qD=100;this.RC=!1;var a=new W,b=new X;b.Uf=!0;b.stroke="blue";a.add(b);b=new X;b.zq="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.Wf="Tool";this.KD=a;a=new T;b=new X;b.Pd="";b.Cb="Rectangle";b.fill=null;b.stroke="magenta";b.kb=2;b.Aa=od;a.add(b);a.dm=!1;a.Wf="Tool";this.HD=a;this.JD=b;a=new T;b=new X;b.Pd="";b.Cb="Rectangle";b.fill=null;b.stroke="magenta";b.kb=2;b.Aa=od;a.add(b);a.dm=!1;a.Wf="Tool";this.LD=a;this.MD=b;this.oD=this.nD=
this.jD=this.iD=this.kD=null;this.NC=!0;this.SG=new ka(G,"boolean");this.rD=this.ml=this.ED=null}w.La(Mi,ng);w.fa("LinkingBaseTool",Mi);Mi.prototype.doStop=function(){var a=this.g;null!==a&&Ph(a);this.Rg=this.Qg=this.Pg=this.Og=this.jc=null;this.ly.clear();this.Cf=null};w.defineProperty(Mi,{HF:"portGravity"},function(){return this.qD},function(a){w.j(a,"number",Mi,"portGravity");0<=a&&(this.qD=a)});
w.defineProperty(Mi,{dq:"isUnconnectedLinkValid"},function(){return this.RC},function(a){w.j(a,"boolean",Mi,"isUnconnectedLinkValid");this.RC=a});w.defineProperty(Mi,{Wg:"temporaryLink"},function(){return this.KD},function(a){w.G(a,W,Mi,"temporaryLink");this.KD=a});w.defineProperty(Mi,{Qd:"temporaryFromNode"},function(){return this.HD},function(a){w.G(a,T,Mi,"temporaryFromNode");this.HD=a});
w.defineProperty(Mi,{Zn:"temporaryFromPort"},function(){return this.JD},function(a){w.G(a,G,Mi,"temporaryFromPort");this.JD=a});w.defineProperty(Mi,{Rd:"temporaryToNode"},function(){return this.LD},function(a){w.G(a,T,Mi,"temporaryToNode");this.LD=a});w.defineProperty(Mi,{$n:"temporaryToPort"},function(){return this.MD},function(a){w.G(a,G,Mi,"temporaryToPort");this.MD=a});w.defineProperty(Mi,{jc:"originalLink"},function(){return this.kD},function(a){null!==a&&w.G(a,W,Mi,"originalLink");this.kD=a});
w.defineProperty(Mi,{Og:"originalFromNode"},function(){return this.iD},function(a){null!==a&&w.G(a,T,Mi,"originalFromNode");this.iD=a});w.defineProperty(Mi,{Pg:"originalFromPort"},function(){return this.jD},function(a){null!==a&&w.G(a,G,Mi,"originalFromPort");this.jD=a});w.defineProperty(Mi,{Qg:"originalToNode"},function(){return this.nD},function(a){null!==a&&w.G(a,T,Mi,"originalToNode");this.nD=a});
w.defineProperty(Mi,{Rg:"originalToPort"},function(){return this.oD},function(a){null!==a&&w.G(a,G,Mi,"originalToPort");this.oD=a});w.defineProperty(Mi,{Md:"isForwards"},function(){return this.NC},function(a){w.j(a,"boolean",Mi,"isForwards");this.NC=a});w.u(Mi,{ly:"validPortsCache"},function(){return this.SG});w.defineProperty(Mi,{Cf:"targetPort"},function(){return this.ED},function(a){null!==a&&w.G(a,G,Mi,"targetPort");this.ED=a});
Mi.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){d.Aa=b.Y.size;e?(d.Bb=b.Bb,d.jm=b.jm):(d.Ab=b.Ab,d.Rl=b.Rl);c.zf=Fb;var f=w.K();c.location=b.Wa(Fb,f);w.v(f);d.angle=b.xn();null!==this.Qx&&this.Qx(a,b,c,d,e)}};Mi.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.Aa=od,b.Ab=sb,b.Bb=sb);null!==a&&null!==this.g&&(a.location=this.g.R.ca);null!==this.Qx&&this.Qx(null,null,a,b,c)};Mi.prototype.doMouseDown=function(){this.sa&&this.doMouseMove()};
Mi.prototype.doMouseMove=function(){if(this.sa){var a=this.g;if(null!==a){this.Cf=this.findTargetPort(this.Md);if(null!==this.Cf&&this.Cf.U instanceof T){var b=this.Cf.U;this.Md?this.copyPortProperties(b,this.Cf,this.Rd,this.$n,!0):this.copyPortProperties(b,this.Cf,this.Qd,this.Zn,!1)}else this.Md?this.setNoTargetPortProperties(this.Rd,this.$n,!0):this.setNoTargetPortProperties(this.Qd,this.Zn,!1);(a.me||a.ne)&&a.bA(a.R.bf)}}};
Mi.prototype.findValidLinkablePort=function(a,b){if(null===a)return null;var c=a.U;if(!(c instanceof T))return null;for(;null!==a;){var d=b?a.mG:a.ME;if(!0===d&&(null!==a.Pd||a instanceof T)&&(b?this.isValidTo(c,a):this.isValidFrom(c,a)))return a;if(!1===d)break;a=a.O}return null};
Mi.prototype.findTargetPort=function(a){var b=this.g,c=b.R.ca,d=this.HF;0>=d&&(d=.1);for(var e=this,f=b.un(c,d,function(b){return e.findValidLinkablePort(b,a)},null,!0),d=Infinity,b=null,f=f.i;f.next();){var h=f.value,k=h.U;if(k instanceof T){var l=h.Wa(Fb,w.K()),m=c.x-l.x,n=c.y-l.y;w.v(l);l=m*m+n*n;l<d&&(m=this.ly.ka(h),null!==m?m&&(b=h,d=l):a&&this.isValidLink(this.Og,this.Pg,k,h)||!a&&this.isValidLink(k,h,this.Qg,this.Rg)?(this.ly.add(h,!0),b=h,d=l):this.ly.add(h,!1))}}return null!==b&&(c=b.U,
c instanceof T&&(null===c.layer||c.layer.At))?b:null};Mi.prototype.isValidFrom=function(a,b){if(null===a||null===b)return this.dq;if(null!==this.g&&this.g.Za===this&&(null!==a.layer&&!a.layer.At||!0!==b.ME))return!1;var c=b.jA;if(Infinity>c){if(null!==this.jc&&a===this.Og&&b===this.Pg)return!0;var d=b.Pd;null===d&&(d="");if(a.ix(d).count>=c)return!1}return!0};
Mi.prototype.isValidTo=function(a,b){if(null===a||null===b)return this.dq;if(null!==this.g&&this.g.Za===this&&(null!==a.layer&&!a.layer.At||!0!==b.mG))return!1;var c=b.KJ;if(Infinity>c){if(null!==this.jc&&a===this.Qg&&b===this.Rg)return!0;var d=b.Pd;null===d&&(d="");if(a.Ig(d).count>=c)return!1}return!0};Mi.prototype.isInSameNode=function(a,b){if(null===a||null===b)return!1;if(a===b)return!0;var c=a.U,d=b.U;return null!==c&&c===d};
Mi.prototype.isLinked=function(a,b){if(null===a||null===b)return!1;var c=a.U;if(!(c instanceof T))return!1;var d=a.Pd;null===d&&(d="");var e=b.U;if(!(e instanceof T))return!1;var f=b.Pd;null===f&&(f="");for(e=e.Ig(f);e.next();)if(f=e.value,f.W===c&&f.Jg===d)return!0;return!1};
Mi.prototype.isValidLink=function(a,b,c,d){if(!this.isValidFrom(a,b)||!this.isValidTo(c,d)||!(null===b||null===d||(b.RH&&d.JJ||!this.isInSameNode(b,d))&&(b.QH&&d.IJ||!this.isLinked(b,d)))||null!==this.jc&&(null!==a&&this.isLabelDependentOnLink(a,this.jc)||null!==c&&this.isLabelDependentOnLink(c,this.jc))||null!==a&&null!==c&&(null===a.data&&null!==c.data||null!==a.data&&null===c.data)||!this.isValidCycle(a,c,this.jc))return!1;if(null!==a){var e=a.Gx;if(null!==e&&!e(a,b,c,d,this.jc))return!1}if(null!==
c&&(e=c.Gx,null!==e&&!e(a,b,c,d,this.jc)))return!1;e=this.Gx;return null!==e?e(a,b,c,d,this.jc):!0};Mi.prototype.isLabelDependentOnLink=function(a,b){if(null===a)return!1;var c=a.Lc;if(null===c)return!1;if(c===b)return!0;var d=new J(T);d.add(a);return Ni(this,c,b,d)};function Ni(a,b,c,d){if(b===c)return!0;var e=b.W;if(null!==e&&e.lf&&(d.add(e),Ni(a,e.Lc,c,d)))return!0;b=b.$;return null!==b&&b.lf&&(d.add(b),Ni(a,b.Lc,c,d))?!0:!1}
Mi.prototype.isValidCycle=function(a,b,c){void 0===c&&(c=null);if(null===a||null===b)return this.dq;var d=null!==this.g?this.g.QJ:Oi;if(d!==Oi){if(d===Pi){if(null!==c&&!c.Kc)return!0;for(d=b.fe;d.next();){var e=d.value;if(e!==c&&e.Kc&&e.$===b)return!1}return!Qi(this,a,b,c,!0)}if(d===Ri){if(null!==c&&!c.Kc)return!0;for(d=a.fe;d.next();)if(e=d.value,e!==c&&e.Kc&&e.W===a)return!1;return!Qi(this,a,b,c,!0)}if(d===Si)return a===b?a=!0:(d=new J(T),d.add(b),a=Ti(this,d,a,b,c)),!a;if(d===Ui)return!Qi(this,
a,b,c,!1);if(d===Vi)return a===b?a=!0:(d=new J(T),d.add(b),a=Wi(this,d,a,b,c)),!a}return!0};function Qi(a,b,c,d,e){if(b===c)return!0;if(null===b||null===c)return!1;for(var f=b.fe;f.next();){var h=f.value;if(h!==d&&(!e||h.Kc)&&h.$===b&&(h=h.W,h!==b&&Qi(a,h,c,d,e)))return!0}return!1}function Ti(a,b,c,d,e){if(c===d)return!0;if(null===c||null===d||b.contains(c))return!1;b.add(c);for(var f=c.fe;f.next();){var h=f.value;if(h!==e&&h.$===c&&(h=h.W,h!==c&&Ti(a,b,h,d,e)))return!0}return!1}
function Wi(a,b,c,d,e){if(c===d)return!0;if(null===c||null===d||b.contains(c))return!1;b.add(c);for(var f=c.fe;f.next();){var h=f.value;if(h!==e){var k=h.W,h=h.$,k=k===c?h:k;if(k!==c&&Wi(a,b,k,d,e))return!0}}return!1}w.defineProperty(Mi,{Gx:"linkValidation"},function(){return this.ml},function(a){null!==a&&w.j(a,"function",Mi,"linkValidation");this.ml=a});w.defineProperty(Mi,{Qx:"portTargeted"},function(){return this.rD},function(a){null!==a&&w.j(a,"function",Mi,"portTargeted");this.rD=a});
function Xi(){0<arguments.length&&w.hd(Xi);Mi.call(this);this.name="Linking";this.NB={};this.MB=null;this.aa=Yi;this.zD=null}w.La(Xi,Mi);w.fa("LinkingTool",Xi);var Yi;Xi.Either=Yi=w.p(Xi,"Either",0);var Zi;Xi.ForwardsOnly=Zi=w.p(Xi,"ForwardsOnly",0);var $i;Xi.BackwardsOnly=$i=w.p(Xi,"BackwardsOnly",0);w.defineProperty(Xi,{dH:"archetypeLinkData"},function(){return this.NB},function(a){null!==a&&w.G(a,Object,Xi,"archetypeLinkData");a instanceof G&&w.G(a,W,Xi,"archetypeLinkData");this.NB=a});
w.defineProperty(Xi,{hE:"archetypeLabelNodeData"},function(){return this.MB},function(a){null!==a&&w.G(a,Object,Xi,"archetypeLabelNodeData");a instanceof G&&w.G(a,T,Xi,"archetypeLabelNodeData");this.MB=a});w.defineProperty(Xi,{direction:"direction"},function(){return this.aa},function(a){w.mb(a,Xi,Xi,"direction");this.aa=a});w.defineProperty(Xi,{hG:"startObject"},function(){return this.zD},function(a){null!==a&&w.G(a,G,Xi,"startObject");this.zD=a});
Xi.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;if(null===a||a.cb||a.xf||!a.At)return!1;var b=a.ba;return(b instanceof P||b instanceof Zf)&&a.R.left&&(a.Za===this||this.isBeyondDragSize())?null!==this.findLinkablePort():!1};
Xi.prototype.findLinkablePort=function(){var a=this.g;if(null===a)return null;var b=this.hG;null===b&&(b=a.Je(a.zc.ca,null,null));if(null===b||!(b.U instanceof T))return null;a=this.direction;if(a===Yi||a===Zi){var c=this.findValidLinkablePort(b,!1);if(null!==c)return this.Md=!0,c}if(a===Yi||a===$i)if(c=this.findValidLinkablePort(b,!0),null!==c)return this.Md=!1,c;return null};
Xi.prototype.doActivate=function(){var a=this.g;if(null!==a){var b=this.findLinkablePort();null!==b&&(this.Tb(this.name),a.$e=!0,a.bc="pointer",this.Md?(null===this.Rd||this.Rd.location.H()||(this.Rd.location=a.R.ca),this.Pg=b,b=this.Pg.U,b instanceof T&&(this.Og=b),this.copyPortProperties(this.Og,this.Pg,this.Qd,this.Zn,!1)):(null===this.Qd||this.Qd.location.H()||(this.Qd.location=a.R.ca),this.Rg=b,b=this.Rg.U,b instanceof T&&(this.Qg=b),this.copyPortProperties(this.Qg,this.Rg,this.Rd,this.$n,!0)),
a.add(this.Qd),a.add(this.Rd),null!==this.Wg&&(null!==this.Qd&&(this.Wg.W=this.Qd),null!==this.Rd&&(this.Wg.$=this.Rd),this.Wg.Xb(),a.add(this.Wg)),this.sa=!0)}};Xi.prototype.doDeactivate=function(){this.sa=!1;var a=this.g;null!==a&&(a.remove(this.Wg),a.remove(this.Qd),a.remove(this.Rd),a.$e=!1,a.bc="",this.Jk())};Xi.prototype.doStop=function(){Mi.prototype.doStop.call(this);this.hG=null};
Xi.prototype.doMouseUp=function(){if(this.sa){var a=this.g;if(null===a)return;var b=this.Ff=null,c=null,d=null,e=null,f=this.Cf=this.findTargetPort(this.Md);if(null!==f){var h=f.U;h instanceof T&&(this.Md?(null!==this.Og&&(b=this.Og,c=this.Pg),d=h,e=f):(b=h,c=f,null!==this.Qg&&(d=this.Qg,e=this.Rg)))}else this.Md?null!==this.Og&&this.dq&&(b=this.Og,c=this.Pg):null!==this.Qg&&this.dq&&(d=this.Qg,e=this.Rg);null!==b||null!==d?(h=this.insertLink(b,c,d,e),null!==h?(null===f&&(this.Md?h.Pp=a.R.ca:h.Op=
a.R.ca),a.tf&&a.select(h),this.Ff=this.name,a.Ba("LinkDrawn",h)):(a.ba.lE(),this.doNoLink(b,c,d,e))):this.Md?this.doNoLink(this.Og,this.Pg,null,null):this.doNoLink(null,null,this.Qg,this.Rg)}this.stopTool()};
Xi.prototype.insertLink=function(a,b,c,d){var e=this.g;if(null===e)return null;var f=e.ba;if(f instanceof Zf){var h=a;b=c;e.Od||(h=c,b=a);if(null!==h&&null!==b)return f.oi(b.data,f.ub(h.data)),b.vn()}else if(f instanceof P)if(h="",null!==a&&(null===b&&(b=a),h=b.Pd,null===h&&(h="")),b="",null!==c&&(null===d&&(d=c),b=d.Pd,null===b&&(b="")),d=this.dH,d instanceof W){if(fh(d),f=d.copy(),null!==f)return f.W=a,f.Jg=h,f.$=c,f.Eh=b,e.add(f),a=this.hE,a instanceof T&&(fh(a),a=a.copy(),null!==a&&(a.Lc=f,e.add(a))),
f}else if(null!==d&&(d=f.Uw(d),w.Qa(d)))return null!==a&&f.$A(d,f.ub(a.data)),f.aB(d,h),null!==c&&f.fB(d,f.ub(c.data)),f.gB(d,b),f.vt(d),a=this.hE,null===a||a instanceof T||(a=f.copyNodeData(a),w.Qa(a)&&(f.Al(a),a=f.ub(a),void 0!==a&&f.cE(d,a))),f=e.Qf(d);return null};Xi.prototype.doNoLink=function(){};
function Lh(){0<arguments.length&&w.hd(Lh);Mi.call(this);this.name="Relinking";var a=new X;a.Cb="Diamond";a.Aa=zd;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="pointer";a.Me=0;this.AC=a;a=new X;a.Cb="Diamond";a.Aa=zd;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="pointer";a.Me=-1;this.ND=a;this.ec=null;this.lD=new A}w.La(Lh,Mi);w.fa("RelinkingTool",Lh);
Lh.prototype.updateAdornments=function(a){if(null!==a&&a instanceof W){var b="RelinkFrom",c=null;if(a.eb&&null!==this.g&&!this.g.cb){var d=a.Eu;null!==d&&a.canRelinkFrom()&&a.Y.H()&&a.isVisible()&&d.Y.H()&&d.vj()&&(c=a.Tp(b),null===c&&(c=this.makeAdornment(d,!1),a.zl(b,c)))}null===c&&a.Aj(b);b="RelinkTo";c=null;a.eb&&null!==this.g&&!this.g.cb&&(d=a.Eu,null!==d&&a.canRelinkTo()&&a.Y.H()&&a.isVisible()&&d.Y.H()&&d.vj()&&(c=a.Tp(b),null===c&&(c=this.makeAdornment(d,!0),a.zl(b,c))));null===c&&a.Aj(b)}};
Lh.prototype.makeAdornment=function(a,b){var c=new dh;c.type=aj;var d=b?this.HJ:this.PH;null!==d&&c.add(d.copy());c.qb=a;return c};w.defineProperty(Lh,{PH:"fromHandleArchetype"},function(){return this.AC},function(a){null!==a&&w.G(a,G,Lh,"fromHandleArchetype");this.AC=a});w.defineProperty(Lh,{HJ:"toHandleArchetype"},function(){return this.ND},function(a){null!==a&&w.G(a,G,Lh,"toHandleArchetype");this.ND=a});w.u(Lh,{handle:"handle"},function(){return this.ec});
Lh.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;if(null===a||a.cb||a.xf||!a.hn)return!1;var b=a.ba;if(!(b instanceof P||b instanceof Zf)||!a.R.left)return!1;b=this.findToolHandleAt(a.zc.ca,"RelinkFrom");null===b&&(b=this.findToolHandleAt(a.zc.ca,"RelinkTo"));return null!==b};
Lh.prototype.doActivate=function(){var a=this.g;if(null!==a){if(null===this.jc){var b=this.findToolHandleAt(a.zc.ca,"RelinkFrom");null===b&&(b=this.findToolHandleAt(a.zc.ca,"RelinkTo"));if(null===b)return;var c=b.U;if(!(c instanceof dh&&c.Nf instanceof W))return;this.ec=b;this.Md=null===c||"RelinkTo"===c.rd;this.jc=c.Nf}this.Tb(this.name);a.$e=!0;a.bc="pointer";this.Pg=this.jc.ed;this.Og=this.jc.W;this.Rg=this.jc.Sd;this.Qg=this.jc.$;this.lD.set(this.jc.Y);null!==this.jc&&0<this.jc.qa&&(null===this.jc.W&&
(null!==this.Zn&&(this.Zn.Aa=nd),null!==this.Qd&&(this.Qd.location=this.jc.m(0))),null===this.jc.$&&(null!==this.$n&&(this.$n.Aa=nd),null!==this.Rd&&(this.Rd.location=this.jc.m(this.jc.qa-1))));this.copyPortProperties(this.Og,this.Pg,this.Qd,this.Zn,!1);this.copyPortProperties(this.Qg,this.Rg,this.Rd,this.$n,!0);a.add(this.Qd);a.add(this.Rd);null!==this.Wg&&(null!==this.Qd&&(this.Wg.W=this.Qd),null!==this.Rd&&(this.Wg.$=this.Rd),this.copyLinkProperties(this.jc,this.Wg),this.Wg.Xb(),a.add(this.Wg));
this.sa=!0}};Lh.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.xt=a.xt;b.Yz=a.Yz;var c=a.Ye;if(c===bj||c===cj)c=dj;b.Ye=c;b.Xw=a.Xw;b.Zx=a.Zx;b.wq=a.wq;b.Ab=a.Ab;b.Rl=a.Rl;b.St=a.St;b.Tt=a.Tt;b.Bb=a.Bb;b.jm=a.jm;b.Lu=a.Lu;b.Mu=a.Mu}};Lh.prototype.doDeactivate=function(){this.sa=!1;var a=this.g;null!==a&&(a.remove(this.Wg),a.remove(this.Qd),a.remove(this.Rd),a.$e=!1,a.bc="",this.Jk())};Lh.prototype.doStop=function(){Mi.prototype.doStop.call(this);this.ec=null};
Lh.prototype.doMouseUp=function(){if(this.sa){var a=this.g;if(null===a)return;this.Ff=null;var b=this.Og,c=this.Pg,d=this.Qg,e=this.Rg,f=this.jc;this.Cf=this.findTargetPort(this.Md);if(null!==this.Cf){var h=this.Cf.U;h instanceof T&&(this.Md?(d=h,e=this.Cf):(b=h,c=this.Cf))}else this.dq?this.Md?e=d=null:c=b=null:f=null;null!==f?(this.reconnectLink(f,this.Md?d:b,this.Md?e:c,this.Md),null===this.Cf&&(this.Md?f.Pp=a.R.ca:f.Op=a.R.ca,f.Xb()),a.tf&&(f.eb=!0),this.Ff=this.name,a.Ba("LinkRelinked",f,this.Md?
this.Rg:this.Pg)):this.doNoRelink(this.jc,this.Md);ej(this.jc,this.lD)}this.stopTool()};Lh.prototype.reconnectLink=function(a,b,c,d){if(null===this.g)return!1;c=null!==c&&null!==c.Pd?c.Pd:"";d?(a.$=b,a.Eh=c):(a.W=b,a.Jg=c);return!0};Lh.prototype.doNoRelink=function(){};function Hi(a,b,c,d,e){null!==a.g&&(null!==b?(a.copyPortProperties(b,c,a.Qd,a.Zn,!1),a.g.add(a.Qd)):a.g.remove(a.Qd),null!==d?(a.copyPortProperties(d,e,a.Rd,a.$n,!0),a.g.add(a.Rd)):a.g.remove(a.Rd))}
function fj(){0<arguments.length&&w.hd(fj);ng.call(this);this.name="LinkReshaping";var a=new X;a.Cb="Rectangle";a.Aa=yd;a.fill="lightblue";a.stroke="dodgerblue";this.bl=a;a=new X;a.Cb="Diamond";a.Aa=yd;a.fill="lightblue";a.stroke="dodgerblue";this.YC=a;this.sD=3;this.Ay=this.ec=null;this.fp=new z;this.fw=null}w.La(fj,ng);w.fa("LinkReshapingTool",fj);var gj;fj.None=gj=w.p(fj,"None",0);var hj;fj.Horizontal=hj=w.p(fj,"Horizontal",1);var ij;fj.Vertical=ij=w.p(fj,"Vertical",2);var rj;
fj.All=rj=w.p(fj,"All",3);fj.prototype.getReshapingBehavior=fj.prototype.QE=function(a){return a&&a.rz?a.rz:gj};fj.prototype.setReshapingBehavior=fj.prototype.Gu=function(a,b){w.G(a,G,fj,"setReshapingBehavior:obj");w.mb(b,fj,fj,"setReshapingBehavior:behavior");a.rz=b};
fj.prototype.updateAdornments=function(a){if(null!==a&&a instanceof W){if(a.eb&&null!==this.g&&!this.g.cb){var b=a.path;if(null!==b&&a.canReshape()&&a.Y.H()&&a.isVisible()&&b.Y.H()&&b.vj()){var c=a.Tp(this.name);if(null===c||c.fD!==a.qa||c.WD!==a.Au)c=this.makeAdornment(b),null!==c&&(c.fD=a.qa,c.WD=a.Au,a.zl(this.name,c));if(null!==c){c.location=a.position;return}}}a.Aj(this.name)}};
fj.prototype.makeAdornment=function(a){var b=a.U,c=b.qa,d=b.ic,e=null;if(null!==b.points&&1<c){e=new dh;e.type=aj;var c=b.Ot,f=b.Cx,h=d?1:0;if(b.Au&&b.Ye!==sj)for(var k=c+h;k<f-h;k++){var l=this.makeResegmentHandle(a,k);null!==l&&(l.Me=k,l.XA=.5,l.jA=999,e.add(l))}for(k=c+1;k<f;k++)if(l=this.makeHandle(a,k),null!==l){l.Me=k;if(k!==c)if(k===c+1&&d){var h=b.m(c),m=b.m(c+1);K(h.x,m.x)&&K(h.y,m.y)&&(m=b.m(c-1));K(h.x,m.x)?(this.Gu(l,ij),l.cursor="n-resize"):K(h.y,m.y)&&(this.Gu(l,hj),l.cursor="w-resize")}else k===
f-1&&d?(h=b.m(f-1),m=b.m(f),K(h.x,m.x)&&K(h.y,m.y)&&(h=b.m(f+1)),K(h.x,m.x)?(this.Gu(l,ij),l.cursor="n-resize"):K(h.y,m.y)&&(this.Gu(l,hj),l.cursor="w-resize")):k!==f&&(this.Gu(l,rj),l.cursor="move");e.add(l)}e.qb=a}return e};fj.prototype.makeHandle=function(){var a=this.Vt;return null===a?null:a.copy()};w.defineProperty(fj,{Vt:"handleArchetype"},function(){return this.bl},function(a){null!==a&&w.G(a,G,fj,"handleArchetype");this.bl=a});
fj.prototype.makeResegmentHandle=function(){var a=this.QI;return null===a?null:a.copy()};w.defineProperty(fj,{QI:"midHandleArchetype"},function(){return this.YC},function(a){null!==a&&w.G(a,G,fj,"midHandleArchetype");this.YC=a});w.u(fj,{handle:"handle"},function(){return this.ec});w.u(fj,{yt:"adornedLink"},function(){return this.Ay});fj.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;return null!==a&&!a.cb&&a.Mw&&a.R.left?null!==this.findToolHandleAt(a.zc.ca,this.name):!1};
fj.prototype.doActivate=function(){var a=this.g;if(null!==a&&(this.ec=this.findToolHandleAt(a.zc.ca,this.name),null!==this.ec)){var b=this.ec.U.Nf;if(b instanceof W){this.Ay=b;a.$e=!0;this.Tb(this.name);if(b.Au&&999===this.ec.jA){var c=b.points.copy(),d=this.ec.Wa(Fb);c.Ld(this.ec.Me+1,d);b.ic&&c.Ld(this.ec.Me+1,d);b.points=c;b.ce();this.ec=this.findToolHandleAt(a.zc.ca,this.name);if(null===this.ec){this.doDeactivate();return}}this.fp=b.m(this.ec.Me);this.fw=b.points.copy();this.sa=!0}}};
fj.prototype.doDeactivate=function(){this.Jk();this.Ay=this.ec=null;var a=this.g;null!==a&&(a.$e=!1);this.sa=!1};fj.prototype.doCancel=function(){var a=this.yt;null!==a&&(a.points=this.fw);this.stopTool()};fj.prototype.doMouseMove=function(){var a=this.g;this.sa&&null!==a&&(a=this.computeReshape(a.R.ca),this.reshape(a))};
fj.prototype.doMouseUp=function(){var a=this.g;if(this.sa&&null!==a){var b=this.computeReshape(a.R.ca);this.reshape(b);b=this.yt;if(null!==b&&b.Au){var c=this.handle.Me,d=b.m(c-1),e=b.m(c),f=b.m(c+1);if(b.ic){if(c>b.Ot+1&&c<b.Cx-1){var h=b.m(c-2);if(Math.abs(d.x-e.x)<this.Ch&&Math.abs(d.y-e.y)<this.Ch&&(tj(this,h,d,e,f,!0)||tj(this,h,d,e,f,!1))){var k=b.points.copy();tj(this,h,d,e,f,!0)?(k.fg(c-2,new z(h.x,(f.y+h.y)/2)),k.fg(c+1,new z(f.x,(f.y+h.y)/2))):(k.fg(c-2,new z((f.x+h.x)/2,h.y)),k.fg(c+1,
new z((f.x+h.x)/2,f.y)));k.Xc(c);k.Xc(c-1);b.points=k;b.ce()}else h=b.m(c+2),Math.abs(e.x-f.x)<this.Ch&&Math.abs(e.y-f.y)<this.Ch&&(tj(this,d,e,f,h,!0)||tj(this,d,e,f,h,!1))&&(k=b.points.copy(),tj(this,d,e,f,h,!0)?(k.fg(c-1,new z(d.x,(d.y+h.y)/2)),k.fg(c+2,new z(h.x,(d.y+h.y)/2))):(k.fg(c-1,new z((d.x+h.x)/2,d.y)),k.fg(c+2,new z((d.x+h.x)/2,h.y))),k.Xc(c+1),k.Xc(c),b.points=k,b.ce())}}else h=w.K(),Ia(d.x,d.y,f.x,f.y,e.x,e.y,h)&&h.uf(e)<this.Ch*this.Ch&&(k=b.points.copy(),k.Xc(c),b.points=k,b.ce()),
w.v(h)}a.qc();this.Ff=this.name;a.Ba("LinkReshaped",this.yt,this.fw)}this.stopTool()};function tj(a,b,c,d,e,f){return f?Math.abs(b.y-c.y)<a.Ch&&Math.abs(c.y-d.y)<a.Ch&&Math.abs(d.y-e.y)<a.Ch:Math.abs(b.x-c.x)<a.Ch&&Math.abs(c.x-d.x)<a.Ch&&Math.abs(d.x-e.x)<a.Ch}w.defineProperty(fj,{Ch:"resegmentingDistance"},function(){return this.sD},function(a){w.j(a,"number",fj,"resegmentingDistance");this.sD=a});
fj.prototype.reshape=function(a){var b=this.yt;b.fm();var c=this.handle.Me,d=this.QE(this.handle);if(b.ic)if(c===b.Ot+1)c=b.Ot+1,d===ij?(b.ea(c,b.m(c-1).x,a.y),b.ea(c+1,b.m(c+2).x,a.y)):d===hj&&(b.ea(c,a.x,b.m(c-1).y),b.ea(c+1,a.x,b.m(c+2).y));else if(c===b.Cx-1)c=b.Cx-1,d===ij?(b.ea(c-1,b.m(c-2).x,a.y),b.ea(c,b.m(c+1).x,a.y)):d===hj&&(b.ea(c-1,a.x,b.m(c-2).y),b.ea(c,a.x,b.m(c+1).y));else{var d=c,e=b.m(d),f=b.m(d-1),h=b.m(d+1);K(f.x,e.x)&&K(e.y,h.y)?(K(f.x,b.m(d-2).x)&&!K(f.y,b.m(d-2).y)?(b.w(d,a.x,
f.y),c++,d++):b.ea(d-1,a.x,f.y),K(h.y,b.m(d+2).y)&&!K(h.x,b.m(d+2).x)?b.w(d+1,h.x,a.y):b.ea(d+1,h.x,a.y)):K(f.y,e.y)&&K(e.x,h.x)?(K(f.y,b.m(d-2).y)&&!K(f.x,b.m(d-2).x)?(b.w(d,f.x,a.y),c++,d++):b.ea(d-1,f.x,a.y),K(h.x,b.m(d+2).x)&&!K(h.y,b.m(d+2).y)?b.w(d+1,a.x,h.y):b.ea(d+1,a.x,h.y)):K(f.x,e.x)&&K(e.x,h.x)?(K(f.x,b.m(d-2).x)&&!K(f.y,b.m(d-2).y)?(b.w(d,a.x,f.y),c++,d++):b.ea(d-1,a.x,f.y),K(h.x,b.m(d+2).x)&&!K(h.y,b.m(d+2).y)?b.w(d+1,a.x,h.y):b.ea(d+1,a.x,h.y)):K(f.y,e.y)&&K(e.y,h.y)&&(K(f.y,b.m(d-
2).y)&&!K(f.x,b.m(d-2).x)?(b.w(d,f.x,a.y),c++,d++):b.ea(d-1,f.x,a.y),K(h.y,b.m(d+2).y)&&!K(h.x,b.m(d+2).x)?b.w(d+1,h.x,a.y):b.ea(d+1,h.x,a.y));b.ea(c,a.x,a.y)}else b.ea(c,a.x,a.y),1===c&&b.computeSpot(!0).Nd()&&(e=b.W,f=b.ed,null===e||e.isVisible()||(e=e.findVisibleNode(),e!==b.W&&(f=e.Ol(""))),d=f.Wa(Fb,w.K()),e=b.getLinkPointFromPoint(e,f,d,a,!0,w.K()),b.ea(0,e.x,e.y),w.v(d),w.v(e)),c===b.qa-2&&b.computeSpot(!1).Nd()&&(c=b.$,e=b.Sd,null===c||c.isVisible()||(c=c.findVisibleNode(),c!==b.$&&(e=c.Ol(""))),
d=e.Wa(Fb,w.K()),e=b.getLinkPointFromPoint(c,e,d,a,!1,w.K()),b.ea(b.qa-1,e.x,e.y),w.v(d),w.v(e));b.ij()};fj.prototype.computeReshape=function(a){var b=this.yt,c=this.handle.Me;switch(this.QE(this.handle)){case rj:return a;case ij:return b=b.m(c),new z(b.x,a.y);case hj:return b=b.m(c),new z(a.x,b.y);default:case gj:return b.m(c)}};w.u(fj,{rL:"originalPoint"},function(){return this.fp});w.u(fj,{sL:"originalPoints"},function(){return this.fw});
function uj(){0<arguments.length&&w.hd(uj);ng.call(this);this.name="Resizing";this.Vh=(new ha(1,1)).freeze();this.Uh=(new ha(9999,9999)).freeze();this.Jj=(new ha(NaN,NaN)).freeze();this.Jr=!1;this.Dc=null;var a=new X;a.oh=Fb;a.Cb="Rectangle";a.Aa=yd;a.fill="lightblue";a.stroke="dodgerblue";a.kb=1;a.cursor="pointer";this.bl=a;this.ec=null;this.fp=new z;this.hD=new ha;this.mD=new z;this.Wy=new ha(0,0);this.Vy=new ha(Infinity,Infinity);this.Uy=new ha(1,1);this.eD=!0}w.La(uj,ng);w.fa("ResizingTool",uj);
uj.prototype.updateAdornments=function(a){if(!(null===a||a instanceof W)){if(a.eb&&null!==this.g&&!this.g.cb){var b=a.SF;if(null!==b&&a.canResize()&&a.Y.H()&&a.isVisible()&&b.Y.H()&&b.vj()){var c=a.Tp(this.name);if(null===c||c.qb!==b)c=this.makeAdornment(b);if(null!==c){var d=b.xn();c.angle=d;var e=b.Wa(c.zf,w.K()),f=b.nj();c.location=e;w.v(e);e=c.placeholder;if(null!==e){var b=b.Ia,h=w.im();h.l(b.width*f,b.height*f);e.Aa=h;w.zk(h)}this.updateResizeHandles(c,d);a.zl(this.name,c);return}}}a.Aj(this.name)}};
uj.prototype.makeAdornment=function(a){var b=null,b=a.U.RF;if(null===b){b=new dh;b.type=Gj;b.zf=Fb;var c=new Hj;c.Uf=!0;b.add(c);b.add(this.makeHandle(a,vb));b.add(this.makeHandle(a,Ab));b.add(this.makeHandle(a,Kb));b.add(this.makeHandle(a,Ib));b.add(this.makeHandle(a,Dc));b.add(this.makeHandle(a,Fc));b.add(this.makeHandle(a,Gc));b.add(this.makeHandle(a,Ec))}else if(fh(b),b=b.copy(),null===b)return null;b.qb=a;return b};
uj.prototype.makeHandle=function(a,b){var c=this.Vt;if(null===c)return null;c=c.copy();c.alignment=b;return c};
uj.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.Uc()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.Nd()&&(c=Fb);var d=b;if(0>=c.x)d=0>=c.y?d+225:1<=c.y?d+135:d+180;else if(1<=c.x)0>=c.y?d+=315:1<=c.y&&(d+=45);else if(0>=c.y)d+=270;else if(1<=c.y)d+=90;else break a;0>d?d+=360:360<=d&&(d-=360);a.cursor=22.5>d?"e-resize":67.5>d?"se-resize":112.5>d?"s-resize":157.5>d?"sw-resize":202.5>d?"w-resize":247.5>d?"nw-resize":292.5>d?"n-resize":337.5>d?
"ne-resize":"e-resize"}else if(a instanceof C)for(c=a.elements;c.next();)this.updateResizeHandles(c.value,b)};w.defineProperty(uj,{Vt:"handleArchetype"},function(){return this.bl},function(a){null!==a&&w.G(a,G,uj,"handleArchetype");this.bl=a});w.u(uj,{handle:"handle"},function(){return this.ec});w.defineProperty(uj,{qb:"adornedObject"},function(){return this.Dc},function(a){null!==a&&w.G(a,G,uj,"adornedObject");this.Dc=a});
uj.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;return null!==a&&!a.cb&&a.Bt&&a.R.left?null!==this.findToolHandleAt(a.zc.ca,this.name):!1};
uj.prototype.doActivate=function(){var a=this.g;null!==a&&(this.ec=this.findToolHandleAt(a.zc.ca,this.name),null!==this.ec&&(this.Dc=this.ec.U.qb,this.fp.set(this.qb.Wa(this.handle.alignment.CF())),this.mD.set(this.Dc.U.location),this.hD.set(this.Dc.Aa),this.Uy=this.computeCellSize(),this.Wy=this.computeMinSize(),this.Vy=this.computeMaxSize(),a.$e=!0,this.eD=a.Pa.isEnabled,a.Pa.isEnabled=!1,this.Tb(this.name),this.sa=!0))};
uj.prototype.doDeactivate=function(){var a=this.g;null!==a&&(this.Jk(),this.Dc=this.ec=null,this.sa=a.$e=!1,a.Pa.isEnabled=this.eD)};uj.prototype.doCancel=function(){null!==this.qb&&(this.qb.Aa=this.DF,this.qb.U.location=this.$I);this.stopTool()};uj.prototype.doMouseMove=function(){var a=this.g;if(this.sa&&null!==a){var b=this.Wy,c=this.Vy,d=this.Uy,e=this.qb.OE(a.R.ca,w.K()),f=this.computeReshape(),b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.Yf();w.v(e)}};
uj.prototype.doMouseUp=function(){var a=this.g;if(this.sa&&null!==a){var b=this.Wy,c=this.Vy,d=this.Uy,e=this.qb.OE(a.R.ca,w.K()),f=this.computeReshape(),b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);w.v(e);a.qc();this.Ff=this.name;a.Ba("PartResized",this.qb,this.DF)}this.stopTool()};
uj.prototype.resize=function(a){if(null!==this.g){var b=this.qb,c=b.U;b.Aa=a.size;c.Ze();a=this.qb.Wa(this.handle.alignment.CF());c instanceof U?(a=c.position.copy().Yn(a).add(this.fp),c.move(a)):c.location=c.location.copy().Yn(a).add(this.fp)}};
uj.prototype.computeResize=function(a,b,c,d,e,f){b.Nd()&&(b=Fb);var h=this.qb.Ia,k=h.x,l=h.y,m=h.x+h.width,n=h.y+h.height,p=1;if(!f){var p=h.width,q=h.height;0>=p&&(p=1);0>=q&&(q=1);p=q/p}q=w.K();Ka(a.x,a.y,k,l,e.width,e.height,q);a=h.copy();0>=b.x?0>=b.y?(a.x=Math.max(q.x,m-d.width),a.x=Math.min(a.x,m-c.width),a.width=Math.max(m-a.x,c.width),a.y=Math.max(q.y,n-d.height),a.y=Math.min(a.y,n-c.height),a.height=Math.max(n-a.y,c.height),f||(b=a.height/a.width,p<b?(a.height=p*a.width,a.y=n-a.height):(a.width=
a.height/p,a.x=m-a.width))):1<=b.y?(a.x=Math.max(q.x,m-d.width),a.x=Math.min(a.x,m-c.width),a.width=Math.max(m-a.x,c.width),a.height=Math.max(Math.min(q.y-l,d.height),c.height),f||(b=a.height/a.width,p<b?a.height=p*a.width:(a.width=a.height/p,a.x=m-a.width))):(a.x=Math.max(q.x,m-d.width),a.x=Math.min(a.x,m-c.width),a.width=m-a.x,f||(a.height=p*a.width,a.y=l+.5*(n-l-a.height))):1<=b.x?0>=b.y?(a.width=Math.max(Math.min(q.x-k,d.width),c.width),a.y=Math.max(q.y,n-d.height),a.y=Math.min(a.y,n-c.height),
a.height=Math.max(n-a.y,c.height),f||(b=a.height/a.width,p<b?(a.height=p*a.width,a.y=n-a.height):a.width=a.height/p)):1<=b.y?(a.width=Math.max(Math.min(q.x-k,d.width),c.width),a.height=Math.max(Math.min(q.y-l,d.height),c.height),f||(b=a.height/a.width,p<b?a.height=p*a.width:a.width=a.height/p)):(a.width=Math.max(Math.min(q.x-k,d.width),c.width),f||(a.height=p*a.width,a.y=l+.5*(n-l-a.height))):0>=b.y?(a.y=Math.max(q.y,n-d.height),a.y=Math.min(a.y,n-c.height),a.height=n-a.y,f||(a.width=a.height/p,a.x=
k+.5*(m-k-a.width))):1<=b.y&&(a.height=Math.max(Math.min(q.y-l,d.height),c.height),f||(a.width=a.height/p,a.x=k+.5*(m-k-a.width)));w.v(q);return a};uj.prototype.computeReshape=function(){var a=Ij;this.qb instanceof X&&(a=Jj(this.qb));return!(a===Kj||a===Lj||null!==this.g&&this.g.R.shift)};uj.prototype.computeMinSize=function(){var a=this.qb.zh.copy(),b=this.zh;!isNaN(b.width)&&b.width>a.width&&(a.width=b.width);!isNaN(b.height)&&b.height>a.height&&(a.height=b.height);return a};
uj.prototype.computeMaxSize=function(){var a=this.qb.Af.copy(),b=this.Af;!isNaN(b.width)&&b.width<a.width&&(a.width=b.width);!isNaN(b.height)&&b.height<a.height&&(a.height=b.height);return a};
uj.prototype.computeCellSize=function(){var a=new ha(NaN,NaN),b=this.qb.U;if(null!==b){var c=b.kJ;!isNaN(c.width)&&0<c.width&&(a.width=c.width);!isNaN(c.height)&&0<c.height&&(a.height=c.height)}c=this.Hp;isNaN(a.width)&&!isNaN(c.width)&&0<c.width&&(a.width=c.width);isNaN(a.height)&&!isNaN(c.height)&&0<c.height&&(a.height=c.height);b=this.g;(isNaN(a.width)||isNaN(a.height))&&b&&(c=b.ab.re,null!==c&&c.vx&&(c=c.WE,isNaN(a.width)&&!isNaN(c.width)&&0<c.width&&(a.width=c.width),isNaN(a.height)&&!isNaN(c.height)&&
0<c.height&&(a.height=c.height)),b=b.Bn,null!==b&&b.visible&&this.vx&&(c=b.px,isNaN(a.width)&&!isNaN(c.width)&&0<c.width&&(a.width=c.width),isNaN(a.height)&&!isNaN(c.height)&&0<c.height&&(a.height=c.height)));if(isNaN(a.width)||0===a.width||Infinity===a.width)a.width=1;if(isNaN(a.height)||0===a.height||Infinity===a.height)a.height=1;return a};
w.defineProperty(uj,{zh:"minSize"},function(){return this.Vh},function(a){w.G(a,ha,uj,"minSize");if(!this.Vh.L(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.Vh.l(b,a)}});w.defineProperty(uj,{Af:"maxSize"},function(){return this.Uh},function(a){w.G(a,ha,uj,"maxSize");if(!this.Uh.L(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity);this.Uh.l(b,a)}});
w.defineProperty(uj,{Hp:"cellSize"},function(){return this.Jj},function(a){w.G(a,ha,uj,"cellSize");this.Jj.L(a)||this.Jj.assign(a)});w.defineProperty(uj,{vx:"isGridSnapEnabled"},function(){return this.Jr},function(a){w.j(a,"boolean",uj,"isGridSnapEnabled");this.Jr=a});w.u(uj,{DF:"originalDesiredSize"},function(){return this.hD});w.u(uj,{$I:"originalLocation"},function(){return this.mD});
function Mj(){0<arguments.length&&w.hd(Mj);ng.call(this);this.name="Rotating";this.xD=45;this.wD=2;this.Dc=null;var a=new X;a.Cb="Ellipse";a.Aa=zd;a.fill="lightblue";a.stroke="dodgerblue";a.kb=1;a.cursor="pointer";this.bl=a;this.ec=null;this.ew=0;this.tD=new z}w.La(Mj,ng);w.fa("RotatingTool",Mj);
Mj.prototype.updateAdornments=function(a){if(!(null===a||a instanceof W)){if(a.eb&&null!==this.g&&!this.g.cb){var b=a.VF;if(null!==b&&a.canRotate()&&a.Y.H()&&a.isVisible()&&b.Y.H()&&b.vj()){var c=a.Tp(this.name);if(null===c||c.qb!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.xn();var d=null,e=null;b===a||b===a.Xf?(d=a.Xf,e=a.zf):(d=b,e=Fb);for(var f=d.Ia,e=w.xb(f.width*e.x+e.offsetX,f.height*e.y+e.offsetY);null!==d&&d!==b;)d.transform.nb(e),d=d.O;var d=e.y,f=Math.max(e.x-b.Ia.width,0),h=w.K();
c.location=b.Wa(new L(1,0,50+f,d),h);w.v(h);w.v(e);a.zl(this.name,c);return}}}a.Aj(this.name)}};Mj.prototype.makeAdornment=function(a){var b=null,b=a.U.nJ;if(null===b){b=new dh;b.type=Nj;b.zf=Fb;var c=this.Vt;null!==c&&b.add(c.copy())}else if(fh(b),b=b.copy(),null===b)return null;b.qb=a;return b};w.defineProperty(Mj,{Vt:"handleArchetype"},function(){return this.bl},function(a){null!==a&&w.G(a,G,Mj,"handleArchetype");this.bl=a});w.u(Mj,{handle:"handle"},function(){return this.ec});
w.defineProperty(Mj,{qb:"adornedObject"},function(){return this.Dc},function(a){null!==a&&w.G(a,G,Mj,"adornedObject");this.Dc=a});Mj.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;return null!==a&&!a.cb&&a.Nw&&a.R.left?null!==this.findToolHandleAt(a.zc.ca,this.name):!1};
Mj.prototype.doActivate=function(){var a=this.g;if(null!==a&&(this.ec=this.findToolHandleAt(a.zc.ca,this.name),null!==this.ec)){this.Dc=this.ec.U.qb;var b=this.Dc.U,c=b.Xf;this.tD=this.Dc===b||this.Dc===c?c.Wa(b.zf):this.Dc.Wa(Fb);this.ew=this.Dc.angle;a.$e=!0;a.$z=!0;this.Tb(this.name);this.sa=!0}};Mj.prototype.doDeactivate=function(){var a=this.g;null!==a&&(this.Jk(),this.Dc=this.ec=null,this.sa=a.$e=!1)};Mj.prototype.doCancel=function(){var a=this.g;null!==a&&(a.$z=!1);this.rotate(this.ew);this.stopTool()};
Mj.prototype.doMouseMove=function(){var a=this.g;this.sa&&null!==a&&(a=this.computeRotate(a.R.ca),this.rotate(a))};Mj.prototype.doMouseUp=function(){var a=this.g;if(this.sa&&null!==a){a.$z=!1;var b=this.computeRotate(a.R.ca);this.rotate(b);a.qc();this.Ff=this.name;a.Ba("PartRotated",this.Dc,this.ew)}this.stopTool()};Mj.prototype.rotate=function(a){null!==this.Dc&&(this.Dc.angle=a)};
Mj.prototype.computeRotate=function(a){a=this.tD.yc(a);var b=this.Dc.O;null!==b&&(a-=b.xn(),360<=a?a-=360:0>a&&(a+=360));var b=Math.min(Math.abs(this.AJ),180),c=Math.min(Math.abs(this.zJ),b/2);(null===this.g||!this.g.R.shift)&&0<b&&0<c&&(a%b<c?a=Math.floor(a/b)*b:a%b>b-c&&(a=(Math.floor(a/b)+1)*b));360<=a?a-=360:0>a&&(a+=360);return a};w.defineProperty(Mj,{AJ:"snapAngleMultiple"},function(){return this.xD},function(a){w.j(a,"number",Mj,"snapAngleMultiple");this.xD=a});
w.defineProperty(Mj,{zJ:"snapAngleEpsilon"},function(){return this.wD},function(a){w.j(a,"number",Mj,"snapAngleEpsilon");this.wD=a});w.u(Mj,{qL:"originalAngle"},function(){return this.ew});function Oj(){ng.call(this);0<arguments.length&&w.hd(Oj);this.name="ClickSelecting"}w.La(Oj,ng);w.fa("ClickSelectingTool",Oj);Oj.prototype.canStart=function(){return!this.isEnabled||null===this.g||this.isBeyondDragSize()?!1:!0};
Oj.prototype.doMouseUp=function(){this.sa&&(this.standardMouseSelect(),!this.standardMouseClick()&&null!==this.g&&this.g.R.tj&&this.g.ab.doToolTip());this.stopTool()};function Pj(){ng.call(this);0<arguments.length&&w.hd(Pj);this.name="Action";this.ho=null}w.La(Pj,ng);w.fa("ActionTool",Pj);
Pj.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;if(null===a)return!1;var b=a.R,c=a.Je(b.ca,function(a){for(;null!==a.O&&!a.sx;)a=a.O;return a});if(null!==c){if(!c.sx)return!1;this.ho=c;a.uo=a.Je(b.ca,null,null);return!0}return!1};Pj.prototype.doMouseDown=function(){if(this.sa){var a=this.g.R,b=this.ho;null!==b&&(a.Pe=b,null!==b.ZD&&b.ZD(a,b))}else this.canStart()&&this.doActivate()};
Pj.prototype.doMouseMove=function(){if(this.sa){var a=this.g.R,b=this.ho;null!==b&&(a.Pe=b,null!==b.$D&&b.$D(a,b))}};Pj.prototype.doMouseUp=function(){if(this.sa){var a=this.g,b=a.R,c=this.ho;if(null===c)return;b.Pe=c;null!==c.aE&&c.aE(b,c);this.isBeyondDragSize()||Fh(c,b,a)}this.stopTool()};Pj.prototype.doCancel=function(){var a=this.g;if(null!==a){var a=a.R,b=this.ho;if(null===b)return;a.Pe=b;null!==b.YD&&b.YD(a,b)}this.stopTool()};Pj.prototype.doStop=function(){this.ho=null};
function Qj(){ng.call(this);0<arguments.length&&w.hd(Qj);this.name="ClickCreating";this.pm=null;this.LC=!0;this.zC=new z(0,0)}w.La(Qj,ng);w.fa("ClickCreatingTool",Qj);
Qj.prototype.canStart=function(){if(!this.isEnabled||null===this.Oz)return!1;var a=this.g;if(null===a||a.cb||a.xf||!a.Ep||!a.R.left||this.isBeyondDragSize())return!1;if(this.oI){if(1===a.R.Fe&&(this.zC=a.R.bf.copy()),2!==a.R.Fe||this.isBeyondDragSize(this.zC))return!1}else if(1!==a.R.Fe)return!1;return a.Za!==this&&null!==a.Nt(a.R.ca,!0)?!1:!0};Qj.prototype.doMouseUp=function(){var a=this.g;this.sa&&null!==a&&this.insertPart(a.R.ca);this.stopTool()};
Qj.prototype.insertPart=function(a){var b=this.g;if(null===b)return null;var c=this.Oz;if(null===c)return null;this.Tb(this.name);var d=null;c instanceof S?c.de()&&(fh(c),d=c.copy(),null!==d&&b.add(d)):null!==c&&(c=b.ba.copyNodeData(c),w.Qa(c)&&(b.ba.Al(c),d=b.vh(c)));null!==d&&(d.location=a,b.tf&&b.select(d));b.qc();this.Ff=this.name;b.Ba("PartCreated",d);this.Jk();return d};
w.defineProperty(Qj,{Oz:"archetypeNodeData"},function(){return this.pm},function(a){null!==a&&w.G(a,Object,Qj,"archetypeNodeData");this.pm=a});w.defineProperty(Qj,{oI:"isDoubleClick"},function(){return this.LC},function(a){w.j(a,"boolean",Qj,"isDoubleClick");this.LC=a});function Rj(){this.TD=this.WC=this.cz=this.yz=null}w.fa("HTMLInfo",Rj);w.defineProperty(Rj,{BA:"mainElement"},function(){return this.WC},function(a){null!==a&&w.G(a,HTMLElement,Rj,"mainElement");this.WC=a});
w.defineProperty(Rj,{show:"show"},function(){return this.yz},function(a){this.yz!==a&&(null!==a&&w.j(a,"function",Rj,"show"),this.yz=a)});w.defineProperty(Rj,{Cn:"hide"},function(){return this.cz},function(a){this.cz!==a&&(null!==a&&w.j(a,"function",Rj,"hide"),this.cz=a)});w.defineProperty(Rj,{vB:"valueFunction"},function(){return this.TD},function(a){this.TD=a});function Sj(a,b,c){this.text=a;this.nE=b;this.visible=c}
function Tj(){ng.call(this);0<arguments.length&&w.hd(Tj);this.name="ContextMenu";this.dC=this.Hy=this.aC=null;this.bD=new z;this.Jy=this.vm=null;var a=this;this.Fz=function(){a.stopTool()};Uj(this)}w.La(Tj,ng);w.fa("ContextMenuTool",Tj);
function Uj(a){var b=new Rj;b.show=function(a,b,c){c.showDefaultContextMenu()};b.Cn=function(a,b){b.hideDefaultContextMenu()};a.vm=b;a.Fz=function(){a.stopTool()};if(!1===w.uE){var b=w.createElement("div"),c=w.createElement("div");b.style.cssText="top: 0px;z-index:300;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px";c.style.cssText="z-index:299;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";
var d=w.createElement("style");window.document.getElementsByTagName("head")[0].appendChild(d);d.sheet.insertRule(".goCXul { list-style: none; }",0);d.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }",0);d.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }",0);b.addEventListener("contextmenu",Vj,!1);b.addEventListener("selectstart",Vj,!1);
c.addEventListener("contextmenu",Vj,!1);window.document.body&&(window.document.body.appendChild(b),window.document.body.appendChild(c));w.Et=b;w.Dt=c;w.uE=!0}}function Vj(a){a.preventDefault();return!1}Tj.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;return null===a||this.isBeyondDragSize()||!a.R.right?!1:null!==this.vm&&a.R.tj||null!==this.findObjectWithContextMenu()?!0:!1};Tj.prototype.doStart=function(){var a=this.g;null!==a&&this.bD.set(a.zc.ca)};
Tj.prototype.doStop=function(){this.hideContextMenu();this.Ww=null};Tj.prototype.findObjectWithContextMenu=function(a){void 0===a&&(a=null);var b=this.g;if(null===b)return null;var c=b.R,d=null;a instanceof D||(d=a instanceof G?a:b.Je(c.ca,null,function(a){return!a.layer.Jc}));if(null!==d){for(a=d;null!==a;){if(null!==a.contextMenu)return a;a=a.O}if(null!==this.vm&&b.R.tj)return d.U}else if(null!==b.contextMenu)return b;return null};Tj.prototype.doActivate=function(){};
Tj.prototype.doMouseDown=function(){ng.prototype.doMouseDown.call(this);null!==this.g&&this.g.ab.af.contains(this)&&Wj(this)};Tj.prototype.doMouseUp=function(){Wj(this)};function Wj(a){var b=a.g;if(null!==b)if(a.sa){var c=a.Il;if(null!==c){if(!(c instanceof Rj)){var d=b.Je(b.R.ca,null,null);null!==d&&d.Xl(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.Za=a,a.doMouseUp())}}else a.canStart()&&(Dh(a,!0),a.sa||a.stopTool())}
function Dh(a,b,c){void 0===c&&(c=null);b&&a.standardMouseSelect();if(!a.standardMouseClick())if(a.sa=!0,b=a.vm,null===c&&(c=a.findObjectWithContextMenu()),null!==c){var d=c.contextMenu;null!==d?(a.Ww=c instanceof G?c:null,a.showContextMenu(d,a.Ww)):null!==b&&a.showContextMenu(b,a.Ww)}else null!==b&&a.showContextMenu(b,null)}Tj.prototype.doMouseMove=function(){this.sa&&null!==this.g&&this.g.ab.doMouseMove()};
Tj.prototype.showContextMenu=function(a,b){null!==b&&w.G(b,G,Tj,"showContextMenu:obj");var c=this.g;if(null!==c){a!==this.Il&&this.hideContextMenu();if(a instanceof dh){a.Wf="Tool";a.dm=!1;a.scale=1/c.scale;a.rd=this.name;null!==a.placeholder&&(a.placeholder.scale=c.scale);c.add(a);if(null!==b){var c=null,d=b.Pl();null!==d&&(c=d.data);a.qb=b;a.data=c}else a.data=c.ba;a.Ze();this.positionContextMenu(a,b)}else a instanceof Rj&&a.show(b,c,this);this.Il=a}};
Tj.prototype.positionContextMenu=function(a){if(null===a.placeholder){var b=this.g;if(null!==b){var c=b.R.ca.copy(),d=a.za,e=b.sb;b.R.tj&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5);c.x<e.x&&(c.x=e.x);c.y+d.height>e.bottom&&(c.y-=d.height+5);c.y<e.y&&(c.y=e.y);a.position=c}}};
Tj.prototype.hideContextMenu=function(){var a=this.g;if(null!==a){var b=this.Il;null!==b&&(b instanceof dh?(a.remove(b),null!==this.Hy&&this.Hy.Aj(b.rd),b.data=null,b.qb=null):b instanceof Rj&&(null!==b.Cn?b.Cn(a,this):null!==b.BA&&(b.BA.style.display="none")),this.Il=null,this.standardMouseOver())}};
function Xj(a){if(null===a.g)return null;a=new I(Sj);a.add(new Sj("Copy",function(a){a.ob.copySelection()},function(a){return a.ob.canCopySelection()}));a.add(new Sj("Cut",function(a){a.ob.cutSelection()},function(a){return a.ob.canCutSelection()}));a.add(new Sj("Delete",function(a){a.ob.deleteSelection()},function(a){return a.ob.canDeleteSelection()}));a.add(new Sj("Paste",function(a){a.ob.pasteSelection(a.R.ca)},function(a){return a.ob.canPasteSelection()}));a.add(new Sj("Select All",function(a){a.ob.selectAll()},
function(a){return a.ob.canSelectAll()}));a.add(new Sj("Undo",function(a){a.ob.undo()},function(a){return a.ob.canUndo()}));a.add(new Sj("Redo",function(a){a.ob.redo()},function(a){return a.ob.canRedo()}));a.add(new Sj("Scroll To Part",function(a){a.ob.scrollToPart()},function(a){return a.ob.canScrollToPart()}));a.add(new Sj("Zoom To Fit",function(a){a.ob.zoomToFit()},function(a){return a.ob.canZoomToFit()}));a.add(new Sj("Reset Zoom",function(a){a.ob.resetZoom()},function(a){return a.ob.canResetZoom()}));
a.add(new Sj("Group Selection",function(a){a.ob.groupSelection()},function(a){return a.ob.canGroupSelection()}));a.add(new Sj("Ungroup Selection",function(a){a.ob.ungroupSelection()},function(a){return a.ob.canUngroupSelection()}));a.add(new Sj("Edit Text",function(a){a.ob.editTextBlock()},function(a){return a.ob.canEditTextBlock()}));return a}
Tj.prototype.showDefaultContextMenu=function(){var a=this.g;if(null!==a){null===this.Jy&&(this.Jy=Xj(this));w.Et.innerHTML="";w.Dt.addEventListener("click",this.Fz,!1);var b=this,c=w.createElement("ul");c.className="goCXul";w.Et.appendChild(c);c.innerHTML="";for(var d=this.Jy.i;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.nE&&("function"!==typeof f||f(a))){f=w.createElement("li");f.className="goCXli";var h=w.createElement("a");h.className="goCXa";h.href="#";h.CG=e.nE;h.addEventListener("click",
function(c){this.CG(a);b.stopTool();c.preventDefault();return!1},!1);h.textContent=e.text;f.appendChild(h);c.appendChild(f)}}w.Et.style.display="block";w.Dt.style.display="block"}};Tj.prototype.hideDefaultContextMenu=function(){null!==this.Il&&this.Il===this.vm&&(w.Et.style.display="none",w.Dt.style.display="none",w.Dt.removeEventListener("click",this.Fz,!1),this.Il=null)};w.defineProperty(Tj,{Il:"currentContextMenu"},function(){return this.aC},function(a){this.aC=a;this.Hy=a instanceof dh?a.Nf:null});
w.defineProperty(Tj,{LK:"defaultTouchContextMenu"},function(){return this.vm},function(a){this.vm=a});w.defineProperty(Tj,{Ww:"currentObject"},function(){return this.dC},function(a){null!==a&&w.G(a,G,Tj,"currentObject");this.dC=a});w.u(Tj,{lL:"mouseDownPoint"},function(){return this.bD});
function Yj(){ng.call(this);0<arguments.length&&w.hd(Yj);this.name="DragSelecting";this.Ao=175;this.QC=!1;var a=new S;a.Wf="Tool";a.dm=!1;var b=new X;b.name="SHAPE";b.Cb="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.rm=a}w.La(Yj,ng);w.fa("DragSelectingTool",Yj);
Yj.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;if(null===a||!a.tf)return!1;var b=a.R;return!b.left||a.Za!==this&&(!this.isBeyondDragSize()||b.timestamp-a.zc.timestamp<this.vE||null!==a.Nt(b.ca,!0))?!1:!0};Yj.prototype.doActivate=function(){var a=this.g;null!==a&&(this.sa=!0,a.$e=!0,a.wb=!0,a.add(this.rh),this.doMouseMove())};Yj.prototype.doDeactivate=function(){var a=this.g;null!==a&&(Ph(a),a.remove(this.rh),a.wb=!1,this.sa=a.$e=!1)};
Yj.prototype.doMouseMove=function(){var a=this.g;if(null!==a&&this.sa&&null!==this.rh){var b=this.computeBoxBounds(),c=this.rh.sd("SHAPE");null===c&&(c=this.rh.Hd());c.Aa=b.size;this.rh.position=b.position;(a.me||a.ne)&&a.bA(a.R.bf)}};Yj.prototype.doMouseUp=function(){if(this.sa){var a=this.g;a.remove(this.rh);try{a.bc="wait",this.selectInRect(this.computeBoxBounds())}finally{a.bc=""}}this.stopTool()};
Yj.prototype.computeBoxBounds=function(){var a=this.g;return null===a?new A(0,0,0,0):new A(a.zc.ca,a.R.ca)};
Yj.prototype.selectInRect=function(a){var b=this.g;if(null!==b){var c=b.R;b.Ba("ChangingSelection");a=b.yk(a,null,function(a){return a instanceof S?a.canSelect():!1},this.uI);if(w.Ek?c.mu:c.control)if(c.shift)for(a=a.i;a.next();)c=a.value,c.eb&&(c.eb=!1);else for(a=a.i;a.next();)c=a.value,c.eb=!c.eb;else{if(!c.shift){for(var c=new I(S),d=b.selection.i;d.next();){var e=d.value;a.contains(e)||c.add(e)}for(c=c.i;c.next();)c.value.eb=!1}for(a=a.i;a.next();)c=a.value,c.eb||(c.eb=!0)}b.Ba("ChangedSelection")}};
w.defineProperty(Yj,{vE:"delay"},function(){return this.Ao},function(a){w.j(a,"number",Yj,"delay");this.Ao=a});w.defineProperty(Yj,{uI:"isPartialInclusion"},function(){return this.QC},function(a){w.j(a,"boolean",Yj,"isPartialInclusion");this.QC=a});w.defineProperty(Yj,{rh:"box"},function(){return this.rm},function(a){null!==a&&w.G(a,S,Yj,"box");this.rm=a});
function Zj(){ng.call(this);0<arguments.length&&w.hd(Zj);this.name="Panning";this.pz=new z;this.Ij=!1;var a=this;this.BD=function(){window.document.removeEventListener("scroll",a.BD,!1);a.stopTool()}}w.La(Zj,ng);w.fa("PanningTool",Zj);Zj.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;return null===a||!a.me&&!a.ne||!a.R.left||a.Za!==this&&!this.isBeyondDragSize()?!1:!0};
Zj.prototype.doActivate=function(){var a=this.g;null!==a&&(this.Ij?(a.R.bubbles=!0,window.document.addEventListener("scroll",this.BD,!1)):(a.bc="move",a.$e=!0,this.pz=a.position.copy()),this.sa=!0)};Zj.prototype.doDeactivate=function(){var a=this.g;null!==a&&(a.bc="",this.sa=a.$e=!1)};Zj.prototype.doCancel=function(){var a=this.g;null!==a&&(a.position=this.pz,a.$e=!1);this.stopTool()};Zj.prototype.doMouseMove=function(){this.move()};Zj.prototype.doMouseUp=function(){this.move();this.stopTool()};
Zj.prototype.move=function(){var a=this.g;if(this.sa&&a)if(this.Ij)a.R.bubbles=!0;else{var b=a.position,c=a.zc.ca,d=a.R.ca,e=b.x+c.x-d.x,c=b.y+c.y-d.y;a.me||(e=b.x);a.ne||(c=b.y);a.position=new z(e,c)}};w.defineProperty(Zj,{bubbles:"bubbles"},function(){return this.Ij},function(a){w.j(a,"boolean",Zj,"bubbles");this.Ij=a});w.u(Zj,{tL:"originalPosition"},function(){return this.pz});
function ak(){0<arguments.length&&w.hd(ak);ng.call(this);this.name="TextEditing";this.Dz=this.kk=null;this.AD=bk;this.vl=null;this.Ta=ck;this.ql=null;this.ZC=1;this.uD=!0;var a=new Rj;this.fC=null;this.nC=a;this.Ky=null;dk(this,a)}w.fa("TextEditingTool",ak);w.La(ak,ng);var ek;ak.LostFocus=ek=w.p(ak,"LostFocus",0);var fk;ak.MouseDown=fk=w.p(ak,"MouseDown",1);var gk;ak.Tab=gk=w.p(ak,"Tab",2);var hk;ak.Enter=hk=w.p(ak,"Enter",3);ak.SingleClick=w.p(ak,"SingleClick",0);var bk;
ak.SingleClickSelected=bk=w.p(ak,"SingleClickSelected",1);var ik;ak.DoubleClick=ik=w.p(ak,"DoubleClick",2);var ck;ak.StateNone=ck=w.p(ak,"StateNone",0);var jk;ak.StateActive=jk=w.p(ak,"StateActive",1);var kk;ak.StateEditing=kk=w.p(ak,"StateEditing",2);var lk;ak.StateValidating=lk=w.p(ak,"StateValidating",3);var mk;ak.StateInvalid=mk=w.p(ak,"StateInvalid",4);var nk;ak.StateValidated=nk=w.p(ak,"StateValidated",5);
function dk(a,b){var c=w.createElement("textarea");a.Ky=c;c.addEventListener("input",function(){if(null!==a.Xg){var b=a.MI(this.value),c=this.GJ;this.style.width=20+b.za.width*c+"px";this.style.height=10+b.za.height*c+"px";this.rows=b.BI}},!1);c.addEventListener("keydown",function(b){if(null!==a.Xg){var c=b.which;13===c?(!1===a.Xg.yx&&b.preventDefault(),a.acceptText(hk)):9===c?(a.acceptText(gk),b.preventDefault()):27===c&&(a.doCancel(),null!==a.g&&a.g.doFocus())}},!1);c.addEventListener("focus",function(){ok(a)},
!1);c.addEventListener("blur",function(){pk(a)},!1);b.vB=function(){return c.value};b.BA=c;b.show=function(a,b,f){if(f.state===mk)c.style.border="3px solid red",c.focus();else{var h=a.Wa(Fb),k=b.position,l=b.scale,m=a.nj()*l;m<f.xF&&(m=f.xF);var n=a.Ia.width*m+6,p=a.Ia.height*m+2,q=(h.x-k.x)*l,h=(h.y-k.y)*l;c.value=a.text;b.lj.style.font=a.font;c.style.cssText="position: absolute;z-index: 100;font: inherit;fontSize: "+100*m+"%;lineHeight: normal;width: "+n+"px;height: "+p+"px;left: "+((q-n/2|0)-1)+
"px;top: "+((h-p/2|0)-1)+"px;textAlign: "+a.textAlign+";margin: 0;padding: 1px;border: 0;outline: none;white-space: pre-wrap;overflow: hidden;";c.GJ=m;b.lj.appendChild(c);c.focus();f.ay&&(c.select(),c.setSelectionRange(0,9999))}};b.Cn=function(a){a.lj.removeChild(c)}}w.defineProperty(ak,{Xg:"textBlock"},function(){return this.Dz},function(a){null!==a&&w.G(a,Ch,ak,"textBlock");this.Dz=a});w.defineProperty(ak,{jj:"currentTextEditor"},function(){return this.fC},function(a){this.fC=a});
w.defineProperty(ak,{DH:"defaultTextEditor"},function(){return this.nC},function(a){this.nC=a});w.defineProperty(ak,{iG:"starting"},function(){return this.AD},function(a){w.mb(a,ak,ak,"starting");this.AD=a});
ak.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;if(null===a||a.cb||!a.R.left||this.isBeyondDragSize())return!1;var b=a.Je(a.R.ca,null,function(a){return a instanceof Ch});if(null===b||!b.cA||!b.U.canEdit())return!1;b=b.U;return null===b||this.iG===bk&&!b.eb||this.iG===ik&&2>a.R.Fe?!1:!0};ak.prototype.doStart=function(){this.sa||null===this.Xg||this.doActivate()};
ak.prototype.doActivate=function(){if(!this.sa){var a=this.g;if(null!==a){var b=this.Xg;null===b&&(b=a.Je(a.R.ca,function(a){return a instanceof Ch?a:null}));if(null!==b&&(this.Xg=b,null!==b.U)){this.sa=!0;this.Ta=jk;var c=this.DH;null!==b.lG&&(c=b.lG);this.kk=this.Xg.copy();var d=new A(this.Xg.Wa(vb),this.Xg.Wa(Kb));a.sJ(d);if(c instanceof Rj)c.show(b,a,this);else{c.style.position="absolute";c.style.zIndex="100";c.textEditingTool=this;if("function"===typeof c.onActivate)c.onActivate();"function"===
typeof c.focus&&c.focus();"function"===typeof c.select&&this.ay&&(c.select(),c.setSelectionRange(0,9999));a.lj.appendChild(c)}this.jj=c}}}};ak.prototype.doCancel=function(){null!==this.ql&&this.jj instanceof HTMLElement&&(this.jj.style.border=this.ql,this.ql=null);this.stopTool()};ak.prototype.doMouseUp=function(){!this.sa&&this.canStart()&&this.doActivate()};ak.prototype.doMouseDown=function(){this.sa&&this.acceptText(fk)};
ak.prototype.acceptText=function(a){switch(a){case fk:if(this.Ta===nk)this.jj instanceof HTMLElement&&this.jj.focus();else if(this.Ta===jk||this.Ta===mk||this.Ta===kk)this.Ta=lk,qk(this);break;case ek:case hk:case gk:if(hk===a&&!0===this.Dz.yx)break;if(this.Ta===jk||this.Ta===mk||this.Ta===kk)this.Ta=lk,qk(this)}};
function qk(a){var b=a.Xg,c=a.g,d=a.jj;if(null!==b&&null!==d){var e=b.text,f="";d instanceof Rj?null!==d.vB&&(f=d.vB()):(f=d.value,f="function"===typeof f?f():f);a.isValidText(b,e,f)?(a.Tb(a.name),a.Ta=nk,d instanceof Rj?d.show(b,c,a):null!==a.ql&&(d.style.border=a.ql,a.ql=null),a.Ff=a.name,b.text=f,null!==b.kG&&b.kG(b,e,f),null!==c&&c.Ba("TextEdited",b,e),a.Jk(),a.stopTool(),null!==c&&c.doFocus()):(a.Ta=mk,null!==b.eA&&b.eA(a,e,f),d instanceof Rj?d.show(b,c,a):(null===a.ql&&(a.ql=d.style.border,
d.style.border="3px solid red"),"function"===typeof d.focus&&d.focus()))}}ak.prototype.doDeactivate=function(){var a=this.g;if(null!==a){this.Ta=ck;this.Xg=null;if(null!==this.jj){var b=this.jj;if(b instanceof Rj)b.Cn(a,this);else{if("function"===typeof b.onDeactivate)b.onDeactivate();null!==b&&a.lj.removeChild(b)}}this.sa=!1}};ak.prototype.doFocus=function(){ok(this)};ak.prototype.doBlur=function(){pk(this)};
function ok(a){if(null!==a.jj){var b=a.Ky;a.Ta===jk&&(a.Ta=kk);"function"===typeof b.select&&a.ay&&(b.select(),b.setSelectionRange(0,9999))}}function pk(a){if(null!==a.jj){var b=a.Ky;"function"===typeof b.focus&&b.focus();"function"===typeof b.select&&a.ay&&(b.select(),b.setSelectionRange(0,9999))}}ak.prototype.isValidText=function(a,b,c){w.G(a,Ch,ak,"isValidText:textblock");var d=this.lB;if(null!==d&&!d(a,b,c))return!1;d=a.lB;return null===d||d(a,b,c)?!0:!1};
w.defineProperty(ak,{lB:"textValidation"},function(){return this.vl},function(a){null!==a&&w.j(a,"function",ak,"textValidation");this.vl=a});w.defineProperty(ak,{xF:"minimumEditorScale"},function(){return this.ZC},function(a){null!==a&&w.j(a,"number",ak,"minimumEditorScale");this.ZC=a});w.defineProperty(ak,{ay:"selectsTextOnActivate"},function(){return this.uD},function(a){null!==a&&w.j(a,"boolean",ak,"selectsTextOnActivate");this.uD=a});
w.defineProperty(ak,{state:"state"},function(){return this.Ta},function(a){this.Ta!==a&&(w.mb(a,ak,ak,"starting"),this.Ta=a)});ak.prototype.measureTemporaryTextBlock=ak.prototype.MI=function(a){var b=this.kk;b.text=a;rk(b,this.Xg.Wo,Infinity);return b};function bh(){ng.call(this);this.name="ToolManager";this.HG=new I(ng);this.IG=new I(ng);this.JG=new I(ng);this.DC=this.EC=850;this.sC=(new ha(2,2)).Ga();this.OD=5E3;this.cD=Hh;this.BC=sk;this.ov=this.gC=null;this.en=-1}w.La(bh,ng);
w.fa("ToolManager",bh);var Hh;bh.WheelScroll=Hh=w.p(bh,"WheelScroll",0);var Gh;bh.WheelZoom=Gh=w.p(bh,"WheelZoom",1);bh.WheelNone=w.p(bh,"WheelNone",2);var sk;bh.GestureZoom=sk=w.p(bh,"GestureZoom",3);var tk;bh.GestureCancel=tk=w.p(bh,"GestureCancel",4);var uk;bh.GestureNone=uk=w.p(bh,"GestureNone",5);w.defineProperty(bh,{pu:"mouseWheelBehavior"},function(){return this.cD},function(a){w.mb(a,bh,bh,"mouseWheelBehavior");this.cD=a});
w.defineProperty(bh,{Xp:"gestureBehavior"},function(){return this.BC},function(a){w.mb(a,bh,bh,"gestureBehavior");this.BC=a});bh.prototype.initializeStandardTools=function(){this.UG=new Pj;this.JF=new Lh;this.EI=new fj;this.UF=new uj;this.pJ=new Mj;this.tF=new Xi;this.re=new hh;this.IH=new Yj;this.aJ=new Zj;this.Vz=new Tj;this.kB=new ak;this.kH=new Qj;this.lH=new Oj};
bh.prototype.updateAdornments=function(a){var b=this.Jl;if(b instanceof dh&&this.ov===a){var c=b.qb;(null!==a?c.U===a:null===c)?this.showToolTip(b,c):this.hideToolTip()}};
bh.prototype.doMouseDown=function(){var a=this.g;if(null!==a){var b=a.R;b.tj&&this.Xp===tk&&(b.bubbles=!1);if(b.du){this.cancelWaitAfter();if(this.Xp===uk){b.bubbles=!0;return}if(this.Xp===tk)return;if(a.Za.canStartMultiTouch()){a.Za.standardPinchZoomStart();return}}var c=a.oa;c.Rz&&0!==c.Fh&&w.trace("WARNING: In ToolManager.doMouseDown: UndoManager.transactionLevel is not zero");for(var c=this.af.length,d=0;d<c;d++){var e=this.af.da(d);null===e.g&&e.Pc(this.g);if(e.canStart()){a.doFocus();a.Za=e;
a.Za===e&&(e.sa||e.doActivate(),e.doMouseDown());return}}1===a.R.button&&(this.pu===Hh?this.pu=Gh:this.pu===Gh&&(this.pu=Hh));this.doActivate();this.standardWaitAfter(this.ZE,b)}};
bh.prototype.doMouseMove=function(){var a=this.g;if(null!==a){var b=a.R;if(b.du){if(this.Xp===uk){b.bubbles=!0;return}if(this.Xp===tk)return;if(a.Za.canStartMultiTouch()){a.Za.standardPinchZoomMove();return}}if(this.sa)for(var c=this.Zf.length,d=0;d<c;d++){var e=this.Zf.da(d);null===e.g&&e.Pc(this.g);if(e.canStart()){a.doFocus();a.Za=e;a.Za===e&&(e.sa||e.doActivate(),e.doMouseMove());return}}vk(this,a);null===b.event||"mousemove"!==b.event.type&&b.event.cancelable||(b.bubbles=!0)}};
function vk(a,b){a.standardMouseOver();a.isBeyondDragSize()&&a.standardWaitAfter(a.sa?a.ZE:a.gI,b.R)}bh.prototype.doCurrentObjectChanged=function(a,b){var c=this.Jl;null===c||null!==b&&c instanceof dh&&(b===c||b.Xl(c))||this.hideToolTip()};bh.prototype.doWaitAfter=function(a){var b=this.g;null!==b&&b.Eb&&(this.doMouseHover(),this.sa||this.doToolTip(),a.tj&&!b.R.Ac&&(a=a.copy(),a.button=2,a.buttons=2,b.R=a,b.ht=!0,b.doMouseUp()))};
bh.prototype.doMouseHover=function(){var a=this.g;if(null!==a){var b=a.R;null===b.Pe&&(b.Pe=a.Je(b.ca,null,null));var c=b.Pe;if(null!==c)for(b.Ac=!1;null!==c;){a=this.sa?c.HA:c.IA;if(null!==a&&(a(b,c),b.Ac))break;c=c.O}else c=this.sa?a.HA:a.IA,null!==c&&c(b)}};
bh.prototype.doToolTip=function(){var a=this.g;if(null!==a){var b=a.R;null===b.Pe&&(b.Pe=a.Je(b.ca,null,null));b=b.Pe;if(null!==b){if(a=this.Jl,!(a instanceof dh)||b!==a&&!b.Xl(a)){for(;null!==b;){a=b.nB;if(null!==a){this.showToolTip(a,b);return}b=b.O}this.hideToolTip()}}else a=a.nB,null!==a?this.showToolTip(a,null):this.hideToolTip()}};
bh.prototype.showToolTip=function(a,b){null!==b&&w.G(b,G,bh,"showToolTip:obj");var c=this.g;if(null!==c){a!==this.Jl&&this.hideToolTip();if(a instanceof dh){a.Wf="Tool";a.dm=!1;a.scale=1/c.scale;a.rd="ToolTip";null!==a.placeholder&&(a.placeholder.scale=c.scale);c.add(a);if(null!==b){var c=null,d=b.Pl();null!==d&&(c=d.data);a.qb=b;a.data=c}else a.data=c.ba;a.Ze();this.positionToolTip(a,b)}else a instanceof Rj&&a!==this.Jl&&a.show(b,c,this);this.Jl=a;-1!==this.en&&(w.clearTimeout(this.en),this.en=-1);
c=this.LJ;if(0<c&&Infinity!==c){var e=this;this.en=w.setTimeout(function(){e.hideToolTip()},c)}}};bh.prototype.positionToolTip=function(a){if(null===a.placeholder){var b=this.g;if(null!==b){var c=b.R.ca.copy(),d=a.za,e=b.sb;b.R.tj&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5);c.x<e.x&&(c.x=e.x);c.y=c.y+20+d.height>e.bottom?c.y-(d.height+5):c.y+20;c.y<e.y&&(c.y=e.y);a.position=c}}};
bh.prototype.hideToolTip=function(){-1!==this.en&&(w.clearTimeout(this.en),this.en=-1);var a=this.g;if(null!==a){var b=this.Jl;null!==b&&(b instanceof dh?(a.remove(b),null!==this.ov&&this.ov.Aj(b.rd),b.data=null,b.qb=null):b instanceof Rj&&null!==b.Cn&&b.Cn(a,this),this.Jl=null)}};w.defineProperty(bh,{Jl:"currentToolTip"},function(){return this.gC},function(a){this.gC=a;this.ov=null!==a&&a instanceof dh?a.Nf:null});
bh.prototype.doMouseUp=function(){this.cancelWaitAfter();var a=this.g;if(null!==a){if(this.sa)for(var b=this.$f.length,c=0;c<b;c++){var d=this.$f.da(c);null===d.g&&d.Pc(this.g);if(d.canStart()){a.doFocus();a.Za=d;a.Za===d&&(d.sa||d.doActivate(),d.doMouseUp());return}}a.doFocus();this.doDeactivate()}};bh.prototype.doMouseWheel=function(){this.standardMouseWheel()};bh.prototype.doKeyDown=function(){var a=this.g;null!==a&&a.ob.doKeyDown()};bh.prototype.doKeyUp=function(){var a=this.g;null!==a&&a.ob.doKeyUp()};
bh.prototype.doCancel=function(){null!==Jh&&Jh.doCancel();ng.prototype.doCancel.call(this)};bh.prototype.findTool=function(a){w.j(a,"string",bh,"findTool:name");for(var b=this.af.length,c=0;c<b;c++){var d=this.af.da(c);if(d.name===a)return d}b=this.Zf.length;for(c=0;c<b;c++)if(d=this.Zf.da(c),d.name===a)return d;b=this.$f.length;for(c=0;c<b;c++)if(d=this.$f.da(c),d.name===a)return d;return null};
bh.prototype.replaceTool=function(a,b){w.j(a,"string",bh,"replaceTool:name");null!==b&&(w.G(b,ng,bh,"replaceTool:newtool"),b.g&&b.g!==this.g&&w.k("Cannot share tools between Diagrams: "+b.toString()),b.Pc(this.g));for(var c=this.af.length,d=0;d<c;d++){var e=this.af.da(d);if(e.name===a)return null!==b?this.af.fg(d,b):this.af.Xc(d),e}c=this.Zf.length;for(d=0;d<c;d++)if(e=this.Zf.da(d),e.name===a)return null!==b?this.Zf.fg(d,b):this.Zf.Xc(d),e;c=this.$f.length;for(d=0;d<c;d++)if(e=this.$f.da(d),e.name===
a)return null!==b?this.$f.fg(d,b):this.$f.Xc(d),e;return null};function wk(a,b,c,d){w.j(b,"string",bh,"replaceStandardTool:name");w.G(d,I,bh,"replaceStandardTool:list");null!==c&&(w.G(c,ng,bh,"replaceStandardTool:newtool"),c.g&&c.g!==a.g&&w.k("Cannot share tools between Diagrams: "+c.toString()),c.name=b,c.Pc(a.g));a.findTool(b)?a.replaceTool(b,c):null!==c&&d.add(c)}w.u(bh,{af:"mouseDownTools"},function(){return this.HG});w.u(bh,{Zf:"mouseMoveTools"},function(){return this.IG});
w.u(bh,{$f:"mouseUpTools"},function(){return this.JG});w.defineProperty(bh,{gI:"hoverDelay"},function(){return this.EC},function(a){w.j(a,"number",bh,"hoverDelay");this.EC=a});w.defineProperty(bh,{ZE:"holdDelay"},function(){return this.DC},function(a){w.j(a,"number",bh,"holdDelay");this.DC=a});w.defineProperty(bh,{JH:"dragSize"},function(){return this.sC},function(a){w.G(a,ha,bh,"dragSize");this.sC=a.S()});
w.defineProperty(bh,{LJ:"toolTipDuration"},function(){return this.OD},function(a){w.j(a,"number",bh,"toolTipDuration");this.OD=a});w.defineProperty(bh,{UG:"actionTool"},function(){return this.findTool("Action")},function(a){wk(this,"Action",a,this.af)});w.defineProperty(bh,{JF:"relinkingTool"},function(){return this.findTool("Relinking")},function(a){wk(this,"Relinking",a,this.af)});
w.defineProperty(bh,{EI:"linkReshapingTool"},function(){return this.findTool("LinkReshaping")},function(a){wk(this,"LinkReshaping",a,this.af)});w.defineProperty(bh,{UF:"resizingTool"},function(){return this.findTool("Resizing")},function(a){wk(this,"Resizing",a,this.af)});w.defineProperty(bh,{pJ:"rotatingTool"},function(){return this.findTool("Rotating")},function(a){wk(this,"Rotating",a,this.af)});
w.defineProperty(bh,{tF:"linkingTool"},function(){return this.findTool("Linking")},function(a){wk(this,"Linking",a,this.Zf)});w.defineProperty(bh,{re:"draggingTool"},function(){return this.findTool("Dragging")},function(a){wk(this,"Dragging",a,this.Zf)});w.defineProperty(bh,{IH:"dragSelectingTool"},function(){return this.findTool("DragSelecting")},function(a){wk(this,"DragSelecting",a,this.Zf)});
w.defineProperty(bh,{aJ:"panningTool"},function(){return this.findTool("Panning")},function(a){wk(this,"Panning",a,this.Zf)});w.defineProperty(bh,{Vz:"contextMenuTool"},function(){return this.findTool("ContextMenu")},function(a){wk(this,"ContextMenu",a,this.$f)});w.defineProperty(bh,{kB:"textEditingTool"},function(){return this.findTool("TextEditing")},function(a){wk(this,"TextEditing",a,this.$f)});
w.defineProperty(bh,{kH:"clickCreatingTool"},function(){return this.findTool("ClickCreating")},function(a){wk(this,"ClickCreating",a,this.$f)});w.defineProperty(bh,{lH:"clickSelectingTool"},function(){return this.findTool("ClickSelecting")},function(a){wk(this,"ClickSelecting",a,this.$f)});
function Qg(){this.hC=xk;this.kr=this.lr=this.Z=null;this.ko=this.mr=this.nr=0;this.lo=this.oc=this.Ro=this.Vj=!1;this.Wj=this.cf=!0;this.mv=this.lv=this.cC=null;this.bC=0;this.nv=null;this.av=new J("string");this.Ry=600;this.KG=new z(0,0);this.QB=this.PB=this.SD=!1;this.Pm=new ka(G,yk)}w.fa("AnimationManager",Qg);Qg.prototype.Pc=function(a){this.Z=a};function xk(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}w.u(Qg,{pK:"animationReasons"},function(){return this.av});
Qg.prototype.canStart=function(){return!0};Qg.prototype.prepareAutomaticAnimation=Qg.prototype.Sn=function(a){this.cf&&(this.Wj||this.Z.Fn)&&(this.av.add(a),this.canStart(a)&&(this.Vj&&this.pi(),this.oc=!0))};function zk(a){if(a.cf&&(a.av.clear(),a.oc))if(!a.lo)a.oc=!1;else if(0===a.ko){var b=+new Date;a.ko=b;requestAnimationFrame(function(){if(!1!==a.oc&&!a.Vj&&a.ko===b){var c=a.Z;c.oj("temporaryPixelRatio")&&(c.jk=1);Ak(c);a.oc=!1;c.Ba("AnimationStarting");Bk(a,b)}})}}
function Ck(a,b,c,d,e,f){if(!(!a.oc||"position"===c&&d.L(e)||b instanceof S&&!b.cF)){var h=a.Pm;if(h.contains(b)){var h=h.ka(b),k=h.start,l=h.end;void 0===k[c]&&(k[c]=Qk(d));h.Vw&&void 0!==l[c]?h.Jt[c]=Qk(e):(f||(h.Jt[c]=Qk(e)),l[c]=Qk(e));f&&0===c.indexOf("position:")&&b instanceof S&&(h.Jt.location=Qk(b.location))}else k=new sa,l=new sa,k[c]=Qk(d),l[c]=Qk(e),d=l,e=k.position,e instanceof z&&!e.H()&&a.av.contains("Expand SubGraph")&&e.assign(d.position),k=new yk(k,l,f),f&&0===c.indexOf("position:")&&
b instanceof S&&(k.Jt.location=Qk(b.location)),h.add(b,k);a.lo=!0}}function Qk(a){return a instanceof z?a.copy():a instanceof ha?a.copy():a}
function Bk(a,b){var c;function d(){if(!1!==f.Vj&&f.ko===b){var a=+new Date,c=a>s?m:a-r;Wk(f);Xk(f,e,q,h,c,m);f.lv&&f.lv();Ki(e);Yk(f);a>s?Zk(f):requestAnimationFrame(d)}}void 0===c&&(c=new sa);var e=a.Z;if(null!==e){a.Vj=!0;var f=a,h=c.OK||a.hC,k=c.oL||null,l=c.pL||null,m=c.duration||a.Ry,n=a.KG;for(c=a.Pm.i;c.next();){var p=c.value.start.position;p instanceof z&&(p.H()||p.assign(n))}a.cC=h;a.lv=k;a.mv=l;a.bC=m;a.nv=a.Pm;var q=a.nv;for(c=q.i;c.next();)k=c.value.end,k["position:placeholder"]&&(l=
k["position:placeholder"],n=l.Wa(vb),n.x+=l.padding.left,n.y+=l.padding.top,k["position:placeholder"]=n);Wk(a);Xk(a,e,q,h,0,m);Ki(a.Z);Yk(a);var r=+new Date,s=r+m;f.ko===b&&requestAnimationFrame(function(){d()})}}function Wk(a){if(!a.Ro){var b=a.Z;a.SD=b.wb;a.PB=b.Ne;a.QB=b.Ju;b.wb=!0;b.Ne=!0;b.Ju=!0;a.Ro=!0}}function Yk(a){var b=a.Z;b.wb=a.SD;b.Ne=a.PB;b.Ju=a.QB;a.Ro=!1}
function Xk(a,b,c,d,e,f){for(c=c.i;c.next();){var h=c.key,k=c.value,l=k.start,k=k.end,m;for(m in k)if(("position"!==m||!k["position:placeholder"]&&!k["position:node"])&&void 0!==$k[m])$k[m](h,l[m],k[m],d,e,f)}d=b.vA;b.vA=!0;m=a.hC;0!==a.nr&&0!==a.mr&&(c=a.nr,b.tb=m(e,c,a.mr-c,f));null!==a.lr&&null!==a.kr&&(c=a.lr,a=a.kr,b.hb=new z(m(e,c.x,a.x-c.x,f),m(e,c.y,a.y-c.y,f)));b.vA=d}Qg.prototype.stopAnimation=Qg.prototype.pi=function(){!0===this.oc&&(this.oc=!1,this.lo&&this.Z.Le());this.Vj&&this.cf&&Zk(this)};
function Zk(a){a.Vj=!1;a.lo=!1;Wk(a);for(var b=a.Z,c=a.cC,d=a.bC,e=a.nv.i;e.next();){var f=e.key,h=e.value,k=h.start,l=h.end,m=h.Jt,n;for(n in l)if(void 0!==$k[n]){var p=n;!h.Vw||"position:node"!==p&&"position:placeholder"!==p||(p="position");$k[p](f,k[n],void 0!==m[n]?m[n]:h.Vw?k[n]:l[n],c,d,d)}h.Vw&&void 0!==m.location&&f instanceof S&&(f.location=m.location);h.Ux&&f instanceof S&&f.td(!1)}for(c=a.Z.links;c.next();)d=c.value,null!==d.lp&&(d.points=d.lp,d.lp=null);b.Hx.clear();b.jk=null;b.qc();b.na();
b.Yf();al(b);Yk(a);a.mv&&a.mv();a.ko=0;a.nv=null;a.mv=null;a.lv=null;a.lr=null;a.kr=null;a.nr=0;a.mr=0;a.Pm=new ka(G,yk);b.Ba("AnimationFinished");b.Le()}
function bl(a,b,c){var d=b.Y,e=c.Y,f=null;c instanceof U&&(f=c.placeholder);null!==f?(d=f.Wa(vb),d.x+=f.padding.left,d.y+=f.padding.top,Ck(a,b,"position",d,b.position,!1)):Ck(a,b,"position",new z(e.x+e.width/2-d.width/2,e.y+e.height/2-d.height/2),b.position,!1);Ck(a,b,"scale",.01,b.scale,!1);if(b instanceof U)for(b=b.Mc;b.next();)f=b.value,f instanceof T&&bl(a,f,c)}
function cl(a,b,c){if(b.isVisible()){var d=null;c instanceof U&&(d=c.placeholder);null!==d?Ck(a,b,"position:placeholder",b.position,d,!0):Ck(a,b,"position:node",b.position,c,!0);Ck(a,b,"scale",b.scale,.01,!0);a.oc&&(d=a.Pm,d.contains(b)&&(d.ka(b).Ux=!0));if(b instanceof U)for(b=b.Mc;b.next();)d=b.value,d instanceof T&&cl(a,d,c)}}function dl(a,b,c){a.oc&&(null===a.lr&&b.H()&&null===a.kr&&(a.lr=b.copy()),a.kr=c.copy(),a.lo=!0)}
function el(a,b,c){a.oc&&a.Z.Fn&&(0===a.nr&&0===a.mr&&(a.nr=b),a.mr=c,a.lo=!0)}w.defineProperty(Qg,{isEnabled:"isEnabled"},function(){return this.cf},function(a){w.j(a,"boolean",Qg,"isEnabled");this.cf=a});w.defineProperty(Qg,{duration:"duration"},function(){return this.Ry},function(a){w.j(a,"number",Qg,"duration");1>a&&w.Ea(a,">= 1",Qg,"duration");this.Ry=a});w.u(Qg,{kf:"isAnimating"},function(){return this.Vj});w.u(Qg,{vI:"isTicking"},function(){return this.Ro});
w.defineProperty(Qg,{kF:"isInitial"},function(){return this.Wj},function(a){w.j(a,"boolean",Qg,"isInitial");this.Wj=a});function yk(a,b,c){this.start=a;this.end=b;this.Jt=new sa;this.Vw=c;this.Ux=!1}
var $k={opacity:function(a,b,c,d,e,f){a.opacity=d(e,b,c-b,f)},position:function(a,b,c,d,e,f){e!==f?a.hy(d(e,b.x,c.x-b.x,f),d(e,b.y,c.y-b.y,f)):a.position=new z(d(e,b.x,c.x-b.x,f),d(e,b.y,c.y-b.y,f))},"position:node":function(a,b,c,d,e,f){var h=a.Y,k=c.Y;c=k.x+k.width/2-h.width/2;h=k.y+k.height/2-h.height/2;e!==f?a.hy(d(e,b.x,c-b.x,f),d(e,b.y,h-b.y,f)):a.position=new z(d(e,b.x,c-b.x,f),d(e,b.y,h-b.y,f))},"position:placeholder":function(a,b,c,d,e,f){e!==f?a.hy(d(e,b.x,c.x-b.x,f),d(e,b.y,c.y-b.y,f)):
a.position=new z(d(e,b.x,c.x-b.x,f),d(e,b.y,c.y-b.y,f))},scale:function(a,b,c,d,e,f){a.scale=d(e,b,c-b,f)},visible:function(a,b,c,d,e,f){a.visible=e!==f?b:c}};function mg(){0<arguments.length&&w.hd(mg);w.lc(this);this.Z=null;this.zb=new I(S);this.Qb="";this.vc=1;this.gz=!1;this.rl=this.Iz=this.Tk=this.Sk=this.Rk=this.Qk=this.Ok=this.Pk=this.Nk=this.Vk=this.Mk=this.Uk=this.Lk=this.Kk=!0;this.dz=!1;this.gw=[]}w.fa("Layer",mg);mg.prototype.Pc=function(a){this.Z=a};
mg.prototype.toString=function(a){void 0===a&&(a=0);var b='Layer "'+this.name+'"';if(0>=a)return b;for(var c=0,d=0,e=0,f=0,h=0,k=this.zb.i;k.next();){var l=k.value;l instanceof U?e++:l instanceof T?d++:l instanceof W?f++:l instanceof dh?h++:c++}k="";0<c&&(k+=c+" Parts ");0<d&&(k+=d+" Nodes ");0<e&&(k+=e+" Groups ");0<f&&(k+=f+" Links ");0<h&&(k+=h+" Adornments ");if(1<a)for(a=this.zb.i;a.next();)c=a.value,k+="\n    "+c.toString(),d=c.data,null!==d&&w.Jd(d)&&(k+=" #"+w.Jd(d)),c instanceof T?k+=" "+
Qf(d):c instanceof W&&(k+=" "+Qf(c.W)+" "+Qf(c.$));return b+" "+this.zb.count+": "+k};mg.prototype.findObjectAt=mg.prototype.Je=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.rl)return null;var d=!1;null!==this.g&&this.g.sb.Ha(a)&&(d=!0);for(var e=w.K(),f=this.zb.n,h=f.length;h--;){var k=f[h];if((!0!==d||!1!==fl(k))&&k.isVisible()&&(e.assign(a),La(e,k.ph),k=k.Je(e,b,c),null!==k&&(null!==b&&(k=b(k)),null!==k&&(null===c||c(k)))))return w.v(e),k}w.v(e);return null};
mg.prototype.findObjectsAt=mg.prototype.Mt=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof I||d instanceof J||(d=new J(G));if(!1===this.rl)return d;var e=!1;null!==this.g&&this.g.sb.Ha(a)&&(e=!0);for(var f=w.K(),h=this.zb.n,k=h.length;k--;){var l=h[k];if((!0!==e||!1!==fl(l))&&l.isVisible()){f.assign(a);La(f,l.ph);var m=l;l.Mt(f,b,c,d)&&(null!==b&&(m=b(m)),null===m||null!==c&&!c(m)||(d instanceof J&&d.add(m),d instanceof I&&d.add(m)))}}w.v(f);return d};
mg.prototype.findObjectsIn=mg.prototype.yk=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof I||e instanceof J||(e=new J(G));if(!1===this.rl)return e;var f=!1;null!==this.g&&this.g.sb.vk(a)&&(f=!0);for(var h=this.zb.n,k=h.length;k--;){var l=h[k];if((!0!==f||!1!==fl(l))&&l.isVisible()){var m=l;l.yk(a,b,c,d,e)&&(null!==b&&(m=b(m)),null===m||null!==c&&!c(m)||(e instanceof J&&e.add(m),e instanceof I&&e.add(m)))}}return e};
mg.prototype.fA=function(a,b,c,d,e,f,h){if(!1===this.rl)return e;for(var k=this.zb.n,l=k.length;l--;){var m=k[l];if((!0!==h||!1!==fl(m))&&f(m)&&m.isVisible()){var n=m;m.yk(a,b,c,d,e)&&(null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||(e instanceof J&&e.add(n),e instanceof I&&e.add(n)))}}return e};
mg.prototype.findObjectsNear=mg.prototype.un=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof I||e instanceof J)f=e;e=!0}f instanceof I||f instanceof J||(f=new J(G));if(!1===this.rl)return f;var h=!1;null!==this.g&&this.g.sb.Ha(a)&&(h=!0);for(var k=w.K(),l=w.K(),m=this.zb.n,n=m.length;n--;){var p=m[n];if((!0!==h||!1!==fl(p))&&p.isVisible()){k.assign(a);La(k,p.ph);l.l(a.x+b,a.y);La(l,p.ph);var q=p;p.un(k,l,c,d,e,f)&&(null!==c&&(q=
c(q)),null===q||null!==d&&!d(q)||(f instanceof J&&f.add(q),f instanceof I&&f.add(q)))}}w.v(k);w.v(l);return f};g=mg.prototype;g.Bf=function(a,b){if(this.visible){var c;c=void 0===b?a.sb:b;for(var d=this.zb.n,e=d.length,f=0;f<e;f++){var h=d[f];h.VC=f;if(!(h instanceof W&&!1===h.Zg)){if(h instanceof dh){var k=h;if(null!==k.Nf)continue}if(ab(h.Y,c))for(h.Bf(!0),gl(h),h=h.Kw;h.next();)k=h.value,rk(k,Infinity,Infinity),k.gc(),k.Bf(!0);else h.Bf(!1),null!==h.Kw&&0<h.Kw.count&&gl(h)}}}};
g.se=function(a,b,c){if(this.visible&&0!==this.vc&&(void 0===c&&(c=!0),c||!this.Jc)){c=this.zb.n;var d=c.length;if(0!==d){1!==this.vc&&(a.globalAlpha=this.vc);var e=this.gw;e.length=0;for(var f=b.scale,h=0;h<d;h++){var k=c[h];if(fl(k)){if(k instanceof W){var l=k;l.ic&&e.push(l);if(!1===l.Zg)continue}l=k.Y;1<l.width*f||1<l.height*f?k.se(a,b):hl(k,a)}}a.globalAlpha=1}}};
function il(a,b,c,d){if(a.visible&&0!==a.vc){1!==a.vc&&(b.globalAlpha=a.vc);var e=a.gw;e.length=0;var f=c.scale;a=a.zb.n;for(var h=a.length,k=d.length,l=0;l<h;l++){var m=a[l];if(fl(m)){if(m instanceof W){var n=m;n.ic&&e.push(n);if(!1===n.Zg)continue}var n=jl(m,m.Y),p;a:{p=n;for(var q=d,r=k,s=2/f,u=4/f,t=0;t<r;t++){var x=q[t];if(0!==x.width&&0!==x.height&&p.aF(x.x-s,x.y-s,x.width+u,x.height+u)){p=!0;break a}}p=!1}p&&(1<n.width*f||1<n.height*f?m.se(b,c):hl(m,b))}}b.globalAlpha=1}}
g.h=function(a,b,c,d,e){var f=this.g;null!==f&&f.Wc(Mf,a,this,b,c,d,e)};g.$p=function(a,b,c){var d=this.zb;b.Rv=this;if(a>=d.count)a=d.count;else if(d.da(a)===b)return-1;d.Ld(a,b);b.Wt(c);d=this.g;null!==d&&(c?d.na():d.$p(b));kl(this,a,b);return a};
g.jf=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.jf(a,b,c);var d=this.zb;if(0>a||a>=d.length){if(a=d.indexOf(b),0>a)return-1}else if(d.da(a)!==b&&(a=d.indexOf(b),0>a))return-1;b.Xt(c);d.Xc(a);d=this.g;null!==d&&(c?d.na():d.jf(b));b.Rv=null;return a};
function kl(a,b,c){b=ll(a,b,c);if(c instanceof U&&null!==c&&isNaN(c.eo)){if(0!==c.Mc.count){for(var d=-1,e=a.zb.n,f=e.length,h=0;h<f;h++){var k=e[h];if(k===c&&(b=h,0<=d))break;if(0>d&&k.Ka===c&&(d=h,0<=b))break}!(0>d)&&d<b&&(e=a.zb,e.Xc(b),e.Ld(d,c))}c=c.Ka;null!==c&&kl(a,-1,c)}}
function ll(a,b,c){var d=c.eo;if(isNaN(d))return b;a=a.zb;var e=a.count;if(1>=e)return b;0>b&&(b=a.indexOf(c));if(0>b)return-1;for(var f=b-1,h=NaN;0<=f;){h=a.da(f).eo;if(!isNaN(h))break;f--}for(var k=b+1,l=NaN;k<e;){l=a.da(k).eo;if(!isNaN(l))break;k++}if(!isNaN(h)&&h>d)for(;;){if(-1===f||h<=d){f++;if(f===b)break;a.Xc(b);a.Ld(f,c);return f}for(h=NaN;0<=--f&&(h=a.da(f).eo,isNaN(h)););}else if(!isNaN(l)&&l<d)for(;;){if(k===e||l>=d){k--;if(k===b)break;a.Xc(b);a.Ld(k,c);return k}for(l=NaN;++k<e&&(l=a.da(k).eo,
isNaN(l)););}return b}g.clear=function(){for(var a=this.zb.dc(),b=a.length,c=0;c<b;c++)a[c].Bf(!1),this.jf(-1,a[c],!1)};w.u(mg,{Hk:"parts"},function(){return this.zb.i});w.u(mg,{wL:"partsBackwards"},function(){return this.zb.Gn});w.u(mg,{g:"diagram"},function(){return this.Z});
w.defineProperty(mg,{name:"name"},function(){return this.Qb},function(a){w.j(a,"string",mg,"name");var b=this.Qb;if(b!==a){var c=this.g;if(null!==c)for(""===b&&w.k("Cannot rename default Layer to: "+a),c=c.Ex;c.next();)c.value.name===a&&w.k("Layer.name is already present in this diagram: "+a);this.Qb=a;this.h("name",b,a);for(a=this.zb.i;a.next();)a.value.Wf=this.Qb}});
w.defineProperty(mg,{opacity:"opacity"},function(){return this.vc},function(a){var b=this.vc;b!==a&&(w.j(a,"number",mg,"opacity"),(0>a||1<a)&&w.Ea(a,"0 <= value <= 1",mg,"opacity"),this.vc=a,this.h("opacity",b,a),a=this.g,null!==a&&a.na())});w.defineProperty(mg,{Jc:"isTemporary"},function(){return this.gz},function(a){var b=this.gz;b!==a&&(w.j(a,"boolean",mg,"isTemporary"),this.gz=a,this.h("isTemporary",b,a))});
w.defineProperty(mg,{visible:"visible"},function(){return this.Iz},function(a){var b=this.Iz;if(b!==a){w.j(a,"boolean",mg,"visible");this.Iz=a;this.h("visible",b,a);for(b=this.zb.i;b.next();)b.value.td(a);a=this.g;null!==a&&a.na()}});w.defineProperty(mg,{Sg:"pickable"},function(){return this.rl},function(a){var b=this.rl;b!==a&&(w.j(a,"boolean",mg,"pickable"),this.rl=a,this.h("pickable",b,a))});
w.defineProperty(mg,{dF:"isBoundsIncluded"},function(){return this.dz},function(a){this.dz!==a&&(this.dz=a,null!==this.g&&this.g.qc())});w.defineProperty(mg,{sk:"allowCopy"},function(){return this.Kk},function(a){var b=this.Kk;b!==a&&(w.j(a,"boolean",mg,"allowCopy"),this.Kk=a,this.h("allowCopy",b,a))});w.defineProperty(mg,{gn:"allowDelete"},function(){return this.Lk},function(a){var b=this.Lk;b!==a&&(w.j(a,"boolean",mg,"allowDelete"),this.Lk=a,this.h("allowDelete",b,a))});
w.defineProperty(mg,{Ow:"allowTextEdit"},function(){return this.Uk},function(a){var b=this.Uk;b!==a&&(w.j(a,"boolean",mg,"allowTextEdit"),this.Uk=a,this.h("allowTextEdit",b,a))});w.defineProperty(mg,{Lw:"allowGroup"},function(){return this.Mk},function(a){var b=this.Mk;b!==a&&(w.j(a,"boolean",mg,"allowGroup"),this.Mk=a,this.h("allowGroup",b,a))});
w.defineProperty(mg,{Pw:"allowUngroup"},function(){return this.Vk},function(a){var b=this.Vk;b!==a&&(w.j(a,"boolean",mg,"allowUngroup"),this.Vk=a,this.h("allowUngroup",b,a))});w.defineProperty(mg,{At:"allowLink"},function(){return this.Nk},function(a){var b=this.Nk;b!==a&&(w.j(a,"boolean",mg,"allowLink"),this.Nk=a,this.h("allowLink",b,a))});
w.defineProperty(mg,{hn:"allowRelink"},function(){return this.Pk},function(a){var b=this.Pk;b!==a&&(w.j(a,"boolean",mg,"allowRelink"),this.Pk=a,this.h("allowRelink",b,a))});w.defineProperty(mg,{Dl:"allowMove"},function(){return this.Ok},function(a){var b=this.Ok;b!==a&&(w.j(a,"boolean",mg,"allowMove"),this.Ok=a,this.h("allowMove",b,a))});
w.defineProperty(mg,{Mw:"allowReshape"},function(){return this.Qk},function(a){var b=this.Qk;b!==a&&(w.j(a,"boolean",mg,"allowReshape"),this.Qk=a,this.h("allowReshape",b,a))});w.defineProperty(mg,{Bt:"allowResize"},function(){return this.Rk},function(a){var b=this.Rk;b!==a&&(w.j(a,"boolean",mg,"allowResize"),this.Rk=a,this.h("allowResize",b,a))});
w.defineProperty(mg,{Nw:"allowRotate"},function(){return this.Sk},function(a){var b=this.Sk;b!==a&&(w.j(a,"boolean",mg,"allowRotate"),this.Sk=a,this.h("allowRotate",b,a))});w.defineProperty(mg,{tf:"allowSelect"},function(){return this.Tk},function(a){var b=this.Tk;b!==a&&(w.j(a,"boolean",mg,"allowSelect"),this.Tk=a,this.h("allowSelect",b,a))});
function D(a){function b(){window.document.removeEventListener("DOMContentLoaded",b,!1);ml(c)}1<arguments.length&&w.k("Diagram constructor can only take one optional argument, the DIV HTML element or its id.");w.lc(this);nl=[];this.Rc=!0;this.KB=new Qg;this.KB.Pc(this);this.Cd=17;this.Lr=!1;this.sz="default";var c=this;null!==window.document.body?ml(this):window.document.addEventListener("DOMContentLoaded",b,!1);this.$b=new I(mg);this.Lb=this.Ib=0;this.gk=this.Mb=this.qf=this.Eb=null;this.QF();this.Oo=
null;this.PF();this.hb=(new z(NaN,NaN)).freeze();this.tb=1;this.Hv=(new z(NaN,NaN)).freeze();this.Iv=NaN;this.Zv=1E-4;this.Xv=100;this.cd=new ia;this.Iw=(new z(NaN,NaN)).freeze();this.zv=(new A(NaN,NaN,NaN,NaN)).freeze();this.qw=(new eb(0,0,0,0)).freeze();this.rw=ol;this.nw=this.lw=null;this.qm=ih;this.ro=oc;this.el=ih;this.Lo=oc;this.Jv=this.Gv=vb;this.Be=!0;this.Hr=!1;this.qg=new J(S);this.Zk=new ka(W,A);this.Co=!0;this.Nq=250;this.mo=-1;this.dv=(new eb(16,16,16,16)).freeze();this.rv=this.Mf=!1;
this.Go=!0;this.Hi=new Af;this.Tc=new Af;this.Pb=new Af;this.gh=this.vi=null;this.ht=!1;this.Ny=this.Oy=null;pl(this);this.ep=new J(T);this.wl=new J(U);this.Yo=new J(W);this.zb=new J(S);this.Pv=!0;this.Dw=ql;this.HC=!1;this.Fw=Oi;this.Iy=this.Ly=this.Ez=null;this.kv="";this.jr="auto";this.zi=this.dj=this.Si=this.bw=this.Ti=this.Ui=this.Vi=this.yi=this.Ei=this.wi=null;this.nz=!1;this.pD={};this.kw=0;this.Zi=[null,null];this.Fy=null;this.Fq=this.My=this.zz=this.vD=this.cj=!1;this.SC=!0;this.fz=this.Xd=
!1;this.ke=null;var d=this;this.$C=function(a){if(a.ba===d.ba&&d.Ua){d.Ua=!1;try{var b=a.xc;""===a.nf&&b===Mf&&rl(d,a.object,a.propertyName)}finally{d.Ua=!0}}};this.aD=function(a){sl(d,a)};this.VD=!0;this.dh=-2;this.Ai=new ka(Object,S);this.Kj=new ka(Object,W);this.Em=new ka(Object,Array);this.gp=new ka("string",Array);this.qz=new I(tl);this.Ji=!1;this.Lk=this.Kk=this.Tu=this.cf=!0;this.Vu=this.Uu=!1;this.$u=this.Yu=this.Tk=this.Sk=this.Rk=this.Qk=this.Ok=this.Pk=this.Nk=this.Xu=this.Vk=this.Mk=this.Uk=
!0;this.Cm=this.PC=!1;this.Zu=this.Wu=this.Ev=this.Dv=!0;this.tw=this.pw=16;this.vz=this.ow=!1;this.Qs=this.sw=null;this.wz=this.xz=0;this.ff=(new eb(5)).freeze();this.vw=(new J(S)).freeze();this.Yv=999999999;this.Fv=(new J(S)).freeze();this.fl=this.Am=this.Uj=!0;this.cl=this.Tj=!1;this.ie=null;this.bv=!0;this.eh=!1;this.GG=new J(W);this.FC=new J(ul);this.Bd=null;this.gD=1;this.yD=0;this.nh={scale:1,position:new z,bounds:new A,isScroll:!1};this.UD=(new A(NaN,NaN,NaN,NaN)).freeze();this.sv=(new A(NaN,
NaN,NaN,NaN)).freeze();this.uv=null;this.hw=new J(vl);wl(this);this.Tv=this.Bv=this.cw=this.kC=this.jC=this.lC=this.$j=this.al=this.Wi=null;xl(this);this.nd=null;this.Av=!1;this.uo=null;this.ab=new bh;this.ab.initializeStandardTools();this.Za=this.Ft=this.ab;this.ob=new og;this.ba=new P;this.cj=!0;this.Rb=new pg;this.cj=!1;this.xC=this.Qy=null;this.zd=1;this.jk=null;var e=w.vfo.split(".");!0!==w.$w.licenseKey&&"1"===e[0]&&7>parseInt(e[1],10)&&(w.trace("Warning: You have entered a license key for GoJS version 1.7 or later, but this library is version "+
w.vfo+". This license key will do nothing until you upgrade to GoJS 1.7 or later."),w.$w.licenseKey=!0);this.jl=1;this.Gm=0;this.UC=new z;this.QD=500;this.cv=new z;this.Zs=null;this.gl=!1;this.preventDefault=this.Tx=this.FF=this.GF=this.EF=this.On=this.Ng=this.Pn=this.Mn=this.Nn=this.xB=this.oB=this.pB=this.qB=this.tl=this.Ms=this.sl=this.Ls=null;this.dl=new yl;void 0!==a&&zl(this,a);this.Mv=!1;this.dD=1;this.Rc=!1}w.fa("Diagram",D);
D.prototype.clear=D.prototype.clear=function(){var a=null;null!==this.nd&&(a=this.nd.U);this.ba.clear();for(var b=this.$b.length,c=0;c<b;c++)this.$b.n[c].clear();this.qg.clear();this.Zk.clear();this.ep.clear();this.wl.clear();this.Yo.clear();this.zb.clear();this.Ai.clear();this.Kj.clear();this.Em.clear();this.vw.Ra();this.vw.clear();this.vw.freeze();this.Fv.Ra();this.Fv.clear();this.Fv.freeze();$g=this.uo=null;ah="";this.sv=(new A(NaN,NaN,NaN,NaN)).freeze();null!==a&&(this.add(a),this.zb.remove(a));
this.na()};
D.prototype.reset=D.prototype.reset=function(){this.Rc=!0;this.clear();this.$b=new I(mg);this.QF();this.PF();this.hb=(new z(NaN,NaN)).freeze();this.tb=1;this.Hv=(new z(NaN,NaN)).freeze();this.Iv=NaN;this.Zv=1E-4;this.Xv=100;this.Iw=(new z(NaN,NaN)).freeze();this.zv=(new A(NaN,NaN,NaN,NaN)).freeze();this.qw=(new eb(0,0,0,0)).freeze();this.rw=ol;this.nw=this.lw=null;this.qm=ih;this.ro=oc;this.el=ih;this.Lo=oc;this.Jv=this.Gv=vb;this.Nq=250;this.dv=(new eb(16,16,16,16)).freeze();this.Pv=!0;this.Dw=ql;
this.Fw=Oi;this.jr="auto";this.zi=this.dj=this.Si=this.bw=this.Ti=this.Ui=this.Vi=this.yi=this.Ei=this.wi=null;this.Ji=!1;this.Lk=this.Kk=this.Tu=this.cf=!0;this.Vu=this.Uu=!1;this.Zu=this.Wu=this.Ev=this.Dv=this.$u=this.Yu=this.Tk=this.Sk=this.Rk=this.Qk=this.Ok=this.Pk=this.Nk=this.Xu=this.Vk=this.Mk=this.Uk=!0;this.tw=this.pw=16;this.ff=(new eb(5)).freeze();this.Yv=999999999;this.ie=null;xl(this);this.nd=null;this.ab=new bh;this.ab.initializeStandardTools();this.Za=this.Ft=this.ab;this.ob=new og;
this.cj=!0;wl(this);this.Rb=new pg;this.cj=!1;this.ba=new P;this.eh=!1;this.Go=!0;this.Rc=this.Mf=!1;this.na();this.gh=this.vi=null;pl(this);this.kv=""};
function xl(a){a.Wi=new ka("string",S);var b=new T,c=new Ch;c.bind(new Vg("text","",Qf));b.add(c);a.lC=b;a.Wi.add("",b);b=new T;c=new Ch;c.stroke="brown";c.bind(new Vg("text","",Qf));b.add(c);a.Wi.add("Comment",b);b=new T;b.dm=!1;b.Pz=!1;c=new X;c.Cb="Ellipse";c.fill="black";c.stroke=null;c.Aa=(new ha(3,3)).Ga();b.add(c);a.Wi.add("LinkLabel",b);a.al=new ka("string",U);b=new U;b.ZA="GROUPPANEL";b.type=Al;c=new Ch;c.font="bold 12pt sans-serif";c.bind(new Vg("text","",Qf));b.add(c);c=new C(Bl);c.name=
"GROUPPANEL";var d=new X;d.Cb="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new Hj;d.padding=(new eb(5,5,5,5)).Ga();c.add(d);b.add(c);a.jC=b;a.al.add("",b);a.$j=new ka("string",W);b=new W;c=new X;c.Uf=!0;b.add(c);c=new X;c.zq="Standard";c.fill="black";c.stroke=null;c.kb=0;b.add(c);a.kC=b;a.$j.add("",b);b=new W;c=new X;c.Uf=!0;c.stroke="brown";b.add(c);a.$j.add("Comment",b);b=new dh;b.type=Bl;c=new X;c.fill=null;c.stroke="dodgerblue";c.kb=3;b.add(c);c=new Hj;c.margin=(new eb(1.5,
1.5,1.5,1.5)).Ga();b.add(c);a.cw=b;a.Bv=b;b=new dh;b.type=aj;c=new X;c.Uf=!0;c.fill=null;c.stroke="dodgerblue";c.kb=3;b.add(c);a.Tv=b}
function ml(a){var b=w.createElement("p");b.style.width="100%";b.style.height="200px";b.style.boxSizing="content-box";var c=w.createElement("div");c.style.position="absolute";c.style.visibility="hidden";c.style.width="200px";c.style.height="150px";c.style.overflow="hidden";c.style.boxSizing="content-box";c.appendChild(b);window.document.body.appendChild(c);var d=b.offsetWidth;c.style.overflow="scroll";b=b.offsetWidth;d===b&&(b=c.clientWidth);window.document.body.removeChild(c);c=d-b;0!==c||w.iF||
(c=11);a.Cd=c;c=w.createElement("div");c.dir="rtl";c.style.cssText="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;";c.textContent="A";window.document.body.appendChild(c);d="reverse";0<c.scrollLeft?d="default":(c.scrollLeft=1,0===c.scrollLeft&&(d="negative"));window.document.body.removeChild(c);a.sz=d}D.prototype.fc=function(a){a.De===D?this.Fl=a:w.Ej(this,a)};
D.prototype.toString=function(a){void 0===a&&(a=0);var b="";this.lj&&this.lj.id&&(b=this.lj.id);b='Diagram "'+b+'"';if(0>=a)return b;for(var c=this.$b.i;c.next();)b+="\n  "+c.value.toString(a-1);return b};D.fromDiv=function(a){var b=a;"string"===typeof a&&(b=window.document.getElementById(a));return b instanceof HTMLDivElement&&b.Z instanceof D?b.Z:null};
w.defineProperty(D,{lj:"div"},function(){return this.Mb},function(a){null!==a&&w.G(a,HTMLDivElement,D,"div");if(this.Mb!==a){nl=[];var b=this.Mb;null!==b?(b.Z=void 0,b.innerHTML="",null!==this.Eb&&(this.Eb.removeEventListener("touchstart",this.qB,!1),this.Eb.removeEventListener("touchmove",this.pB,!1),this.Eb.removeEventListener("touchend",this.oB,!1),this.Eb.Gd.Z=null),b=this.ab,null!==b&&(b.af.each(function(a){a.cancelWaitAfter()}),b.Zf.each(function(a){a.cancelWaitAfter()}),b.$f.each(function(a){a.cancelWaitAfter()})),
b.cancelWaitAfter(),this.Za.doCancel(),this.qf=this.Eb=null,window.removeEventListener("resize",this.xB,!1),window.removeEventListener("mousemove",this.Nn,!0),window.removeEventListener("mousedown",this.Mn,!0),window.removeEventListener("mouseup",this.Pn,!0),window.removeEventListener("mousewheel",this.Ng,!0),window.removeEventListener("DOMMouseScroll",this.Ng,!0),window.removeEventListener("mouseout",this.On,!0)):this.eh=!1;this.Mb=null;if(null!==a){if(b=a.Z)b.lj=null;zl(this,a);this.Sx()}}});
function Cl(a){var b=a.Eb;b.addEventListener("touchstart",a.qB,!1);b.addEventListener("touchmove",a.pB,!1);b.addEventListener("touchend",a.oB,!1);b.addEventListener("mousemove",a.Nn,!1);b.addEventListener("mousedown",a.Mn,!1);b.addEventListener("mouseup",a.Pn,!1);b.addEventListener("mousewheel",a.Ng,!1);b.addEventListener("DOMMouseScroll",a.Ng,!1);b.addEventListener("mouseout",a.On,!1);b.addEventListener("keydown",a.xI,!1);b.addEventListener("keyup",a.yI,!1);b.addEventListener("selectstart",function(a){a.preventDefault();
return!1},!1);b.addEventListener("contextmenu",function(a){a.preventDefault();return!1},!1);b.addEventListener("gesturechange",function(b){a.ab.Xp===tk&&b.preventDefault()},!1);b.addEventListener("pointerdown",a.EF,!1);b.addEventListener("pointermove",a.GF,!1);b.addEventListener("pointerleave",a.FF,!1);window.addEventListener("resize",a.xB,!1)}D.prototype.computePixelRatio=function(){return null!==this.jk?this.jk:this.dD};D.prototype.doMouseMove=function(){this.Za.doMouseMove()};
D.prototype.doMouseDown=function(){this.Za.doMouseDown()};D.prototype.doMouseUp=function(){this.Za.doMouseUp()};D.prototype.doMouseWheel=function(){this.Za.doMouseWheel()};D.prototype.doKeyDown=function(){this.Za.doKeyDown()};D.prototype.doKeyUp=function(){this.Za.doKeyUp()};D.prototype.doFocus=function(){this.focus()};D.prototype.focus=D.prototype.focus=function(){this.Eb&&this.Eb.focus()};
function Ak(a){if(null!==a.Eb){var b=a.Mb;if(0!==b.clientWidth&&0!==b.clientHeight){var c=a.cl?a.Cd:0,d=a.Tj?a.Cd:0,e=a.zd;a.zd=a.computePixelRatio();a.zd!==e&&(a.Hr=!0,a.Le());if(b.clientWidth!==a.Ib+c||b.clientHeight!==a.Lb+d)a.Am=!0,a.Be=!0,b=a.Rb,null!==b&&b.Ax&&a.Fl===ih&&b.J(),a.Xd||a.Le()}}}
function wl(a){var b=new mg;b.name="Background";a.ut(b);b=new mg;b.name="";a.ut(b);b=new mg;b.name="Foreground";a.ut(b);b=new mg;b.name="Adornment";b.Jc=!0;a.ut(b);b=new mg;b.name="Tool";b.Jc=!0;b.dF=!0;a.ut(b);b=new mg;b.name="Grid";b.tf=!1;b.Sg=!1;b.Jc=!0;a.ZG(b,a.Lt("Background"))}
function Dl(a){a.nd=new C(El);a.nd.name="GRID";var b=new X;b.Cb="LineH";b.stroke="lightgray";b.kb=.5;b.interval=1;a.nd.add(b);b=new X;b.Cb="LineH";b.stroke="gray";b.kb=.5;b.interval=5;a.nd.add(b);b=new X;b.Cb="LineH";b.stroke="gray";b.kb=1;b.interval=10;a.nd.add(b);b=new X;b.Cb="LineV";b.stroke="lightgray";b.kb=.5;b.interval=1;a.nd.add(b);b=new X;b.Cb="LineV";b.stroke="gray";b.kb=.5;b.interval=5;a.nd.add(b);b=new X;b.Cb="LineV";b.stroke="gray";b.kb=1;b.interval=10;a.nd.add(b);b=new S;b.add(a.nd);
b.Wf="Grid";b.eo=0;b.xA=!1;b.cF=!1;b.Sg=!1;b.AA="GRID";a.add(b);a.zb.remove(b);a.nd.visible=!1}function Fl(){this.Z.isEnabled?this.Z.HH(this):Gl(this.Z)}function Hl(a){this.Z.isEnabled?(this.Z.vz=!0,this.Z.xz=a.target.scrollTop,this.Z.wz=a.target.scrollLeft):Gl(this.Z)}
D.prototype.diagramScroll=D.prototype.HH=function(a){if(this.vz&&null!==this.Eb){this.ow=!0;var b=this.qe,c=this.sb,d=b.width,e=c.width,f=b.height,h=c.height,k=b.right,l=c.right,m=b.bottom,n=c.bottom,p=b.x,q=c.x,b=b.y,c=c.y,r=this.scale,s;s=a.scrollLeft;if(this.Lr)switch(this.sz){case "negative":s=s+a.scrollWidth-a.clientWidth;break;case "reverse":s=a.scrollWidth-s-a.clientWidth}var u=s;e<d||h<f?(s=w.xb(this.position.x,this.position.y),this.me&&this.wz!==u&&(s.x=u/r+p,this.wz=u),this.ne&&this.xz!==
a.scrollTop&&(s.y=a.scrollTop/r+b,this.xz=a.scrollTop),this.position=s,w.v(s),this.Am=this.ow=!1):(s=w.K(),a.NG&&this.me&&(p<q&&(this.position=s.l(u+p,this.position.y)),k>l&&(this.position=s.l(-(this.sw.scrollWidth-this.Ib)+u-this.Ib/r+k,this.position.y))),a.OG&&this.ne&&(b<c&&(this.position=s.l(this.position.x,a.scrollTop+b)),m>n&&(this.position=s.l(this.position.x,-(this.sw.scrollHeight-this.Lb)+a.scrollTop-this.Lb/r+m))),w.v(s),Il(this),this.Am=this.ow=!1,b=this.qe,c=this.sb,k=b.right,l=c.right,
m=b.bottom,n=c.bottom,p=b.x,q=c.x,b=b.y,c=c.y,e>=d&&p>=q&&k<=l&&(this.Qs.style.width="1px"),h>=f&&b>=c&&m<=n&&(this.Qs.style.height="1px"))}};D.prototype.computeBounds=D.prototype.sh=function(){0<this.qg.count&&Ai(this);return Jl(this)};
function Jl(a){if(a.LE.H()){var b=a.LE.copy();b.Jw(a.padding);return b}for(var c=!0,d=a.$b.n,e=d.length,f=0;f<e;f++){var h=d[f];if(h.visible&&(!h.Jc||h.dF))for(var h=h.zb.n,k=h.length,l=0;l<k;l++){var m=h[l];m.xA&&m.isVisible()&&(m=m.Y,m.H()&&(c?(c=!1,b=m.copy()):b.Gh(m)))}}c&&(b=new A(0,0,0,0));b.Jw(a.padding);return b}
D.prototype.computePartsBounds=function(a,b){void 0===b&&(b=!1);for(var c=null,d=a.i;d.next();){var e=d.value;!b&&e instanceof W||(e.Ze(),null===c?c=e.Y.copy():c.Gh(e.Y))}return null===c?new A(NaN,NaN,0,0):c};
function Kl(a,b){if((b||a.eh)&&!a.Rc&&null!==a.Eb&&!a.Pa.kf&&a.qe.H()){a.Rc=!0;var c=a.qm;b&&a.el!==ih&&(c=a.el);var d=c!==ih?Ll(a,c):a.scale,c=a.sb.copy(),e=a.Ib/d,f=a.Lb/d,h=null,k=a.Pa;k.oc&&(h=a.hb.copy());a.position.Ra();var l=a.ro;b&&!l.fd()&&a.Lo.fd()&&(l=a.Lo);Ml(a,a.hb,a.qe,e,f,l,b);a.position.freeze();null!==h&&dl(k,h,a.hb);e=a.scale;a.scale=d;a.Rc=!1;d=a.sb;d.Ic(c)||a.uu(c,d,e,a.scale,!1)}}
function Ll(a,b){var c=a.ob.Yw;if(null===a.Eb)return c;a.Uj&&Nl(a,a.sh());var d=a.qe;if(!d.H())return c;var e=d.width,d=d.height,f=a.Ib,h=a.Lb,k=f/e,l=h/d;return b===Ol?(e=Math.min(l,k),e>c&&(e=c),e<a.yh&&(e=a.yh),e>a.xh&&(e=a.xh),e):b===Pl?(e=l>k?(h-a.Cd)/d:(f-a.Cd)/e,e>c&&(e=c),e<a.yh&&(e=a.yh),e>a.xh&&(e=a.xh),e):a.scale}D.prototype.zoomToFit=D.prototype.zoomToFit=function(){this.scale=Ll(this,Ol)};
D.prototype.zoomToRect=function(a,b){void 0===b&&(b=Ol);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===Ol||b===Pl)if(isNaN(c))e=this.sb.height*this.scale/d;else if(isNaN(d))e=this.sb.width*this.scale/c;else var e=this.Ib,f=this.Lb,e=b===Pl?f/d>e/c?(f-(this.Tj?this.Cd:0))/d:(e-(this.cl?this.Cd:0))/c:Math.min(f/d,e/c);this.scale=e;this.position=new z(a.x,a.y)}};w.defineProperty(D,{vA:null},function(){return this.Rc},function(a){this.Rc=a});
D.prototype.alignDocument=function(a,b){this.Uj&&Nl(this,this.sh());var c=this.qe,d=this.sb;this.position=new z(c.x+(a.x*c.width+a.offsetX)-(b.x*d.width-b.offsetX),c.y+(a.y*c.height+a.offsetY)-(b.y*d.height-b.offsetY))};
function Ml(a,b,c,d,e,f,h){var k=b.x,l=b.y;if(h||a.WA===ol)f.fd()&&(d>c.width&&(k=c.x+(f.x*c.width+f.offsetX)-(f.x*d-f.offsetX)),e>c.height&&(l=c.y+(f.y*c.height+f.offsetY)-(f.y*e-f.offsetY))),f=a.XF,h=d-c.width,d<c.width+f.left+f.right?(k=Math.min(k+d/2,c.right+Math.max(h,f.right)-d/2),k=Math.max(k,c.left-Math.max(h,f.left)+d/2),k-=d/2):k>c.left?k=c.left:k<c.right-d&&(k=c.right-d),d=e-c.height,e<c.height+f.top+f.bottom?(l=Math.min(l+e/2,c.bottom+Math.max(d,f.bottom)-e/2),l=Math.max(l,c.top-Math.max(d,
f.top)+e/2),l-=e/2):l>c.top?l=c.top:l<c.bottom-e&&(l=c.bottom-e);b.x=isFinite(k)?k:-a.padding.left;b.y=isFinite(l)?l:-a.padding.top;null!==a.IF&&(a=a.IF(a,b),b.x=a.x,b.y=a.y)}D.prototype.findPartAt=D.prototype.Nt=function(a,b){var c=b?Ei(this,a,function(a){return a.U},function(a){return a.canSelect()}):Ei(this,a,function(a){return a.U});return c instanceof S?c:null};
D.prototype.findObjectAt=D.prototype.Je=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);Ai(this);for(var d=this.$b.Gn;d.next();){var e=d.value;if(e.visible&&(e=e.Je(a,b,c),null!==e))return e}return null};function Ei(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);Ai(a);for(a=a.$b.Gn;a.next();){var e=a.value;if(e.visible&&!e.Jc&&(e=e.Je(b,c,d),null!==e))return e}return null}
D.prototype.findObjectsAt=D.prototype.Mt=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof I||d instanceof J||(d=new J(G));Ai(this);for(var e=this.$b.Gn;e.next();){var f=e.value;f.visible&&f.Mt(a,b,c,d)}return d};D.prototype.findObjectsIn=D.prototype.yk=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof I||e instanceof J||(e=new J(G));Ai(this);for(var f=this.$b.Gn;f.next();){var h=f.value;h.visible&&h.yk(a,b,c,d,e)}return e};
D.prototype.fA=function(a,b,c,d,e,f){var h=new J(G);Ai(this);for(var k=this.$b.Gn;k.next();){var l=k.value;l.visible&&l.fA(a,b,c,d,h,e,f)}return h};D.prototype.findObjectsNear=D.prototype.un=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof I||e instanceof J)f=e;e=!0}f instanceof I||f instanceof J||(f=new J(G));Ai(this);for(var h=this.$b.Gn;h.next();){var k=h.value;k.visible&&k.un(a,b,c,d,e,f)}return f};
D.prototype.acceptEvent=function(a){var b=this.Tc;this.Tc=this.Pb;this.Pb=b;Ql(this,this,a,b,a instanceof MouseEvent);return b};
function Ql(a,b,c,d,e){d.g=b;d.event=c;e?Rl(a,c,d):(d.bf=b.Pb.bf,d.ca=b.Pb.ca);a=0;c.ctrlKey&&(a+=1);c.altKey&&(a+=2);c.shiftKey&&(a+=4);c.metaKey&&(a+=8);d.ud=a;d.button=c.button;void 0===c.buttons||w.qI||(d.buttons=c.buttons);w.Ek&&0===c.button&&c.ctrlKey&&(d.button=2);d.Nl=!1;d.up=!1;d.Fe=1;d.Ml=0;d.Ac=!1;d.bubbles=!1;d.timestamp=Date.now();d.du=!1;d.Ug=c.target.Z?c.target.Z:null;d.Pe=null}
function Sl(a,b,c,d,e){d.g=a;Rl(a,c,d);d.ud=0;d.button=0;d.buttons=1;d.Nl=!0;d.up=!1;d.Fe=1;d.Ml=0;d.Ac=!1;d.bubbles=!0;d.event=b;d.timestamp=Date.now();d.du=e;d.Ug=b.target.Z?b.target.Z:null;d.Pe=null;a.Hi=d.copy();Jh=null}
function Tl(a,b,c,d,e){var f=null;d.g=a;null!==c?((f=window.document.elementFromPoint(c.clientX,c.clientY))&&f.Z?f=f.Z:(c=b.changedTouches[0],f=a),d.Ug=f,Rl(a,c,d)):null!==a.Tc?(d.ca=a.Tc.ca,d.bf=a.Tc.bf,d.Ug=a.Tc.Ug):null!==a.Hi&&(d.ca=a.Hi.ca,d.bf=a.Hi.bf,d.Ug=a.Hi.Ug);d.ud=0;d.button=0;d.buttons=1;d.Nl=!1;d.up=!1;d.Fe=1;d.Ml=0;d.Ac=!1;d.bubbles=!1;d.event=b;d.timestamp=Date.now();d.du=e;d.Pe=null}
function Ul(a,b){if(a.bubbles)return!0;void 0!==b.stopPropagation&&b.stopPropagation();(void 0===b.touches||2>b.touches.length)&&b.preventDefault();b.cancelBubble=!0;return!1}
D.prototype.xI=function(a){if(!this.Z.isEnabled)return!1;var b=this.Z.Pb;Ql(this.Z,this.Z,a,b,!1);b.key=String.fromCharCode(a.which);b.Nl=!0;switch(a.which){case 8:b.key="Backspace";break;case 33:b.key="PageUp";break;case 34:b.key="PageDown";break;case 35:b.key="End";break;case 36:b.key="Home";break;case 37:b.key="Left";break;case 38:b.key="Up";break;case 39:b.key="Right";break;case 40:b.key="Down";break;case 45:b.key="Insert";break;case 46:b.key="Del";break;case 48:b.key="0";break;case 187:case 61:case 107:b.key=
"Add";break;case 189:case 173:case 109:b.key="Subtract";break;case 27:b.key="Esc"}this.Z.doKeyDown();return 187!==a.which&&189!==a.which&&48!==a.which&&107!==a.which&&109!==a.which&&61!==a.which&&173!==a.which||!0!==a.ctrlKey?Ul(b,a):(a.cancelBubble=!0,a.preventDefault(),a.stopPropagation(),!1)};
D.prototype.yI=function(a){if(!this.Z.isEnabled)return!1;var b=this.Z.Pb;Ql(this.Z,this.Z,a,b,!1);b.key=String.fromCharCode(a.which);b.up=!0;switch(a.which){case 8:b.key="Backspace";break;case 33:b.key="PageUp";break;case 34:b.key="PageDown";break;case 35:b.key="End";break;case 36:b.key="Home";break;case 37:b.key="Left";break;case 38:b.key="Up";break;case 39:b.key="Right";break;case 40:b.key="Down";break;case 45:b.key="Insert";break;case 46:b.key="Del";break;case 93:a.preventDefault()}this.Z.doKeyUp();
return Ul(b,a)};D.prototype.zr=function(a){var b=this.Eb;if(null===b)return new z(0,0);var c=this.Ib,d=this.Lb,b=b.getBoundingClientRect(),c=a.clientX-c/b.width*b.left;a=a.clientY-d/b.height*b.top;return null!==this.cd?(a=new z(c,a),La(a,this.cd),a):new z(c,a)};function Rl(a,b,c){var d=a.Eb,e=a.Ib,f=a.Lb,h=0,k=0;null!==d&&(d=d.getBoundingClientRect(),h=b.clientX-e/d.width*d.left,k=b.clientY-f/d.height*d.top);c.bf.l(h,k);null!==a.cd?(b=w.xb(h,k),a.cd.li(b),c.ca.assign(b),w.v(b)):c.ca.l(h,k)}
function Bf(a,b,c,d){var e=null;if(void 0!==b.targetTouches){if(2>b.targetTouches.length)return;e=b.targetTouches[c]}else if(null!==a.Zi[0])e=a.Zi[c];else return;c=a.Eb;b=a.Ib;a=a.Lb;var f=0,h=0;null!==c&&null!==e&&(c=c.getBoundingClientRect(),f=e.clientX-b/c.width*c.left,h=e.clientY-a/c.height*c.top);d.l(f,h)}D.prototype.invalidateDocumentBounds=D.prototype.qc=function(){this.Uj||(this.Uj=!0,this.Le(!0))};function al(a){a.Xd||Ai(a);a.Uj&&Nl(a,a.sh())}
D.prototype.redraw=D.prototype.Sx=function(){this.Rc||this.Xd||(this.na(),Vl(this),Il(this),this.qc(),this.Yf())};D.prototype.isUpdateRequested=function(){return this.Mf};D.prototype.delayInitialization=function(a){void 0===a&&(a=null);var b=this.Pa,c=b.isEnabled;b.pi();b.isEnabled=!1;Ki(this);this.eh=!1;b.isEnabled=c;null!==a&&w.setTimeout(a,1)};
D.prototype.requestUpdate=D.prototype.Le=function(a){void 0===a&&(a=!1);if(!0!==this.Mf&&!(this.Rc||!1===a&&this.Xd)){this.Mf=!0;var b=this;requestAnimationFrame(function(){b.Mf&&b.Yf()})}};D.prototype.maybeUpdate=D.prototype.Yf=function(){if(!this.Go||this.Mf)this.Go&&(this.Go=!1),Ki(this)};function Wl(a,b){a.Pa.kf||a.Rc||!a.Am||Gl(a)||(b&&Ai(a),Kl(a,!1))}
function Ki(a){if(!a.Xd&&(a.Mf=!1,null!==a.Mb)){a.Xd=!0;var b=a.Pa,c=a.qz;if(!b.Ro&&0!==c.length){for(var d=c.n,e=d.length,f=0;f<e;f++){var h=d[f];Xl(h,!1);h.I()}c.clear()}c=a.FC;0<c.count&&(c.each(function(a){a.uB()}),c.clear());d=c=!1;b.kf&&(d=!0,c=a.wb,a.wb=!0);b.oc||Ak(a);Wl(a,!1);null!==a.nd&&(a.nd.visible&&!a.Av&&(Yl(a),a.Av=!0),!a.nd.visible&&a.Av&&(a.Av=!1));Ai(a);e=!1;if(!a.eh||a.bv)a.eh?Zl(a,!a.rv):(a.Tb("Initial Layout"),!1===b.isEnabled&&b.pi(),Zl(a,!1)),e=!0;a.rv=!1;Ai(a);a.zz||b.kf||
al(a);Wl(a,!0);e&&(a.eh||$l(a),a.Ba("LayoutCompleted"));Ai(a);e&&!a.eh&&(a.eh=!0,a.Fd("Initial Layout"),a.wb||a.oa.clear(),w.setTimeout(function(){a.ni=!1},1));am(a);zk(b);a.se(a.qf);d&&(a.wb=c);a.Xd=!1}}w.u(D,{Fn:null},function(){return this.eh});
function $l(a){var b=a.$b.n;a.Bf(b,b.length,a);a.el!==ih?a.scale=Ll(a,a.el):a.qm!==ih?a.scale=Ll(a,a.qm):(b=a.kI,isFinite(b)&&0<b&&(a.scale=b));b=a.jI;if(b.H())a.position=b;else{b=w.K();b.Vn(a.qe,a.iI);var c=a.sb,c=w.Vg(0,0,c.width,c.height),d=w.K();d.Vn(c,a.lI);d.l(b.x-d.x,b.y-d.y);a.position=d;w.Gb(c);w.v(d);w.v(b);Vl(a);Wl(a,!0);Kl(a,!0)}a.Ba("InitialLayoutCompleted");Yl(a)}
function Ai(a){if((a.Xd||!a.Pa.kf)&&0!==a.qg.count){for(var b=0;23>b;b++){var c=a.qg.i;if(null===c||0===a.qg.count)break;a.qg=new J(S);a.uB(c,a.qg)}a.dg.each(function(a){a instanceof U&&0!==(a.xa&65536)!==!1&&(a.xa^=65536)})}}
D.prototype.uB=function(a,b){for(a.reset();a.next();){var c=a.value;!c.de()||c instanceof U||(c.Yl()?(rk(c,Infinity,Infinity),c.gc()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof U&&c.isVisible()&&em(this,c);for(a.reset();a.next();)c=a.value,c instanceof W&&c.isVisible()&&(c.Yl()?(rk(c,Infinity,Infinity),c.gc()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof dh&&c.isVisible()&&(c.Yl()?(rk(c,Infinity,Infinity),c.gc()):b.add(c))};
function em(a,b){for(var c=w.lb(),d=w.lb(),e=b.Mc;e.next();){var f=e.value;f.isVisible()&&(f instanceof U?(ym(f)||zm(f)||Am(f))&&em(a,f):f instanceof W?f.W===b||f.$===b?d.push(f):c.push(f):(rk(f,Infinity,Infinity),f.gc()))}for(var e=c.length,h=0;h<e;h++)f=c[h],rk(f,Infinity,Infinity),f.gc();w.va(c);rk(b,Infinity,Infinity);b.gc();e=d.length;for(h=0;h<e;h++)f=d[h],rk(f,Infinity,Infinity),f.gc();w.va(d)}D.prototype.Bf=function(a,b,c,d){var e=this.Pa;if(this.fl||e.kf)for(e=0;e<b;e++)a[e].Bf(c,d)};
D.prototype.se=function(a,b){void 0===b&&(b=null);null===this.Mb&&w.k("No div specified");var c=this.Eb;null===c&&w.k("No canvas specified");var d=this.Pa;if(!d.oc&&(Bm(this),"0"!==this.Mb.style.opacity)){var e=a!==this.qf,f=this.$b.n,h=f.length,k=this;this.Bf(f,h,k);if(e)a.Ee(!0),Il(this);else if(!this.Be&&null===b&&!d.Vj)return;var h=this.hb,l=this.tb,m=Math.round(h.x*l)/l,n=Math.round(h.y*l)/l,d=this.cd;d.reset();1!==l&&d.scale(l);0===h.x&&0===h.y||d.translate(-m,-n);l=this.zd;w.Dn?(c.width=c.width,
a.Ee(!0),a.scale(l,l)):(a.setTransform(1,0,0,1,0,0),a.scale(l,l),a.clearRect(0,0,this.Ib,this.Lb));a.setTransform(1,0,0,1,0,0);a.scale(l,l);a.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);c=null!==b?function(c){var d=b;if(c.visible&&0!==c.vc){var e=c.zb.n,f=e.length;if(0!==f){1!==c.vc&&(a.globalAlpha=c.vc);c=c.gw;c.length=0;for(var h=k.scale,l=0;l<f;l++){var m=e[l];if(fl(m)&&!d.contains(m)){if(m instanceof W){var n=m;n.ic&&c.push(n);if(!1===n.Zg)continue}n=m.Y;1<n.width*h||1<n.height*h?m.se(a,k):hl(m,
a)}}a.globalAlpha=1}}}:function(b){b.se(a,k)};Cm(this,a);h=f.length;for(m=0;m<h;m++)a.setTransform(1,0,0,1,0,0),a.scale(l,l),a.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy),c(f[m]);this.dl?this.dl.km(this)&&this.uv():this.zr=function(){return new z(0,0)};e?(this.qf.Ee(!0),Il(this)):this.Be=this.fl=!1}};
function Dm(a,b,c,d,e){null===a.Mb&&w.k("No div specified");var f=a.Eb;null===f&&w.k("No canvas specified");if(!a.Pa.oc){var h=a.qf;if(a.Be){Bm(a);var k=a.zd;w.Dn?(f.width=f.width,h.Ee(!0)):(h.setTransform(1,0,0,1,0,0),h.clearRect(0,0,a.Ib*k,a.Lb*k));h.ey(!1);h.drawImage(a.Qy.Gd,0<d?0:Math.round(-d),0<e?0:Math.round(-e));e=a.hb;var f=a.tb,l=Math.round(e.x*f)/f,m=Math.round(e.y*f)/f;d=a.cd;d.reset();1!==f&&d.scale(f);0===e.x&&0===e.y||d.translate(-l,-m);h.save();h.beginPath();e=c.length;for(f=0;f<
e;f++)l=c[f],0!==l.width&&0!==l.height&&h.rect(Math.floor(l.x),Math.floor(l.y),Math.ceil(l.width),Math.ceil(l.height));h.clip();h.setTransform(1,0,0,1,0,0);h.scale(k,k);h.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);c=a.$b.n;e=c.length;a.Bf(c,e,a);Cm(a,h);for(f=0;f<e;f++)il(c[f],h,a,b);h.restore();h.Ee(!0);a.dl?a.dl.km(a)&&a.uv():a.zr=function(){return new z(0,0)};a.fl=!1;a.Be=!1;a.Tx()}}}
function Em(a,b,c,d,e,f,h,k,l,m){null===a.Mb&&w.k("No div specified");null===a.Eb&&w.k("No canvas specified");void 0===h&&(h=null);void 0===k&&(k=null);void 0===l&&(l=!1);void 0===m&&(m=!1);Bm(a);a.qf.Ee(!0);Il(a);a.fz=!0;var n=a.tb;a.tb=e;var p=a.$b.n,q=p.length;try{var r=new A(f.x,f.y,d.width/e,d.height/e),s=r.copy();s.Jw(c);Yl(a,s);Ai(a);a.Bf(p,q,a,r);var u=a.zd;b.setTransform(1,0,0,1,0,0);b.scale(u,u);b.clearRect(0,0,d.width,d.height);null!==k&&""!==k&&(b.fillStyle=k,b.fillRect(0,0,d.width,d.height));
var t=w.Ef();t.reset();t.translate(c.left,c.top);t.scale(e);0===f.x&&0===f.y||t.translate(-f.x,-f.y);b.setTransform(t.m11,t.m12,t.m21,t.m22,t.dx,t.dy);w.ue(t);Cm(a,b);var x;if(null!==h){var v=new J(S),B=h.i;for(B.reset();B.next();){var y=B.value;!1===m&&"Grid"===y.layer.name||null===y||v.add(y)}x=function(c){var d=l;if(c.visible&&0!==c.vc&&(void 0===d&&(d=!0),d||!c.Jc)){var d=c.zb.n,e=d.length;if(0!==e){1!==c.vc&&(b.globalAlpha=c.vc);c=c.gw;c.length=0;for(var f=a.scale,h=0;h<e;h++){var k=d[h];if(fl(k)&&
v.contains(k)){if(k instanceof W){var m=k;m.ic&&c.push(m);if(!1===m.Zg)continue}m=k.Y;1<m.width*f||1<m.height*f?k.se(b,a):hl(k,b)}}b.globalAlpha=1}}}}else if(!l&&m){var H=a.Bn.U,E=H.layer;x=function(c){c===E?H.se(b,a):c.se(b,a,l)}}else x=function(c){c.se(b,a,l)};for(c=0;c<q;c++)x(p[c]);a.fz=!1;a.dl?a.dl.km(a)&&a.uv():a.zr=function(){return new z(0,0)}}finally{a.tb=n,a.qf.Ee(!0),Il(a),a.Bf(p,q,a),Yl(a)}}D.prototype.getRenderingHint=D.prototype.oj=function(a){return this.gk[a]};
D.prototype.setRenderingHint=D.prototype.xJ=function(a,b){this.gk[a]=b;this.Sx()};D.prototype.resetRenderingHints=D.prototype.QF=function(){this.gk=new sa;this.gk.drawShadows=!0;this.gk.textGreeking=!0;this.gk.viewportOptimizations=w.iF?!1:!0;this.gk.temporaryPixelRatio=!0;this.gk.pictureRatioOptimization=!0};function Cm(a,b){var c=a.gk;null!==c&&(void 0!==c.imageSmoothingEnabled&&b.ey(!!c.imageSmoothingEnabled),c=c.defaultFont,void 0!==c&&null!==c&&(b.font=c))}
D.prototype.getInputOption=D.prototype.Ut=function(a){return this.Oo[a]};D.prototype.setInputOption=function(a,b){this.Oo[a]=b};D.prototype.resetInputOptions=D.prototype.PF=function(){this.Oo=new sa;this.Oo.extraTouchArea=10;this.Oo.extraTouchThreshold=10;this.Oo.hasGestureZoom=!0};D.prototype.setProperties=function(a){w.Fu(this,a)};function am(a){if(0===a.oa.Fh&&0!==a.Zk.count){for(;0<a.Zk.count;){var b=a.Zk;a.Zk=new ka(W,A);for(b=b.i;b.next();){var c=b.key;ej(c,b.value);c.Ke()}}a.na()}}
D.prototype.na=function(a){void 0===a&&(a=null);if(null===a)this.Be=!0,this.Le();else{var b=this.sb;null!==a&&a.H()&&b.Kg(a)&&(this.Be=!0,this.Le())}for(b=this.hw.i;b.next();)b.value.na(a)};
D.prototype.bF=function(a,b){if(!0!==this.Be){this.Be=!0;var c=!0===this.oj("temporaryPixelRatio");if(!0===this.oj("viewportOptimizations")&&this.WA!==Fm&&this.XF.ex(0,0,0,0)&&b.width===a.width&&b.height===a.height){var d=this.scale,e=w.Df(),f=Math.max(a.x,b.x),h=Math.max(a.y,b.y),k=Math.min(a.x+a.width,b.x+b.width),l=Math.min(a.y+a.height,b.y+b.height);e.x=f;e.y=h;e.width=Math.max(0,k-f)*d;e.height=Math.max(0,l-h)*d;if(0<e.width&&0<e.height){if(!this.Xd&&(this.Mf=!1,null!==this.Mb)){this.Xd=!0;am(this);
this.qe.H()||Nl(this,this.sh());var m=this.Eb;if(null!==m){var n=this.zd,h=this.Ib*n,k=this.Lb*n,f=this.scale*n,d=Math.round(Math.round(b.x*f)-Math.round(a.x*f)),f=Math.round(Math.round(b.y*f)-Math.round(a.y*f)),l=this.Qy,p=this.xC;l.width!==h&&(l.width=h);l.height!==k&&(l.height=k);p.clearRect(0,0,h,k);var l=190*this.zd,q=70*this.zd,r=Math.max(d,0),s=Math.max(f,0),u=Math.floor(h-r),t=Math.floor(k-s);p.ey(!1);p.drawImage(m.Gd,r,s,u,t,0,0,u,t);this.dl.km(this)&&p.clearRect(0,0,l,q);var m=w.lb(),p=
w.lb(),t=Math.abs(d),u=Math.abs(f),x=0===r?0:h-t,r=w.xb(x,0),t=w.xb(t+x,k);p.push(new A(Math.min(r.x,t.x),Math.min(r.y,t.y),Math.abs(r.x-t.x),Math.abs(r.y-t.y)));var v=this.cd;v.reset();v.scale(n,n);1!==this.tb&&v.scale(this.tb);n=this.hb;(0!==n.x||0!==n.y)&&isFinite(n.x)&&isFinite(n.y)&&v.translate(-n.x,-n.y);La(r,v);La(t,v);m.push(new A(Math.min(r.x,t.x),Math.min(r.y,t.y),Math.abs(r.x-t.x),Math.abs(r.y-t.y)));x=0===s?0:k-u;r.l(0,x);t.l(h,u+x);p.push(new A(Math.min(r.x,t.x),Math.min(r.y,t.y),Math.abs(r.x-
t.x),Math.abs(r.y-t.y)));La(r,v);La(t,v);m.push(new A(Math.min(r.x,t.x),Math.min(r.y,t.y),Math.abs(r.x-t.x),Math.abs(r.y-t.y)));this.dl.km(this)&&(h=0<d?0:-d,k=0<f?0:-f,r.l(h,k),t.l(l+h,q+k),p.push(new A(Math.min(r.x,t.x),Math.min(r.y,t.y),Math.abs(r.x-t.x),Math.abs(r.y-t.y))),La(r,v),La(t,v),m.push(new A(Math.min(r.x,t.x),Math.min(r.y,t.y),Math.abs(r.x-t.x),Math.abs(r.y-t.y))));w.v(r);w.v(t);Wl(this,!1);Dm(this,m,p,d,f);w.va(m);w.va(p);this.Xd=!1}}}else this.Yf();w.Gb(e);c&&(this.jk=1,this.Yf(),
this.jk=null,this.Tx())}else c?(this.jk=1,this.Yf(),this.jk=null,this.Tx()):this.Yf()}};function Vl(a){!1===a.Am&&(a.Am=!0)}function Il(a){!1===a.fl&&(a.fl=!0)}function Bm(a){!1!==a.Hr&&(a.Hr=!1,Gm(a,a.Ib,a.Lb))}function Gm(a,b,c){var d=a.Eb,e=a.zd,f=b*e,e=c*e;if(d.width!==f||d.height!==e)d.width=f,d.height=e,d.style.width=b+"px",d.style.height=c+"px",a.Be=!0,a.qf.Ee(!0)}
function Gl(a){var b=a.Eb;if(null===b)return!0;var c=a.Mb,d=a.Ib,e=a.Lb,f=a.UD.copy();if(!f.H())return!0;var h=!1,k=a.cl?a.Cd:0,l=a.Tj?a.Cd:0,m=c.clientWidth||d+k,n=c.clientHeight||e+l;if(m!==d+k||n!==e+l)a.cl=!1,a.Tj=!1,l=k=0,a.Ib=m,a.Lb=n,h=a.Hr=!0;a.Am=!1;var p=a.sb,c=a.qe,m=c.width,n=c.height,q=p.width,r=p.height,s=c.x,u=p.x,t=c.right,x=p.right+k,v=c.y,B=p.y,y=c.bottom,p=p.bottom+l,H="1px",E="1px",c=a.scale;a.WA===ol&&m<q+k&&n<r+l||(a.qA&&a.me&&(H=1,s+1<u&&(H=Math.max((u-s)*c+a.Ib,H)),t>x+1&&
(H=Math.max((t-x)*c+a.Ib,H)),q+k+1<m&&(H=Math.max((m-q+k)*c+a.Ib,H)),H=H.toString()+"px"),a.rA&&a.ne&&(k=1,v+1<B&&(k=Math.max((B-v)*c+a.Lb,k)),y>p+1&&(k=Math.max((y-p)*c+a.Lb,k)),r+l+1<n&&(k=Math.max((n-r+l)*c+a.Lb,k)),E=k.toString()+"px"));l="1px"!==H;k="1px"!==E;if(!(l&&k||!l&&!k)){k&&(x-=a.Cd);l&&(p-=a.Cd);a.qA&&a.me&&(H=1,s+1<u&&(H=Math.max((u-s)*c+a.Ib,H)),t>x+1&&(H=Math.max((t-x)*c+a.Ib,H)),q+1<m&&(H=Math.max((m-q)*c+a.Ib,H)),H=H.toString()+"px");var l="1px"!==H,V=l!==a.Tj?a.Lb-a.Cd:a.Lb;a.rA&&
a.ne&&(k=1,v+1<B&&(k=Math.max((B-v)*c+V,k)),y>p+1&&(k=Math.max((y-p)*c+V,k)),r+1<n&&(k=Math.max((n-r)*c+V,k)),E=k.toString()+"px");k="1px"!==E}if(a.ow&&l===a.Tj&&k===a.cl)return d===a.Ib&&e===a.Lb||a.Yf(),!1;l!==a.Tj&&(a.Lb="1px"===H?a.Lb+a.Cd:Math.max(a.Lb-a.Cd,1),h=!0);a.Tj=l;a.Qs.style.width=H;k!==a.cl&&(a.Ib="1px"===E?a.Ib+a.Cd:Math.max(a.Ib-a.Cd,1),h=!0,a.Lr&&(l=w.K(),k?(b.style.left=a.Cd+"px",a.position=l.l(a.hb.x+a.Cd/a.scale,a.hb.y)):(b.style.left="0px",a.position=l.l(a.hb.x-a.Cd/a.scale,
a.hb.y)),w.v(l)));a.cl=k;a.Qs.style.height=E;b=a.sw;l=b.scrollLeft;a.qA&&a.me&&(q+1<m?l=(a.position.x-s)*c:s+1<u?l=b.scrollWidth-b.clientWidth:t>x+1&&(l=a.position.x*c));if(a.Lr)switch(a.sz){case "negative":l=-(b.scrollWidth-l-b.clientWidth);break;case "reverse":l=b.scrollWidth-l-b.clientWidth}b.scrollLeft=l;a.rA&&a.ne&&(r+1<n?b.scrollTop=(a.position.y-v)*c:v+1<B?b.scrollTop=b.scrollHeight-b.clientHeight:y>p+1&&(b.scrollTop=a.position.y*c));h&&(a.Hr=!0);m=a.Ib;n=a.Lb;b.style.width=m+(a.cl?a.Cd:0)+
"px";b.style.height=n+(a.Tj?a.Cd:0)+"px";a.vz=!1;return d!==m||e!==n||a.Pa.oc?(p=a.sb,a.uu(f,p,c,a.scale,h),!1):!0}
D.prototype.add=D.prototype.add=function(a){w.G(a,S,D,"add:part");var b=a.g;if(b!==this){null!==b&&w.k("Cannot add part "+a.toString()+" to "+this.toString()+". It is already a part of "+b.toString());this.Fq&&(a.kl="Tool");var c=a.Wf,b=this.Lt(c);null===b&&(b=this.Lt(""));null===b&&w.k('Cannot add a Part when unable find a Layer named "'+c+'" and there is no default Layer');a.layer!==b&&(c=b.$p(99999999,a,a.g===this),0<=c&&this.Wc(Of,"parts",b,null,a,null,c),b.Jc||this.qc(),a.J(Hm),c=a.Dx,null!==
c&&c(a,null,b))}};
D.prototype.$p=function(a){if(a instanceof T){if(this.ep.add(a),a instanceof U){var b=a.Ka;null===b?this.wl.add(a):b.bp.add(a);b=a.Rb;null!==b&&(b.g=this)}}else a instanceof W?this.Yo.add(a):a instanceof dh||this.zb.add(a);var c=this;Im(a,function(a){Jm(c,a)});(a instanceof dh||a instanceof U&&null!==a.Kb)&&a.I();b=a.data;null!==b&&(a instanceof dh||(a instanceof W?this.Kj.add(b,a):this.Ai.add(b,a)),Im(a,function(a){Km(c,a)}));!0!==zm(a)&&!0!==Am(a)||this.qg.add(a);Lm(a,!0,this);Mm(a)?(a.Y.H()&&this.na(jl(a,
a.Y)),this.qc()):a.isVisible()&&a.Y.H()&&this.na(jl(a,a.Y));this.Le()};
D.prototype.jf=function(a){a.Ct();if(a instanceof T){if(this.ep.remove(a),a instanceof U){var b=a.Ka;null===b?this.wl.remove(a):b.bp.remove(a);b=a.Rb;null!==b&&(b.g=null)}}else a instanceof W?this.Yo.remove(a):a instanceof dh||this.zb.remove(a);var c=this;Im(a,function(a){Nm(c,a)});b=a.data;null!==b&&(a instanceof dh||(a instanceof W?this.Kj.remove(b):this.Ai.remove(b)),Im(a,function(a){Om(c,a)}));this.qg.remove(a);Mm(a)?(a.Y.H()&&this.na(jl(a,a.Y)),this.qc()):a.isVisible()&&a.Y.H()&&this.na(jl(a,
a.Y));this.Le()};D.prototype.remove=D.prototype.remove=function(a){w.G(a,S,D,"remove:part");Pm(this,a,!0)};function Pm(a,b,c){var d=b.layer;null!==d&&d.g===a&&(b.eb=!1,b.Lg=!1,b.J(Qm),c&&b.tn(),c=d.jf(-1,b,!1),0<=c&&a.Wc(Pf,"parts",d,b,null,c,null),a=b.Dx,null!==a&&a(b,d,null))}
D.prototype.removeParts=D.prototype.TA=function(a,b){if(w.isArray(a))for(var c=w.Ya(a),d=0;d<c;d++){var e=w.Da(a,d);b&&!e.canDelete()||this.remove(e)}else for(e=new J(S),e.Hc(a),c=e.i;c.next();)e=c.value,b&&!e.canDelete()||this.remove(e)};D.prototype.copyParts=D.prototype.Np=function(a,b,c){return this.ob.Np(a,b,c)};
D.prototype.moveParts=D.prototype.moveParts=function(a,b,c){w.G(b,z,D,"moveParts:offset");var d=this.ab;if(null!==d){d=d.re;null===d&&(d=new hh,d.Pc(this));var e=new ka(S);if(null!==a)a=a.i;else{for(a=this.Hk;a.next();)Mh(d,e,a.value,c);for(a=this.dg;a.next();)Mh(d,e,a.value,c);a=this.links}for(;a.next();)Mh(d,e,a.value,c);d.moveParts(e,b,c)}};
function Rm(a,b,c){w.G(b,mg,D,"addLayer:layer");null!==b.g&&b.g!==a&&w.k("Cannot share a Layer with another Diagram: "+b+" of "+b.g);null===c?null!==b.g&&w.k("Cannot add an existing Layer to this Diagram again: "+b):(w.G(c,mg,D,"addLayer:existingLayer"),c.g!==a&&w.k("Existing Layer must be in this Diagram: "+c+" not in "+c.g),b===c&&w.k("Cannot move a Layer before or after itself: "+b));if(b.g!==a){b=b.name;a=a.$b;c=a.count;for(var d=0;d<c;d++)a.da(d).name===b&&w.k("Cannot add Layer with the name '"+
b+"'; a Layer with the same name is already present in this Diagram.")}}D.prototype.addLayer=D.prototype.ut=function(a){Rm(this,a,null);a.Pc(this);var b=this.$b,c=b.count-1;if(!a.Jc)for(;0<=c&&b.da(c).Jc;)c--;b.Ld(c+1,a);null!==this.ke&&this.Wc(Of,"layers",this,null,a,null,c+1);this.na();this.qc()};
D.prototype.addLayerBefore=D.prototype.ZG=function(a,b){Rm(this,a,b);a.Pc(this);var c=this.$b,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.ke&&this.Wc(Pf,"layers",this,a,null,d,null));for(var e=c.count,f=0;f<e;f++)if(c.da(f)===b){c.Ld(f,a);break}null!==this.ke&&this.Wc(Of,"layers",this,null,a,null,f);this.na();0>d&&this.qc()};
D.prototype.addLayerAfter=function(a,b){Rm(this,a,b);a.Pc(this);var c=this.$b,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.ke&&this.Wc(Pf,"layers",this,a,null,d,null));for(var e=c.count,f=0;f<e;f++)if(c.da(f)===b){c.Ld(f+1,a);break}null!==this.ke&&this.Wc(Of,"layers",this,null,a,null,f+1);this.na();0>d&&this.qc()};
D.prototype.removeLayer=function(a){w.G(a,mg,D,"removeLayer:layer");a.g!==this&&w.k("Cannot remove a Layer from another Diagram: "+a+" of "+a.g);if(""!==a.name){var b=this.$b,c=b.indexOf(a);if(b.remove(a)){for(b=a.zb.copy().i;b.next();){var d=b.value,e=d.Wf;d.Wf=e!==a.name?e:""}null!==this.ke&&this.Wc(Pf,"layers",this,a,null,c,null);this.na();this.qc()}}};D.prototype.findLayer=D.prototype.Lt=function(a){for(var b=this.Ex;b.next();){var c=b.value;if(c.name===a)return c}return null};
D.prototype.addModelChangedListener=D.prototype.aH=function(a){w.j(a,"function",D,"addModelChangedListener:listener");null===this.gh&&(this.gh=new I("function"));this.gh.add(a);this.ba.fn(a)};D.prototype.removeModelChangedListener=function(a){w.j(a,"function",D,"removeModelChangedListener:listener");null!==this.gh&&(this.gh.remove(a),0===this.gh.count&&(this.gh=null));this.ba.xu(a)};
D.prototype.addChangedListener=D.prototype.fn=function(a){w.j(a,"function",D,"addChangedListener:listener");null===this.vi&&(this.vi=new I("function"));this.vi.add(a)};D.prototype.removeChangedListener=D.prototype.xu=function(a){w.j(a,"function",D,"removeChangedListener:listener");null!==this.vi&&(this.vi.remove(a),0===this.vi.count&&(this.vi=null))};
D.prototype.Rw=function(a){this.wb||this.oa.XE(a);a.xc!==Nf&&(this.ni=!0);if(null!==this.vi){var b=this.vi,c=b.length;if(1===c)b=b.da(0),b(a);else if(0!==c)for(var d=b.dc(),e=0;e<c;e++)b=d[e],b(a)}};D.prototype.raiseChangedEvent=D.prototype.Wc=function(a,b,c,d,e,f,h){void 0===f&&(f=null);void 0===h&&(h=null);var k=new Lf;k.g=this;k.xc=a;k.propertyName=b;k.object=c;k.oldValue=d;k.zj=f;k.newValue=e;k.yj=h;this.Rw(k)};
D.prototype.raiseChanged=D.prototype.h=function(a,b,c,d,e){this.Wc(Mf,a,this,b,c,d,e)};w.u(D,{Pa:"animationManager"},function(){return this.KB});w.u(D,{oa:"undoManager"},function(){return this.ke.oa});w.defineProperty(D,{wb:"skipsUndoManager"},function(){return this.cj},function(a){w.j(a,"boolean",D,"skipsUndoManager");this.cj=a;this.ke.cj=a});w.defineProperty(D,{$z:"delaysLayout"},function(){return this.My},function(a){this.My=a});
D.prototype.ln=function(a,b){if(null!==a&&a.g===this){var c=this.Ne;try{this.Ne=!0;var d=a.xc,e;if(d===Mf){var f=a.object,h=a.propertyName,k=a.ka(b);w.Ma(f,h,k);if(f instanceof G){var l,m=f.U;null!==m&&m.ce()}this.ni=!0}else if(d===Of){var n=a.object,p=a.yj,f=a.newValue;if(n instanceof C)if("number"===typeof p&&f instanceof G){l=f;var q=n;b?q.jf(p):q.Ld(p,l);m=n.U;null!==m&&m.ce()}else{if("number"===typeof p&&f instanceof Pg){var r=f,q=n;b?r.ve?q.OF(p):q.LF(p):(e=r.ve?q.be(r.index):q.ae(r.index),
e.Mp(r))}}else if(n instanceof mg){var s=!0===a.zj;if("number"===typeof p&&f instanceof S){var m=f,u=n;b?(m.eb=!1,m.Lg=!1,m.ce(),u.jf(s?p:-1,m,s)):u.$p(p,m,s)}}else if(n instanceof D){if("number"===typeof p&&f instanceof mg){var t=f;b?this.$b.Xc(p):(d=t,d.Pc(this),this.$b.Ld(p,d))}}else w.k("unknown ChangedEvent.Insert object: "+a.toString());this.ni=!0}else d===Pf?(n=a.object,p=a.zj,f=a.oldValue,n instanceof C?"number"===typeof p&&f instanceof G?(q=n,b?q.Ld(p,f):q.jf(p)):"number"===typeof p&&f instanceof
Pg&&(r=f,q=n,b?(e=r.ve?q.be(r.index):q.ae(r.index),e.Mp(r)):r.ve?q.OF(p):q.LF(p)):n instanceof mg?(s=!0===a.yj,"number"===typeof p&&f instanceof S&&(m=f,u=n,b?u.$p(p,m,s):(m.eb=!1,m.Lg=!1,m.ce(),u.jf(s?p:-1,m,s)))):n instanceof D?"number"===typeof p&&f instanceof mg&&(t=f,b?(d=t,d.Pc(this),this.$b.Ld(p,d)):this.$b.Xc(p)):w.k("unknown ChangedEvent.Remove object: "+a.toString()),this.ni=!0):d!==Nf&&w.k("unknown ChangedEvent: "+a.toString())}finally{this.Ne=c}}};
D.prototype.startTransaction=D.prototype.Tb=function(a){return this.oa.Tb(a)};D.prototype.commitTransaction=D.prototype.Fd=function(a){return this.oa.Fd(a)};D.prototype.rollbackTransaction=D.prototype.nq=function(){return this.oa.nq()};D.prototype.updateAllTargetBindings=D.prototype.uG=function(a){void 0===a&&(a="");for(var b=this.Hk;b.next();)b.value.Hb(a);for(b=this.dg;b.next();)b.value.Hb(a);for(b=this.links;b.next();)b.value.Hb(a)};
D.prototype.updateAllRelationshipsFromData=D.prototype.PJ=function(){for(var a=this.ba,b=new J,c=a.cg,d=0;d<c.length;d++){var e=c[d];b.add(e)}var f=[];this.dg.each(function(a){null===a.data||b.contains(a.data)||f.push(a.data)});this.Hk.each(function(a){null===a.data||b.contains(a.data)||f.push(a.data)});f.forEach(function(b){vg(a,b,!1)});for(d=0;d<c.length;d++){var e=c[d],h=this.vh(e);null===h&&ug(a,e,!1)}if(a instanceof P){for(var k=new J,c=a.Mg,d=0;d<c.length;d++)e=c[d],k.add(e);var l=[];this.links.each(function(a){null===
a.data||k.contains(a.data)||l.push(a.data)});l.forEach(function(b){Ug(a,b,!1)});for(d=0;d<c.length;d++)e=c[d],h=this.Qf(e),null===h&&Tg(a,e,!1)}for(d=this.Hk;d.next();)h=d.value,h.updateRelationshipsFromData();for(d=this.dg;d.next();)d.value.updateRelationshipsFromData();for(d=this.links;d.next();)h=d.value,h.updateRelationshipsFromData()};
function Sm(a,b,c){if(a.Rc||a.Xd)a.tb=c,c=a.Pa,c.oc&&el(c,b,a.tb);else if(a.Rc=!0,null===a.Eb)a.tb=c;else{var d=a.sb.copy(),e=a.Ib,f=a.Lb;d.width=a.Ib/b;d.height=a.Lb/b;var h=a.lm.x,k=a.lm.y,l=a.qE;isNaN(h)&&(l.sj()?l.qj(Tb)?h=0:l.qj(Ub)&&(h=e-1):h=l.fd()?l.x*(e-1):e/2);isNaN(k)&&(l.sj()?l.qj(Sb)?k=0:l.qj(Vb)&&(k=f-1):k=l.fd()?l.y*(f-1):f/2);null!==a.WF&&(c=a.WF(a,c));c<a.yh&&(c=a.yh);c>a.xh&&(c=a.xh);e=w.xb(a.hb.x+h/b-h/c,a.hb.y+k/b-k/c);a.position=e;w.v(e);a.tb=c;a.uu(d,a.sb,b,c,!1);a.Rc=!1;Kl(a,
!1);c=a.Pa;c.oc&&el(c,b,a.tb);a.na();Vl(a)}}D.prototype.uu=function(a,b,c,d,e){a.L(b)||(void 0===e&&(e=!1),e||Vl(this),Il(this),d=this.Rb,null===d||!d.Ax||this.Fl!==ih||e||a.width===b.width&&a.height===b.height||d.J(),d=this.Za,!0===this.Cm&&d instanceof bh&&(this.R.ca=this.rB(this.R.bf),vk(d,this)),this.Rc||this.bF(a,b),Yl(this),this.nh.scale=c,this.nh.position.x=a.x,this.nh.position.y=a.y,this.nh.bounds.set(a),this.nh.isScroll=e,this.Ba("ViewportBoundsChanged",this.nh,a))};
function Yl(a,b){void 0===b&&(b=null);var c=a.nd;if(null!==c&&c.visible){for(var d=w.im(),e=1,f=1,h=c.wa.n,k=h.length,l=0;l<k;l++){var m=h[l],n=m.interval;2>n||(Tm(m.Cb)?f=f*n/De(f,n):e=e*n/De(e,n))}h=c.px;d.l(f*h.width,e*h.height);h=f=l=k=0;if(null!==b)k=b.width,l=b.height,f=b.x,h=b.y;else{e=w.Df();f=a.sb;e.l(f.x,f.y,f.width,f.height);for(h=a.hw.i;h.next();)f=h.value.sb,f.H()&&bb(e,f.x,f.y,f.width,f.height);if(!e.H()){w.Gb(e);return}k=e.width;l=e.height;f=e.x;h=e.y;w.Gb(e)}c.width=k+2*d.width;c.height=
l+2*d.height;e=w.K();Ka(f,h,0,0,d.width,d.height,e);e.offset(-d.width,-d.height);w.zk(d);c.U.location=e;w.v(e)}}D.prototype.clearSelection=D.prototype.Sw=function(){var a=0<this.selection.count;a&&this.Ba("ChangingSelection");gh(this);a&&this.Ba("ChangedSelection")};function gh(a){a=a.selection;if(0<a.count){for(var b=a.dc(),c=b.length,d=0;d<c;d++)b[d].eb=!1;a.Ra();a.clear();a.freeze()}}
D.prototype.select=D.prototype.select=function(a){null!==a&&(w.G(a,S,D,"select:part"),a.layer.g===this&&(!a.eb||1<this.selection.count)&&(this.Ba("ChangingSelection"),gh(this),a.eb=!0,this.Ba("ChangedSelection")))};
D.prototype.selectCollection=D.prototype.$F=function(a){this.Ba("ChangingSelection");gh(this);if(w.isArray(a))for(var b=w.Ya(a),c=0;c<b;c++){var d=w.Da(a,c);d instanceof S||w.k("Diagram.selectCollection given something that is not a Part: "+d);d.eb=!0}else for(a=a.i;a.next();)d=a.value,d instanceof S||w.k("Diagram.selectCollection given something that is not a Part: "+d),d.eb=!0;this.Ba("ChangedSelection")};
D.prototype.clearHighlighteds=D.prototype.jH=function(){var a=this.Ul;if(0<a.count){for(var b=a.dc(),c=b.length,d=0;d<c;d++)b[d].Lg=!1;a.Ra();a.clear();a.freeze()}};D.prototype.highlight=function(a){null!==a&&a.layer.g===this&&(w.G(a,S,D,"highlight:part"),!a.Lg||1<this.Ul.count)&&(this.jH(),a.Lg=!0)};
D.prototype.highlightCollection=function(a){for(var b=(new J(S)).Hc(a),c=this.Ul.copy().Vx(b).i;c.next();)a=c.value,a.Lg=!1;for(b=b.i;b.next();)a=b.value,a instanceof S||w.k("Diagram.highlightCollection given something that is not a Part: "+a),a.Lg=!0};
D.prototype.scroll=D.prototype.scroll=function(a,b,c){void 0===c&&(c=1);var d="up"===b||"down"===b,e=0;if("pixel"===a)e=c;else if("line"===a)e=c*(d?this.Du:this.Cu);else if("page"===a)a=d?this.sb.height:this.sb.width,a*=this.scale,0!==a&&(e=Math.max(a-(d?this.Du:this.Cu),0),e*=c);else{if("document"===a){e=this.qe;d=this.sb;c=w.K();"up"===b?this.position=c.l(d.x,e.y):"left"===b?this.position=c.l(e.x,d.y):"down"===b?this.position=c.l(d.x,e.bottom-d.height):"right"===b&&(this.position=c.l(e.right-d.width,
d.y));w.v(c);return}w.k("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+a)}e/=this.scale;c=this.position.copy();"up"===b?c.y=this.position.y-e:"down"===b?c.y=this.position.y+e:"left"===b?c.x=this.position.x-e:"right"===b?c.x=this.position.x+e:w.k("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+b);this.position=c};D.prototype.scrollToRect=D.prototype.sJ=function(a){var b=this.sb;b.vk(a)||(a=a.Gl,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};
D.prototype.centerRect=D.prototype.iH=function(a){var b=this.sb;a=a.Gl;a.x-=b.width/2;a.y-=b.height/2;this.position=a};D.prototype.transformDocToView=D.prototype.rG=function(a){var b=this.cd;b.reset();1!==this.tb&&b.scale(this.tb);var c=this.hb;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return a.copy().transform(this.cd)};
D.prototype.transformViewToDoc=D.prototype.rB=function(a){var b=this.cd;b.reset();1!==this.tb&&b.scale(this.tb);var c=this.hb;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return La(a.copy(),this.cd)};var ih;D.None=ih=w.p(D,"None",0);var Ol;D.Uniform=Ol=w.p(D,"Uniform",1);var Pl;D.UniformToFill=Pl=w.p(D,"UniformToFill",2);var Oi;D.CycleAll=Oi=w.p(D,"CycleAll",10);var Si;D.CycleNotDirected=Si=w.p(D,"CycleNotDirected",11);var Ui;
D.CycleNotDirectedFast=Ui=w.p(D,"CycleNotDirectedFast",12);var Vi;D.CycleNotUndirected=Vi=w.p(D,"CycleNotUndirected",13);var Pi;D.CycleDestinationTree=Pi=w.p(D,"CycleDestinationTree",14);var Ri;D.CycleSourceTree=Ri=w.p(D,"CycleSourceTree",15);var ol;D.DocumentScroll=ol=w.p(D,"DocumentScroll",1);var Fm;D.InfiniteScroll=Fm=w.p(D,"InfiniteScroll",2);var ql;D.TreeParentCollapsed=ql=w.p(D,"TreeParentCollapsed",21);var Um;D.AllParentsCollapsed=Um=w.p(D,"AllParentsCollapsed",22);var Vm;
D.AnyParentsCollapsed=Vm=w.p(D,"AnyParentsCollapsed",23);w.defineProperty(D,{QJ:"validCycle"},function(){return this.Fw},function(a){var b=this.Fw;b!==a&&(w.mb(a,D,D,"validCycle"),this.Fw=a,this.h("validCycle",b,a))});w.u(D,{Ex:"layers"},function(){return this.$b.i});w.defineProperty(D,{xf:"isModelReadOnly"},function(){var a=this.ke;return null===a?!1:a.cb},function(a){var b=this.ke;null!==b&&(b.cb=a)});
w.defineProperty(D,{cb:"isReadOnly"},function(){return this.Ji},function(a){var b=this.Ji;b!==a&&(w.j(a,"boolean",D,"isReadOnly"),this.Ji=a,this.h("isReadOnly",b,a))});w.defineProperty(D,{isEnabled:"isEnabled"},function(){return this.cf},function(a){var b=this.cf;b!==a&&(w.j(a,"boolean",D,"isEnabled"),this.cf=a,this.h("isEnabled",b,a))});
w.defineProperty(D,{Mz:"allowClipboard"},function(){return this.Tu},function(a){var b=this.Tu;b!==a&&(w.j(a,"boolean",D,"allowClipboard"),this.Tu=a,this.h("allowClipboard",b,a))});w.defineProperty(D,{sk:"allowCopy"},function(){return this.Kk},function(a){var b=this.Kk;b!==a&&(w.j(a,"boolean",D,"allowCopy"),this.Kk=a,this.h("allowCopy",b,a))});
w.defineProperty(D,{gn:"allowDelete"},function(){return this.Lk},function(a){var b=this.Lk;b!==a&&(w.j(a,"boolean",D,"allowDelete"),this.Lk=a,this.h("allowDelete",b,a))});w.defineProperty(D,{zt:"allowDragOut"},function(){return this.Uu},function(a){var b=this.Uu;b!==a&&(w.j(a,"boolean",D,"allowDragOut"),this.Uu=a,this.h("allowDragOut",b,a))});
w.defineProperty(D,{eE:"allowDrop"},function(){return this.Vu},function(a){var b=this.Vu;b!==a&&(w.j(a,"boolean",D,"allowDrop"),this.Vu=a,this.h("allowDrop",b,a))});w.defineProperty(D,{Ow:"allowTextEdit"},function(){return this.Uk},function(a){var b=this.Uk;b!==a&&(w.j(a,"boolean",D,"allowTextEdit"),this.Uk=a,this.h("allowTextEdit",b,a))});
w.defineProperty(D,{Lw:"allowGroup"},function(){return this.Mk},function(a){var b=this.Mk;b!==a&&(w.j(a,"boolean",D,"allowGroup"),this.Mk=a,this.h("allowGroup",b,a))});w.defineProperty(D,{Pw:"allowUngroup"},function(){return this.Vk},function(a){var b=this.Vk;b!==a&&(w.j(a,"boolean",D,"allowUngroup"),this.Vk=a,this.h("allowUngroup",b,a))});
w.defineProperty(D,{Ep:"allowInsert"},function(){return this.Xu},function(a){var b=this.Xu;b!==a&&(w.j(a,"boolean",D,"allowInsert"),this.Xu=a,this.h("allowInsert",b,a))});w.defineProperty(D,{At:"allowLink"},function(){return this.Nk},function(a){var b=this.Nk;b!==a&&(w.j(a,"boolean",D,"allowLink"),this.Nk=a,this.h("allowLink",b,a))});
w.defineProperty(D,{hn:"allowRelink"},function(){return this.Pk},function(a){var b=this.Pk;b!==a&&(w.j(a,"boolean",D,"allowRelink"),this.Pk=a,this.h("allowRelink",b,a))});w.defineProperty(D,{Dl:"allowMove"},function(){return this.Ok},function(a){var b=this.Ok;b!==a&&(w.j(a,"boolean",D,"allowMove"),this.Ok=a,this.h("allowMove",b,a))});
w.defineProperty(D,{Mw:"allowReshape"},function(){return this.Qk},function(a){var b=this.Qk;b!==a&&(w.j(a,"boolean",D,"allowReshape"),this.Qk=a,this.h("allowReshape",b,a))});w.defineProperty(D,{Bt:"allowResize"},function(){return this.Rk},function(a){var b=this.Rk;b!==a&&(w.j(a,"boolean",D,"allowResize"),this.Rk=a,this.h("allowResize",b,a))});
w.defineProperty(D,{Nw:"allowRotate"},function(){return this.Sk},function(a){var b=this.Sk;b!==a&&(w.j(a,"boolean",D,"allowRotate"),this.Sk=a,this.h("allowRotate",b,a))});w.defineProperty(D,{tf:"allowSelect"},function(){return this.Tk},function(a){var b=this.Tk;b!==a&&(w.j(a,"boolean",D,"allowSelect"),this.Tk=a,this.h("allowSelect",b,a))});
w.defineProperty(D,{fE:"allowUndo"},function(){return this.Yu},function(a){var b=this.Yu;b!==a&&(w.j(a,"boolean",D,"allowUndo"),this.Yu=a,this.h("allowUndo",b,a))});w.defineProperty(D,{Qw:"allowZoom"},function(){return this.$u},function(a){var b=this.$u;b!==a&&(w.j(a,"boolean",D,"allowZoom"),this.$u=a,this.h("allowZoom",b,a))});
w.defineProperty(D,{rA:"hasVerticalScrollbar"},function(){return this.Ev},function(a){var b=this.Ev;b!==a&&(w.j(a,"boolean",D,"hasVerticalScrollbar"),this.Ev=a,Vl(this),this.na(),this.h("hasVerticalScrollbar",b,a),Kl(this,!1))});w.defineProperty(D,{qA:"hasHorizontalScrollbar"},function(){return this.Dv},function(a){var b=this.Dv;b!==a&&(w.j(a,"boolean",D,"hasHorizontalScrollbar"),this.Dv=a,Vl(this),this.na(),this.h("hasHorizontalScrollbar",b,a),Kl(this,!1))});
w.defineProperty(D,{me:"allowHorizontalScroll"},function(){return this.Wu},function(a){var b=this.Wu;b!==a&&(w.j(a,"boolean",D,"allowHorizontalScroll"),this.Wu=a,this.h("allowHorizontalScroll",b,a),Kl(this,!1))});w.defineProperty(D,{ne:"allowVerticalScroll"},function(){return this.Zu},function(a){var b=this.Zu;b!==a&&(w.j(a,"boolean",D,"allowVerticalScroll"),this.Zu=a,this.h("allowVerticalScroll",b,a),Kl(this,!1))});
w.defineProperty(D,{Cu:"scrollHorizontalLineChange"},function(){return this.pw},function(a){var b=this.pw;b!==a&&(w.j(a,"number",D,"scrollHorizontalLineChange"),0>a&&w.Ea(a,">= 0",D,"scrollHorizontalLineChange"),this.pw=a,this.h("scrollHorizontalLineChange",b,a))});
w.defineProperty(D,{Du:"scrollVerticalLineChange"},function(){return this.tw},function(a){var b=this.tw;b!==a&&(w.j(a,"number",D,"scrollVerticalLineChange"),0>a&&w.Ea(a,">= 0",D,"scrollVerticalLineChange"),this.tw=a,this.h("scrollVerticalLineChange",b,a))});w.defineProperty(D,{R:"lastInput"},function(){return this.Pb},function(a){this.Pb=a});w.defineProperty(D,{zc:"firstInput"},function(){return this.Hi},function(a){this.Hi=a});
w.defineProperty(D,{bc:"currentCursor"},function(){return this.kv},function(a){""===a&&(a=this.jr);var b=this.kv;if(b!==a){w.j(a,"string",D,"currentCursor");var c=this.Eb,d=this.Mb;null!==c&&(this.kv=a,c.style.cursor=a,d.style.cursor=a,c.style.cursor===b&&(c.style.cursor="-webkit-"+a,d.style.cursor="-webkit-"+a,c.style.cursor===b&&(c.style.cursor="-moz-"+a,d.style.cursor="-moz-"+a,c.style.cursor===b&&(c.style.cursor=a,d.style.cursor=a))))}});
w.defineProperty(D,{CK:"defaultCursor"},function(){return this.jr},function(a){""===a&&(a="auto");var b=this.jr;b!==a&&(w.j(a,"string",D,"defaultCursor"),this.jr=a,this.h("defaultCursor",b,a))});w.defineProperty(D,{click:"click"},function(){return this.wi},function(a){var b=this.wi;b!==a&&(null!==a&&w.j(a,"function",D,"click"),this.wi=a,this.h("click",b,a))});
w.defineProperty(D,{Ht:"doubleClick"},function(){return this.Ei},function(a){var b=this.Ei;b!==a&&(null!==a&&w.j(a,"function",D,"doubleClick"),this.Ei=a,this.h("doubleClick",b,a))});w.defineProperty(D,{Uz:"contextClick"},function(){return this.yi},function(a){var b=this.yi;b!==a&&(null!==a&&w.j(a,"function",D,"contextClick"),this.yi=a,this.h("contextClick",b,a))});
w.defineProperty(D,{JA:"mouseOver"},function(){return this.Vi},function(a){var b=this.Vi;b!==a&&(null!==a&&w.j(a,"function",D,"mouseOver"),this.Vi=a,this.h("mouseOver",b,a))});w.defineProperty(D,{IA:"mouseHover"},function(){return this.Ui},function(a){var b=this.Ui;b!==a&&(null!==a&&w.j(a,"function",D,"mouseHover"),this.Ui=a,this.h("mouseHover",b,a))});
w.defineProperty(D,{HA:"mouseHold"},function(){return this.Ti},function(a){var b=this.Ti;b!==a&&(null!==a&&w.j(a,"function",D,"mouseHold"),this.Ti=a,this.h("mouseHold",b,a))});w.defineProperty(D,{VI:"mouseDragOver"},function(){return this.bw},function(a){var b=this.bw;b!==a&&(null!==a&&w.j(a,"function",D,"mouseDragOver"),this.bw=a,this.h("mouseDragOver",b,a))});
w.defineProperty(D,{GA:"mouseDrop"},function(){return this.Si},function(a){var b=this.Si;b!==a&&(null!==a&&w.j(a,"function",D,"mouseDrop"),this.Si=a,this.h("mouseDrop",b,a))});w.defineProperty(D,{nB:"toolTip"},function(){return this.dj},function(a){var b=this.dj;b!==a&&(this.dj=a,this.h("toolTip",b,a))});w.defineProperty(D,{contextMenu:"contextMenu"},function(){return this.zi},function(a){var b=this.zi;b!==a&&(this.zi=a,this.h("contextMenu",b,a))});
w.defineProperty(D,{ob:"commandHandler"},function(){return this.Fy},function(a){var b=this.Fy;b!==a&&(w.G(a,og,D,"commandHandler"),null!==a.g&&w.k("Cannot share CommandHandlers between Diagrams: "+a.toString()),null!==b&&b.Pc(null),this.Fy=a,a.Pc(this))});w.defineProperty(D,{ab:"toolManager"},function(){return this.Ez},function(a){var b=this.Ez;b!==a&&(w.G(a,bh,D,"toolManager"),null!==a.g&&w.k("Cannot share ToolManagers between Diagrams: "+a.toString()),null!==b&&b.Pc(null),this.Ez=a,a.Pc(this))});
w.defineProperty(D,{Ft:"defaultTool"},function(){return this.Ly},function(a){var b=this.Ly;b!==a&&(w.G(a,ng,D,"defaultTool"),this.Ly=a,this.Za===b&&(this.Za=a))});w.defineProperty(D,{Za:"currentTool"},function(){return this.Iy},function(a){var b=this.Iy;null!==b&&(b.sa&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.Ft);null!==a&&(w.G(a,ng,D,"currentTool"),this.Iy=a,a.Pc(this),a.doStart())});w.u(D,{selection:"selection"},function(){return this.vw});
w.defineProperty(D,{LI:"maxSelectionCount"},function(){return this.Yv},function(a){var b=this.Yv;if(b!==a)if(w.j(a,"number",D,"maxSelectionCount"),0<=a&&!isNaN(a)){if(this.Yv=a,this.h("maxSelectionCount",b,a),!this.oa.fb&&(a=this.selection.count-a,0<a)){this.Ba("ChangingSelection");for(var b=this.selection.dc(),c=0;c<a;c++)b[c].eb=!1;this.Ba("ChangedSelection")}}else w.Ea(a,">= 0",D,"maxSelectionCount")});
w.defineProperty(D,{YI:"nodeSelectionAdornmentTemplate"},function(){return this.cw},function(a){var b=this.cw;b!==a&&(w.G(a,dh,D,"nodeSelectionAdornmentTemplate"),this.cw=a,this.h("nodeSelectionAdornmentTemplate",b,a))});w.defineProperty(D,{bI:"groupSelectionAdornmentTemplate"},function(){return this.Bv},function(a){var b=this.Bv;b!==a&&(w.G(a,dh,D,"groupSelectionAdornmentTemplate"),this.Bv=a,this.h("groupSelectionAdornmentTemplate",b,a))});
w.defineProperty(D,{FI:"linkSelectionAdornmentTemplate"},function(){return this.Tv},function(a){var b=this.Tv;b!==a&&(w.G(a,dh,D,"linkSelectionAdornmentTemplate"),this.Tv=a,this.h("linkSelectionAdornmentTemplate",b,a))});w.u(D,{Ul:"highlighteds"},function(){return this.Fv});
w.defineProperty(D,{ni:"isModified"},function(){var a=this.oa;return a.isEnabled?null!==a.kj?!0:this.Mv&&this.dh!==a.pj:this.Mv},function(a){if(this.Mv!==a){w.j(a,"boolean",D,"isModified");this.Mv=a;var b=this.oa;!a&&b.isEnabled&&(this.dh=b.pj);a||Wm(this)}});function Wm(a){var b=a.ni;a.VD!==b&&(a.VD=b,a.Ba("Modified"))}
w.defineProperty(D,{ba:"model"},function(){return this.ke},function(a){var b=this.ke;if(b!==a){w.G(a,F,D,"model");this.Za.doCancel();null!==b&&b.oa!==a.oa&&b.oa.jF&&w.k("Do not replace a Diagram.model while a transaction is in progress.");this.Pa.pi();this.Sw();this.eh=!1;this.Go=!0;this.dh=-2;this.Mf=!1;var c=this.Xd;this.Xd=!0;this.Pa.Sn("Model");null!==b&&(null!==this.gh&&this.gh.each(function(a){b.xu(a)}),b.xu(this.aD),b instanceof P&&Xm(this,b.Mg),Xm(this,b.cg));this.ke=a;a.fn(this.$C);Ym(this,
a.cg);a instanceof P&&Zm(this,a.Mg);a.xu(this.$C);a.fn(this.aD);null!==this.gh&&this.gh.each(function(b){a.fn(b)});this.Xd=c;this.Rc||this.na();null!==b&&(a.oa.isEnabled=b.oa.isEnabled)}});w.defineProperty(D,{Ua:null},function(){return this.SC},function(a){this.SC=a});w.u(D,{Hx:null},function(){return this.GG});
function sl(a,b){if(b.ba===a.ba){var c=b.xc,d=b.propertyName;if(c===Nf&&"S"===d[0])if("StartingFirstTransaction"===d)c=a.ab,c.af.each(function(b){b.Pc(a)}),c.Zf.each(function(b){b.Pc(a)}),c.$f.each(function(b){b.Pc(a)}),a.Xd||a.eh||(a.rv=!0,a.Go&&(a.Mf=!0));else if("StartingUndo"===d||"StartingRedo"===d){var e=a.Pa;e.kf&&!a.wb&&e.pi();a.Ba("ChangingSelection")}else"StartedTransaction"===d&&(e=a.Pa,e.kf&&!a.wb&&e.pi());else if(a.Ua){a.Ua=!1;try{var f=b.nf;if(""!==f)if(c===Mf){if("linkFromKey"===f){var h=
b.object,k=a.Qf(h);if(null!==k){var l=b.newValue,m=a.Ie(l);k.W=m}}else if("linkToKey"===f)h=b.object,k=a.Qf(h),null!==k&&(l=b.newValue,m=a.Ie(l),k.$=m);else if("linkFromPortId"===f){if(h=b.object,k=a.Qf(h),null!==k){var n=b.newValue;"string"===typeof n&&(k.Jg=n)}}else if("linkToPortId"===f)h=b.object,k=a.Qf(h),null!==k&&(n=b.newValue,"string"===typeof n&&(k.Eh=n));else if("nodeGroupKey"===f){var h=b.object,p=a.vh(h);if(null!==p){var q=b.newValue;if(void 0!==q){var r=a.Ie(q);p.Ka=r instanceof U?r:
null}else p.Ka=null}}else if("linkLabelKeys"===f){if(h=b.object,k=a.Qf(h),null!==k){var s=b.oldValue,u=b.newValue;if(w.isArray(s))for(var t=w.Ya(s),x=0;x<t;x++){var v=w.Da(s,x),m=a.Ie(v);null!==m&&(m.Lc=null)}if(w.isArray(u))for(t=w.Ya(u),x=0;x<t;x++)v=w.Da(u,x),m=a.Ie(v),null!==m&&(m.Lc=k)}}else if("nodeParentKey"===f){var B=b.object,y=a.Ie(b.newValue),H=a.jx(B);if(null!==H){var E=H.vn();null!==E?null===y?a.remove(E):a.Od?E.W=y:E.$=y:$m(a,y,H)}}else if("parentLinkCategory"===f){var B=b.object,H=
a.jx(B),V=b.newValue;null!==H&&"string"===typeof V&&(E=H.vn(),null!==E&&(E.rd=V))}else if("nodeCategory"===f){var h=b.object,ba=a.vh(h),V=b.newValue;null!==ba&&"string"===typeof V&&(ba.rd=V)}else if("linkCategory"===f){var h=b.object,Q=a.Qf(h),V=b.newValue;null!==Q&&"string"===typeof V&&(Q.rd=V)}else if("nodeDataArray"===f){var $=b.oldValue;Xm(a,$);var ca=b.newValue;Ym(a,ca)}else"linkDataArray"===f&&($=b.oldValue,Xm(a,$),ca=b.newValue,Zm(a,ca));a.ni=!0}else c===Of?(ca=b.newValue,"nodeDataArray"===
f&&w.Qa(ca)?an(a,ca):"linkDataArray"===f&&w.Qa(ca)?bn(a,ca):"linkLabelKeys"===f&&tg(ca)&&(k=a.Qf(b.object),m=a.Ie(ca),null!==k&&null!==m&&(m.Lc=k)),a.ni=!0):c===Pf?($=b.oldValue,"nodeDataArray"===f&&w.Qa($)?cn(a,$):"linkDataArray"===f&&w.Qa($)?cn(a,$):"linkLabelKeys"===f&&tg($)&&(m=a.Ie($),null!==m&&(m.Lc=null)),a.ni=!0):c===Nf&&("SourceChanged"===f?null!==b.object?rl(a,b.object,b.propertyName):(a.PJ(),a.uG()):"ModelDisplaced"===f&&a.cm());else if(c===Mf){var R=b.propertyName,h=b.object;if(h===a.ba){if("nodeKeyProperty"===
R||"nodeCategoryProperty"===R||"linkFromKeyProperty"===R||"linkToKeyProperty"===R||"linkFromPortIdProperty"===R||"linkToPortIdProperty"===R||"linkLabelKeysProperty"===R||"nodeIsGroupProperty"===R||"nodeGroupKeyProperty"===R||"nodeParentKeyProperty"===R||"linkCategoryProperty"===R)a.oa.fb||a.cm()}else rl(a,h,R);a.ni=!0}else if(c===Of||c===Pf)dn(a,b),a.ni=!0;else if(c===Nf){if("FinishedUndo"===d||"FinishedRedo"===d)a.oa.Ki=!0,a.Ba("ChangedSelection"),Ai(a),a.oa.Ki=!1;e=a.Pa;"RolledBackTransaction"===
d&&e.pi();a.rv=!0;a.Yf();0===a.oa.Fh&&zk(e);"CommittedTransaction"===d&&a.oa.hz&&(a.dh=Math.min(a.dh,a.oa.pj-1));var Ra=b.oF;Ra&&(Wm(a),a.Hx.clear());!a.nz&&Ra&&(a.nz=!0,w.setTimeout(function(){a.Za.standardMouseOver();a.nz=!1},10))}}finally{a.Ua=!0}}}}
function rl(a,b,c){if("string"===typeof c){var d=a.vh(b);if(null!==d)d.Hb(c),a.ba instanceof Zf&&(d=a.Qf(b),null!==d&&d.Hb(c));else{for(var d=null,e=a.Em.i;e.next();){for(var f=e.value,h=0;h<f.length;h++){var k=f[h].NH(b);null!==k&&(null===d&&(d=w.lb()),d.push(k))}if(null!==d)break}if(null!==d){for(e=0;e<d.length;e++)d[e].Hb(c);w.va(d)}}b===a.ba.Fk&&a.uG(c)}}w.defineProperty(D,{Ne:"skipsModelSourceBindings"},function(){return this.vD},function(a){this.vD=a});
w.defineProperty(D,{Ju:null},function(){return this.zz},function(a){this.zz=a});function dn(a,b){var c=b.xc===Of,d=c?b.yj:b.zj,e=c?b.newValue:b.oldValue,f=a.Em.ka(b.object);if(Array.isArray(f))for(var h=0;h<f.length;h++){var k=f[h];if(c)en(k,e,d);else{var l=d;if(!(0>l)){var m=l;fn(k)&&m++;k.jf(m);gn(k,m,l)}}}}function Km(a,b){var c=b.Zj;if(w.isArray(c)){var d=a.Em.ka(c);if(null===d)d=[],d.push(b),a.Em.add(c,d);else{for(c=0;c<d.length;c++)if(d[c]===b)return;d.push(b)}}}
function Om(a,b){var c=b.Zj;if(w.isArray(c)){var d=a.Em.ka(c);if(null!==d)for(var e=0;e<d.length;e++)if(d[e]===b){d.splice(e,1);0===d.length&&a.Em.remove(c);break}}}function Jm(a,b){for(var c=b.wa.n,d=c.length,e=0;e<d;e++){var f=c[e];f instanceof tl&&hn(a,f)}}
function hn(a,b){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){var d=b.Se;null!==d&&(d.Io instanceof Event&&null!==b.Te&&b.Te(b,d.Io),!0===d.Lv&&(null!==b.gi&&b.gi(b,d.uz),null!==b.g&&b.g.qz.add(b)));c=c.src;d=a.gp.ka(c);if(null===d)d=[],d.push(b),a.gp.add(c,d);else{for(c=0;c<d.length;c++)if(d[c]===b)return;d.push(b)}}}function Nm(a,b){for(var c=b.wa.n,d=c.length,e=0;e<d;e++){var f=c[e];f instanceof tl&&jn(a,f)}}
function jn(a,b){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){var c=c.src,d=a.gp.ka(c);if(null!==d)for(var e=0;e<d.length;e++)if(d[e]===b){d.splice(e,1);0===d.length&&a.gp.remove(c);break}}}
D.prototype.rebuildParts=D.prototype.cm=function(){for(var a=this.MA.i;a.next();){var b=a.value,c=a.key;(!b.de()||b instanceof U)&&w.k('Invalid node template in Diagram.nodeTemplateMap: template for "'+c+'" must be a Node or a simple Part, not a Group or Link: '+b)}for(a=this.pA.i;a.next();)b=a.value,c=a.key,b instanceof U||w.k('Invalid group template in Diagram.groupTemplateMap: template for "'+c+'" must be a Group, not a normal Node or Link: '+b);for(a=this.zA.i;a.next();)b=a.value,c=a.key,b instanceof
W||w.k('Invalid link template in Diagram.linkTemplateMap: template for "'+c+'" must be a Link, not a normal Node or simple Part: '+b);a=w.lb();for(b=this.selection.i;b.next();)(c=b.value.data)&&a.push(c);for(var b=w.lb(),d=this.Ul.i;d.next();)(c=d.value.data)&&b.push(c);c=w.lb();for(d=this.dg.i;d.next();){var e=d.value;null!==e.data&&(c.push(e.data),c.push(e.location))}for(d=this.links.i;d.next();)e=d.value,null!==e.data&&(c.push(e.data),c.push(e.location));for(d=this.Hk.i;d.next();)e=d.value,null!==
e.data&&(c.push(e.data),c.push(e.location));d=this.ba;d instanceof P&&Xm(this,d.Mg);Xm(this,d.cg);Ym(this,d.cg);d instanceof P&&Zm(this,d.Mg);for(d=0;d<a.length;d++)e=this.vh(a[d]),null!==e&&(e.eb=!0);for(d=0;d<b.length;d++)e=this.vh(b[d]),null!==e&&(e.Lg=!0);for(d=0;d<c.length;d+=2)e=this.vh(c[d]),null!==e&&(e.location=c[d+1]);w.va(a);w.va(b);w.va(c)};
function Ym(a,b){if(null!==b){for(var c=a.ba,d=c instanceof P,e=w.Ya(b),f=0;f<e;f++){var h=w.Da(b,f);c.Ge(h)?an(a,h,!1):d&&bn(a,h)}if(d||c instanceof Zf){for(f=0;f<e;f++)h=w.Da(b,f),c.Ge(h)&&kn(a,h);if(d)for(c=a.links;c.next();)ln(c.value)}mn(a,!1)}}function an(a,b,c){if(void 0!==b&&null!==b&&!a.oa.fb&&!a.Ai.contains(b)){void 0===c&&(c=!0);var d=a.lA(b),e=nn(a,b,d);if(null!==e&&(fh(e),e=e.copy(),null!==e)){var f=a.Ne;a.Ne=!0;e.ui=d;e.Vd=b;a.add(e);e.Vd=null;e.data=b;c&&kn(a,b);a.Ne=f}}}
D.prototype.lA=function(a){return this.ba.lA(a)};var on=!1,pn=!1;function nn(a,b,c){var d=!1,e=a.ba;e instanceof P&&(d=e.wA(b));d?(b=a.pA.ka(c),null===b&&(b=a.pA.ka(""),null===b&&(pn||(pn=!0,w.trace('No Group template found for category "'+c+'"'),w.trace("  Using default group template")),b=a.jC))):(b=a.MA.ka(c),null===b&&(b=a.MA.ka(""),null===b&&(on||(on=!0,w.trace('No Node template found for category "'+c+'"'),w.trace("  Using default node template")),b=a.lC)));return b}
function kn(a,b){var c=a.ba;if(c instanceof P||c instanceof Zf){var d=c.ub(b);if(void 0!==d){var e=wg(c,d),f=a.vh(b);if(null!==e&&null!==f){for(e=e.i;e.next();){var h=e.value;if(c instanceof P){var k=c;if(k.Ge(h)){if(f instanceof U&&k.yn(h)===d){var l=f,h=a.vh(h);null!==h&&(h.Ka=l)}}else{var m=a.Qf(h);if(null!==m&&f instanceof T&&(l=f,k.Sl(h)===d&&(m.W=l),k.Tl(h)===d&&(m.$=l),h=k.Ak(h),w.isArray(h)))for(k=0;k<w.Ya(h);k++)if(w.Da(h,k)===d){l.Lc=m;break}}}else c instanceof Zf&&(m=c,m.Ge(h)&&f instanceof
T&&(l=f,m.An(h)===d&&(h=a.jx(h),$m(a,l,h))))}Ng(c,d)}c instanceof P?(c=c.yn(b),void 0!==c&&(c=a.Ie(c),c instanceof U&&(f.Ka=c))):c instanceof Zf&&(c=c.An(b),void 0!==c&&f instanceof T&&(l=f,f=a.Ie(c),$m(a,f,l)))}}}
function $m(a,b,c){if(null!==b&&null!==c){var d=a.ab.tF,e=b,f=c;if(a.Od)for(b=f.fe;b.next();){if(b.value.$===f)return}else for(e=c,f=b,b=e.fe;b.next();)if(b.value.W===e)return;if(null===d||!Qi(d,e,f,null,!0))if(d=a.mx(c.data),b=qn(a,d),null!==b&&(fh(b),b=b.copy(),null!==b)){var h=a.Ne;a.Ne=!0;b.ui=d;b.Vd=c.data;b.W=e;b.$=f;a.add(b);b.Vd=null;b.data=c.data;a.Ne=h}}}function Zm(a,b){if(null!==b){for(var c=w.Ya(b),d=0;d<c;d++){var e=w.Da(b,d);bn(a,e)}mn(a,!1)}}
function bn(a,b){if(void 0!==b&&null!==b&&!a.oa.fb&&!a.Kj.contains(b)){var c=a.mx(b),d=qn(a,c);if(null!==d&&(fh(d),d=d.copy(),null!==d)){var e=a.Ne;a.Ne=!0;d.ui=c;d.Vd=b;var c=a.ba,f=c.UH(b);""!==f&&(d.Jg=f);f=c.Sl(b);void 0!==f&&(f=a.Ie(f),f instanceof T&&(d.W=f));f=c.YH(b);""!==f&&(d.Eh=f);f=c.Tl(b);void 0!==f&&(f=a.Ie(f),f instanceof T&&(d.$=f));c=c.Ak(b);if(w.isArray(c))for(var f=w.Ya(c),h=0;h<f;h++){var k=w.Da(c,h),k=a.Ie(k);null!==k&&(k.Lc=d)}a.add(d);d.Vd=null;d.data=b;a.Ne=e}}}
D.prototype.mx=function(a){var b=this.ba,c="";b instanceof P?c=b.mx(a):b instanceof Zf&&(c=b.WH(a));return c};var rn=!1;function qn(a,b){var c=a.zA.ka(b);null===c&&(c=a.zA.ka(""),null===c&&(rn||(rn=!0,w.trace('No Link template found for category "'+b+'"'),w.trace("  Using default link template")),c=a.kC));return c}function Xm(a,b){for(var c=w.Ya(b),d=0;d<c;d++){var e=w.Da(b,d);cn(a,e)}}
function cn(a,b){if(void 0!==b&&null!==b){var c=a.vh(b);if(null!==c){Pm(a,c,!1);var d=a.ba;if(d instanceof P&&c instanceof T){var e=d.ub(c.data);if(void 0!==e){for(var f=c.fe;f.next();)Mg(d,e,f.value.data);c.lf&&(f=c.Lc,null!==f&&Mg(d,e,f.data));if(c instanceof U)for(c=c.Mc;c.next();)f=c.value.data,d.Ge(f)&&Mg(d,e,f)}}else if(d instanceof Zf&&c instanceof T){f=a.Qf(c.data);if(null!==f){f.eb=!1;f.Lg=!1;var h=f.layer;if(null!==h){var k=h.jf(-1,f,!1);0<=k&&a.Wc(Pf,"parts",h,f,null,k,null);k=f.Dx;null!==
k&&k(f,h,null)}}f=a.Od;for(c=c.fe;c.next();)h=c.value,h=(f?h.$:h.W).data,d.Ge(h)&&Mg(d,e,h)}}}}D.prototype.findPartForKey=D.prototype.OH=function(a){if(null===a||void 0===a)return null;var b=this.ba.te(a);return null!==b?this.Ai.ka(b):this.ba instanceof P&&(b=this.ba.Up(a),null!==b)?this.Kj.ka(b):null};D.prototype.findNodeForKey=D.prototype.Ie=function(a){if(null===a||void 0===a)return null;a=this.ba.te(a);if(null===a)return null;a=this.Ai.ka(a);return a instanceof T?a:null};
D.prototype.findPartForData=D.prototype.vh=function(a){if(null===a)return null;var b=this.Ai.ka(a);return null!==b?b:b=this.Kj.ka(a)};D.prototype.findNodeForData=D.prototype.jx=function(a){if(null===a)return null;a=this.Ai.ka(a);return a instanceof T?a:null};D.prototype.findLinkForData=D.prototype.Qf=function(a){return null===a?null:this.Kj.ka(a)};
D.prototype.findNodesByExample=function(a){for(var b=new J(T),c=this.ep.i;c.next();){var d=c.value,e=d.data;if(null!==e)for(var f=0;f<arguments.length;f++){var h=arguments[f];if(w.Qa(h)&&sn(this,e,h)){b.add(d);break}}}return b.i};D.prototype.findLinksByExample=function(a){for(var b=new J(W),c=this.Yo.i;c.next();){var d=c.value,e=d.data;if(null!==e)for(var f=0;f<arguments.length;f++){var h=arguments[f];if(w.Qa(h)&&sn(this,e,h)){b.add(d);break}}}return b.i};
function sn(a,b,c){for(var d in c){var e=b[d],f=c[d];if(w.isArray(f)){if(!w.isArray(e)||e.length<f.length)return!1;for(var h=0;h<e.length;h++){var k=e[h],l=f[h];if(void 0!==l&&!tn(a,k,l))return!1}}else if(!tn(a,e,f))return!1}return!0}function tn(a,b,c){if("function"===typeof c){if(!c(b))return!1}else if(c instanceof RegExp){if(!b||!c.test(b.toString()))return!1}else if(w.Qa(b)&&w.Qa(c)){if(!sn(a,b,c))return!1}else if(b!==c)return!1;return!0}
w.defineProperty(D,{nL:"nodeTemplate"},function(){return this.Wi.ka("")},function(a){var b=this.Wi.ka("");b!==a&&(w.G(a,S,D,"nodeTemplate"),this.Wi.add("",a),this.h("nodeTemplate",b,a),this.oa.fb||this.cm())});w.defineProperty(D,{MA:"nodeTemplateMap"},function(){return this.Wi},function(a){var b=this.Wi;b!==a&&(w.G(a,ka,D,"nodeTemplateMap"),this.Wi=a,this.h("nodeTemplateMap",b,a),this.oa.fb||this.cm())});
w.defineProperty(D,{PK:"groupTemplate"},function(){return this.al.ka("")},function(a){var b=this.al.ka("");b!==a&&(w.G(a,U,D,"groupTemplate"),this.al.add("",a),this.h("groupTemplate",b,a),this.oa.fb||this.cm())});w.defineProperty(D,{pA:"groupTemplateMap"},function(){return this.al},function(a){var b=this.al;b!==a&&(w.G(a,ka,D,"groupTemplateMap"),this.al=a,this.h("groupTemplateMap",b,a),this.oa.fb||this.cm())});
w.defineProperty(D,{bL:"linkTemplate"},function(){return this.$j.ka("")},function(a){var b=this.$j.ka("");b!==a&&(w.G(a,W,D,"linkTemplate"),this.$j.add("",a),this.h("linkTemplate",b,a),this.oa.fb||this.cm())});w.defineProperty(D,{zA:"linkTemplateMap"},function(){return this.$j},function(a){var b=this.$j;b!==a&&(w.G(a,ka,D,"linkTemplateMap"),this.$j=a,this.h("linkTemplateMap",b,a),this.oa.fb||this.cm())});w.defineProperty(D,{sI:null},function(){return this.Cm},function(a){this.Cm=a});
w.defineProperty(D,{$e:"isMouseCaptured"},function(){return this.PC},function(a){var b=this.Eb;null!==b&&(a?(this.R.bubbles=!1,b.removeEventListener("mousemove",this.Nn,!1),b.removeEventListener("mousedown",this.Mn,!1),b.removeEventListener("mouseup",this.Pn,!1),b.removeEventListener("mousewheel",this.Ng,!1),b.removeEventListener("DOMMouseScroll",this.Ng,!1),b.removeEventListener("mouseout",this.On,!1),window.addEventListener("mousemove",this.Nn,!0),window.addEventListener("mousedown",this.Mn,!0),
window.addEventListener("mouseup",this.Pn,!0),window.addEventListener("mousewheel",this.Ng,!0),window.addEventListener("DOMMouseScroll",this.Ng,!0),window.addEventListener("mouseout",this.On,!0),window.addEventListener("selectstart",this.preventDefault,!1)):(window.removeEventListener("mousemove",this.Nn,!0),window.removeEventListener("mousedown",this.Mn,!0),window.removeEventListener("mouseup",this.Pn,!0),window.removeEventListener("mousewheel",this.Ng,!0),window.removeEventListener("DOMMouseScroll",
this.Ng,!0),window.removeEventListener("mouseout",this.On,!0),window.removeEventListener("selectstart",this.preventDefault,!1),b.addEventListener("mousemove",this.Nn,!1),b.addEventListener("mousedown",this.Mn,!1),b.addEventListener("mouseup",this.Pn,!1),b.addEventListener("mousewheel",this.Ng,!1),b.addEventListener("DOMMouseScroll",this.Ng,!1),b.addEventListener("mouseout",this.On,!1)),this.PC=a)});
w.defineProperty(D,{position:"position"},function(){return this.hb},function(a){var b=this.hb;if(!b.L(a)){w.G(a,z,D,"position");var c=this.sb.copy();a=a.copy();if(!this.Rc&&null!==this.Eb){this.Rc=!0;var d=this.scale;Ml(this,a,this.qe,this.Ib/d,this.Lb/d,this.ro,!1);this.Rc=!1}this.hb=a.S();a=this.Pa;a.oc&&dl(a,b,this.hb);this.Rc||this.uu(c,this.sb,this.tb,this.tb,!1)}});
w.defineProperty(D,{jI:"initialPosition"},function(){return this.Hv},function(a){this.Hv.L(a)||(w.G(a,z,D,"initialPosition"),this.Hv=a.S())});w.defineProperty(D,{kI:"initialScale"},function(){return this.Iv},function(a){this.Iv!==a&&(w.j(a,"number",D,"initialScale"),this.Iv=a)});
w.defineProperty(D,{Bn:"grid"},function(){null===this.nd&&Dl(this);return this.nd},function(a){var b=this.nd;if(b!==a){null===b&&(Dl(this),b=this.nd);w.G(a,C,D,"grid");a.type!==El&&w.k("Diagram.grid must be a Panel of type Panel.Grid");var c=b.O;null!==c&&c.remove(b);this.nd=a;a.name="GRID";null!==c&&c.add(a);Yl(this);this.na();this.h("grid",b,a)}});
w.u(D,{sb:"viewportBounds"},function(){var a=this.UD;if(null===this.Eb)return a;var b=this.hb,c=this.tb;a.l(b.x,b.y,Math.max(this.Ib,0)/c,Math.max(this.Lb,0)/c);return a});w.defineProperty(D,{LE:"fixedBounds"},function(){return this.zv},function(a){var b=this.zv;b.L(a)||(w.G(a,A,D,"fixedBounds"),-Infinity!==a.width&&Infinity!==a.height&&-Infinity!==a.height||w.k("fixedBounds width/height must not be Infinity"),this.zv=a=a.S(),this.qc(),this.h("fixedBounds",b,a))});
w.defineProperty(D,{XF:"scrollMargin"},function(){return this.qw},function(a){"number"===typeof a?a=new eb(a):w.G(a,eb,D,"scrollMargin");var b=this.qw;b.L(a)||(this.qw=a=a.S(),this.qc(),this.h("scrollMargin",b,a))});w.defineProperty(D,{WA:"scrollMode"},function(){return this.rw},function(a){var b=this.rw;b!==a&&(w.mb(a,D,D,"scrollMode"),this.rw=a,a===ol&&Kl(this,!1),this.h("scrollMode",b,a))});
w.defineProperty(D,{IF:"positionComputation"},function(){return this.lw},function(a){var b=this.lw;b!==a&&(null!==a&&w.j(a,"function",D,"positionComputation"),this.lw=a,Kl(this,!1),this.h("positionComputation",b,a))});w.defineProperty(D,{WF:"scaleComputation"},function(){return this.nw},function(a){var b=this.nw;b!==a&&(null!==a&&w.j(a,"function",D,"scaleComputation"),this.nw=a,Sm(this,this.scale,this.scale),this.h("scaleComputation",b,a))});w.u(D,{qe:"documentBounds"},function(){return this.sv});
function Nl(a,b){a.Uj=!1;var c=a.sv;c.L(b)||(b=b.S(),a.sv=b,Kl(a,!1),a.Ba("DocumentBoundsChanged",null,c.copy()),Vl(a))}w.defineProperty(D,{scale:"scale"},function(){return this.tb},function(a){var b=this.tb;w.Ed(a,D,"scale");b!==a&&Sm(this,b,a)});w.defineProperty(D,{Fl:"autoScale"},function(){return this.qm},function(a){var b=this.qm;b!==a&&(w.mb(a,D,D,"autoScale"),this.qm=a,this.h("autoScale",b,a),a!==ih&&Kl(this,!1))});
w.defineProperty(D,{SK:"initialAutoScale"},function(){return this.el},function(a){var b=this.el;b!==a&&(w.mb(a,D,D,"initialAutoScale"),this.el=a,this.h("initialAutoScale",b,a))});w.defineProperty(D,{lI:"initialViewportSpot"},function(){return this.Jv},function(a){var b=this.Jv;b!==a&&(w.G(a,L,D,"initialViewportSpot"),a.fd()||w.k("initialViewportSpot must be a specific Spot: "+a),this.Jv=a,this.h("initialViewportSpot",b,a))});
w.defineProperty(D,{iI:"initialDocumentSpot"},function(){return this.Gv},function(a){var b=this.Gv;b!==a&&(w.G(a,L,D,"initialDocumentSpot"),a.fd()||w.k("initialViewportSpot must be a specific Spot: "+a),this.Gv=a,this.h("initialDocumentSpot",b,a))});w.defineProperty(D,{yh:"minScale"},function(){return this.Zv},function(a){w.Ed(a,D,"minScale");var b=this.Zv;b!==a&&(0<a?(this.Zv=a,this.h("minScale",b,a),a>this.scale&&(this.scale=a)):w.Ea(a,"> 0",D,"minScale"))});
w.defineProperty(D,{xh:"maxScale"},function(){return this.Xv},function(a){w.Ed(a,D,"maxScale");var b=this.Xv;b!==a&&(0<a?(this.Xv=a,this.h("maxScale",b,a),a<this.scale&&(this.scale=a)):w.Ea(a,"> 0",D,"maxScale"))});w.defineProperty(D,{lm:"zoomPoint"},function(){return this.Iw},function(a){this.Iw.L(a)||(w.G(a,z,D,"zoomPoint"),this.Iw=a=a.S())});
w.defineProperty(D,{qE:"contentAlignment"},function(){return this.ro},function(a){var b=this.ro;b.L(a)||(w.G(a,L,D,"contentAlignment"),this.ro=a=a.S(),this.h("contentAlignment",b,a),Kl(this,!1))});w.defineProperty(D,{TK:"initialContentAlignment"},function(){return this.Lo},function(a){var b=this.Lo;b.L(a)||(w.G(a,L,D,"initialContentAlignment"),this.Lo=a=a.S(),this.h("initialContentAlignment",b,a))});
w.defineProperty(D,{padding:"padding"},function(){return this.ff},function(a){"number"===typeof a?a=new eb(a):w.G(a,eb,D,"padding");var b=this.ff;b.L(a)||(this.ff=a=a.S(),this.qc(),this.h("padding",b,a))});w.u(D,{dg:"nodes"},function(){return this.ep.i});w.u(D,{links:"links"},function(){return this.Yo.i});w.u(D,{Hk:"parts"},function(){return this.zb.i});
D.prototype.findTopLevelNodesAndLinks=function(){for(var a=new J(S),b=this.ep.i;b.next();){var c=b.value;c.cq&&a.add(c)}for(b=this.Yo.i;b.next();)c=b.value,c.cq&&a.add(c);return a.i};D.prototype.findTopLevelGroups=function(){return this.wl.i};w.defineProperty(D,{Rb:"layout"},function(){return this.ie},function(a){var b=this.ie;b!==a&&(w.G(a,pg,D,"layout"),null!==b&&(b.g=null,b.group=null),this.ie=a,a.g=this,a.group=null,this.bv=!0,this.h("layout",b,a),this.Le())});
D.prototype.layoutDiagram=function(a){Ai(this);a&&mn(this,!0);Zl(this,!1)};function mn(a,b){for(var c=a.wl.i;c.next();)un(a,c.value,b);null!==a.Rb&&(b?a.Rb.yf=!1:a.Rb.J())}function un(a,b,c){if(null!==b){for(var d=b.bp.i;d.next();)un(a,d.value,c);null!==b.Rb&&(c?b.Rb.yf=!1:b.Rb.J())}}
function Zl(a,b){if(!a.My){var c=a.Rb,d=a.Ua;a.Ua=!0;try{var e=a.oa.Fh;0===e&&a.Tb("Layout");var f=a.Pa;1!==a.oa.Fh||f.kf||f.oc||b||f.Sn("Layout");for(var h=a.wl.i;h.next();)vn(a,h.value,b);c.yf||b&&!c.nF&&0!==e||(c.doLayout(a),Ai(a),c.yf=!0)}finally{0===e&&a.Fd("Layout"),a.bv=!c.yf,a.Ua=d}}}function vn(a,b,c){if(null!==b){for(var d=b.bp.i;d.next();)vn(a,d.value,c);d=b.Rb;null===d||d.yf||c&&!d.nF||(b.Qn=!b.location.H(),d.doLayout(b),b.J(wn),d.yf=!0,em(a,b))}}
w.defineProperty(D,{Od:"isTreePathToChildren"},function(){return this.Pv},function(a){var b=this.Pv;if(b!==a&&(w.j(a,"boolean",D,"isTreePathToChildren"),this.Pv=a,this.h("isTreePathToChildren",b,a),!this.oa.fb))for(a=this.dg;a.next();)xn(a.value)});D.prototype.findTreeRoots=function(){for(var a=new I(T),b=this.dg;b.next();){var c=b.value;c.cq&&null===c.vn()&&a.add(c)}return a.i};
w.defineProperty(D,{sB:"treeCollapsePolicy"},function(){return this.Dw},function(a){var b=this.Dw;b!==a&&(a!==ql&&a!==Um&&a!==Vm&&w.k("Unknown Diagram.treeCollapsePolicy: "+a),this.Dw=a,this.h("treeCollapsePolicy",b,a))});w.defineProperty(D,{wh:null},function(){return this.HC},function(a){this.HC=a});
function pl(a){function b(a){var b=a.toLowerCase(),h=new I("function");c.add(a,h);c.add(b,h);d.add(a,a);d.add(b,a)}var c=new ka("string",I),d=new ka("string","string");b("AnimationStarting");b("AnimationFinished");b("BackgroundSingleClicked");b("BackgroundDoubleClicked");b("BackgroundContextClicked");b("ClipboardChanged");b("ClipboardPasted");b("DocumentBoundsChanged");b("ExternalObjectsDropped");b("InitialLayoutCompleted");b("LayoutCompleted");b("LinkDrawn");b("LinkRelinked");b("LinkReshaped");b("Modified");
b("ObjectSingleClicked");b("ObjectDoubleClicked");b("ObjectContextClicked");b("PartCreated");b("PartResized");b("PartRotated");b("SelectionMoved");b("SelectionCopied");b("SelectionDeleting");b("SelectionDeleted");b("SelectionGrouped");b("SelectionUngrouped");b("ChangingSelection");b("ChangedSelection");b("SubGraphCollapsed");b("SubGraphExpanded");b("TextEdited");b("TreeCollapsed");b("TreeExpanded");b("ViewportBoundsChanged");a.Oy=c;a.Ny=d}
function oa(a,b){var c=a.Ny.ka(b);return null!==c?c:a.Ny.ka(b.toLowerCase())}function yn(a,b){var c=a.Oy.ka(b);if(null!==c)return c;c=a.Oy.ka(b.toLowerCase());if(null!==c)return c;w.k("Unknown DiagramEvent name: "+b);return null}D.prototype.addDiagramListener=D.prototype.Lz=function(a,b){w.j(a,"string",D,"addDiagramListener:name");w.j(b,"function",D,"addDiagramListener:listener");var c=yn(this,a);null!==c&&c.add(b)};
D.prototype.removeDiagramListener=D.prototype.MF=function(a,b){w.j(a,"string",D,"removeDiagramListener:name");w.j(b,"function",D,"addDiagramListener:listener");var c=yn(this,a);null!==c&&c.remove(b)};D.prototype.raiseDiagramEvent=D.prototype.Ba=function(a,b,c){var d=yn(this,a),e=new Cf;e.g=this;a=oa(this,a);null!==a&&(e.name=a);void 0!==b&&(e.jB=b);void 0!==c&&(e.OA=c);b=d.length;if(1===b)d=d.da(0),d(e);else if(0!==b)for(c=d.dc(),a=0;a<b;a++)d=c[a],d(e);return e.cancel};
function Ji(a,b){var c=!1;a.sb.vk(b)&&(c=!0);c=a.fA(b,function(a){return a.U},function(a){return a instanceof W},!0,function(a){return a instanceof W},c);if(0!==c.count)for(c=c.i;c.next();){var d=c.value;d.Dk&&d.Xb()}}D.prototype.isUnoccupied=D.prototype.$l=function(a,b){void 0===b&&(b=null);return zn(this,!1,null,b).$l(a.x,a.y,a.width,a.height)};
function zn(a,b,c,d){null===a.Bd&&(a.Bd=new An);if(a.Bd.Yt||a.Bd.group!==c||a.Bd.iB!==d){if(null===c){b=a.Uj?Jl(a):a.qe.copy();b.Sf(100,100);a.Bd.initialize(b);b=w.Df();for(var e=a.dg;e.next();){var f=e.value,h=f.layer;null!==h&&h.visible&&!h.Jc&&Bn(a,f,d,b)}}else for(c.Y.H()||c.Ze(),b=c.Y.copy(),b.Sf(20,20),a.Bd.initialize(b),b=w.Df(),e=c.Mc;e.next();)f=e.value,f instanceof T&&Bn(a,f,d,b);w.Gb(b);a.Bd.group=c;a.Bd.iB=d;a.Bd.Yt=!1}else b&&Cn(a.Bd);return a.Bd}
function Bn(a,b,c,d){if(b!==c)if(b.isVisible()&&b.Pz&&!b.lf){c=b.getAvoidableRect(d);d=a.Bd.Ip;b=a.Bd.Gp;for(var e=c.x+c.width,f=c.y+c.height,h=c.x;h<e;h+=d){for(var k=c.y;k<f;k+=b)Dn(a.Bd,h,k);Dn(a.Bd,h,f)}for(k=c.y;k<f;k+=b)Dn(a.Bd,e,k);Dn(a.Bd,e,f)}else if(b instanceof U)for(b=b.Mc;b.next();)e=b.value,e instanceof T&&Bn(a,e,c,d)}function En(a,b){null===a.Bd||a.Bd.Yt||null!==b&&(!b.Pz||b.lf)||(a.Bd.Yt=!0)}
D.prototype.simulatedMouseMove=function(a,b,c){if(null!==Jh){var d=Jh.g;c instanceof D||(c=null);var e=Kh;c!==e&&(null!==e&&e!==d&&null!==e.ab.re&&(Ph(e),Jh.ux=!1,e.ab.re.doSimulatedDragLeave()),Kh=c,null!==c&&c!==d&&null!==c.ab.re&&(Vh(),e=c.ab.re,Rh.contains(e)||Rh.add(e),c.ab.re.doSimulatedDragEnter()));if(null===c||c===d||!c.eE||c.cb||!c.Ep)return!1;d=c.ab.re;null!==d&&(null!==a?b=c.zr(a):null===b&&(b=new z),c.Pb.ca=b,c.Pb.Nl=!1,c.Pb.up=!1,d.doSimulatedDragOver());return!0}return!1};
D.prototype.simulatedMouseUp=function(a,b,c,d){if(null!==Jh){null===d&&(d=b);b=Kh;var e=Jh.g;if(d!==b){if(null!==b&&b!==e&&null!==b.ab.re)return Ph(b),Jh.ux=!1,b.ab.re.doSimulatedDragLeave(),!1;Kh=d;null!==d&&null!==d.ab.re&&(Vh(),b=d.ab.re,Rh.contains(b)||Rh.add(b),d.ab.re.doSimulatedDragEnter())}if(null===d)return Jh.doCancel(),!0;if(d!==this)return null!==a&&(c=d.zr(a)),d.Pb.ca=c,d.Pb.Nl=!1,d.Pb.up=!0,a=d.ab.re,null!==a&&a.doSimulatedDrop(),a=Jh,null!==a&&(d=a.mayCopy(),a.Ff=d?"Copy":"Move",a.stopTool()),
!0}return!1};w.defineProperty(D,{sK:"autoScrollInterval"},function(){return this.Nq},function(a){var b=this.Nq;w.Ed(a,D,"scale");b!==a&&(this.Nq=a,this.h("autoScrollInterval",b,a))});w.defineProperty(D,{kE:"autoScrollRegion"},function(){return this.dv},function(a){"number"===typeof a?a=new eb(a):w.G(a,eb,D,"autoScrollRegion");var b=this.dv;b.L(a)||(this.dv=a=a.S(),this.qc(),this.h("autoScrollRegion",b,a))});
D.prototype.doAutoScroll=D.prototype.bA=function(a){this.cv.assign(a);Fn(this,this.cv).Ic(this.position)?Ph(this):Gn(this)};function Gn(a){-1===a.mo&&(a.mo=w.setTimeout(function(){if(-1!==a.mo){Ph(a);var b=a.R.event;if(null!==b){var c=Fn(a,a.cv);c.Ic(a.position)||(a.position=c,a.R.ca=a.rB(a.cv),a.simulatedMouseMove(b,null,b.target.Z)||a.doMouseMove(),a.Uj=!0,Nl(a,a.sh()),a.Be=!0,a.Yf(),Gn(a))}}},a.Nq))}function Ph(a){-1!==a.mo&&(w.clearTimeout(a.mo),a.mo=-1)}
function Fn(a,b){var c=a.position,d=a.kE;if(0>=d.top&&0>=d.left&&0>=d.right&&0>=d.bottom)return c;var e=a.sb,f=a.scale,e=w.Vg(0,0,e.width*f,e.height*f),h=w.xb(0,0);if(b.x>=e.x&&b.x<e.x+d.left){var k=Math.max(a.Cu,1),k=k|0;h.x-=k;b.x<e.x+d.left/2&&(h.x-=k);b.x<e.x+d.left/4&&(h.x-=4*k)}else b.x<=e.x+e.width&&b.x>e.x+e.width-d.right&&(k=Math.max(a.Cu,1),k|=0,h.x+=k,b.x>e.x+e.width-d.right/2&&(h.x+=k),b.x>e.x+e.width-d.right/4&&(h.x+=4*k));b.y>=e.y&&b.y<e.y+d.top?(k=Math.max(a.Du,1),k|=0,h.y-=k,b.y<e.y+
d.top/2&&(h.y-=k),b.y<e.y+d.top/4&&(h.y-=4*k)):b.y<=e.y+e.height&&b.y>e.y+e.height-d.bottom&&(k=Math.max(a.Du,1),k|=0,h.y+=k,b.y>e.y+e.height-d.bottom/2&&(h.y+=k),b.y>e.y+e.height-d.bottom/4&&(h.y+=4*k));h.Ic(bd)||(c=new z(c.x+h.x/f,c.y+h.y/f));w.Gb(e);w.v(h);return c}D.prototype.makeSvg=D.prototype.makeSVG=function(a){void 0===a&&(a=new sa);a.context="svg";a=Hn(this,a);return null!==a?a.gm:null};
D.prototype.makeImage=function(a){void 0===a&&(a=new sa);var b=(a.document||document).createElement("img");b.src=this.GI(a);return b};
D.prototype.makeImageData=D.prototype.GI=function(a){void 0===a&&(a=new sa);var b=Hn(this,a);if(null!==b){var c=a.returnType,c=void 0===c?"string":c.toLowerCase();switch(c){case "imagedata":return b.wk.getImageData(0,0,b.width,b.height);case "blob":b=b.Gd;c=a.callback;if("function"!==typeof c){w.k('Error: Diagram.makeImageData called with "returnType: toBlob", but no "callback" function property defined.');break}if("function"===typeof b.toBlob)return b.toBlob(c,a.type,a.details),"toBlob";if("function"===
typeof b.msToBlob)return c(b.msToBlob()),"msToBlob";c(null);break;default:return b.toDataURL(a.type,a.details)}}return""};var In=!1;
function Hn(a,b){a.Pa.pi();a.Yf();if(null===a.Eb)return null;"object"!==typeof b&&w.k("properties argument must be an Object.");var c=!1,d=b.size||null,e=b.scale||null;void 0!==b.scale&&isNaN(b.scale)&&(e="NaN");var f=b.maxSize;void 0===b.maxSize&&(c=!0,f="svg"===b.context?new ha(Infinity,Infinity):new ha(2E3,2E3));var h=b.position||null,k=b.parts||null,l=void 0===b.padding?1:b.padding,m=b.background||null,n=b.omitTemporary;void 0===n&&(n=!0);var p=b.document||document,q=b.elementFinished||null,r=
b.showTemporary;void 0===r&&(r=!n);n=b.showGrid;void 0===n&&(n=r);null!==d&&isNaN(d.width)&&isNaN(d.height)&&(d=null);"number"===typeof l?l=new eb(l):l instanceof eb||(l=new eb(0));l.left=Math.max(l.left,0);l.right=Math.max(l.right,0);l.top=Math.max(l.top,0);l.bottom=Math.max(l.bottom,0);a.Co=!1;a.qf.Ee(!0);var s=new Tc(null,p),u=s.wk;if(!(d||e||k||h)){s.width=a.Ib+Math.ceil(l.left+l.right);s.height=a.Lb+Math.ceil(l.top+l.bottom);if("svg"===b.context)return u=new Lc(s.Gd,p,q),Em(a,u,l,new ha(s.width,
s.height),a.tb,a.hb,k,m,r,n),a.Co=!0,u;Em(a,u,l,new ha(s.width,s.height),a.tb,a.hb,k,m,r,n);a.Co=!0;return s}var t=a.ob.Yw,x=new z(0,0),v=a.qe.copy();v.EJ(a.padding);if(r)for(var B=!0,B=a.$b.n,y=B.length,H=0;H<y;H++){var E=B[H];if(E.visible&&E.Jc)for(var E=E.zb.n,V=E.length,ba=0;ba<V;ba++){var Q=E[ba];Q.xA&&Q.isVisible()&&(Q=Q.Y,Q.H()&&v.Gh(Q))}}x.x=v.x;x.y=v.y;if(null!==k){var $,B=!0,y=k.i;for(y.reset();y.next();)Q=y.value,Q instanceof S&&(E=Q.layer,null!==E&&!E.visible||null!==E&&!r&&E.Jc||!Q.isVisible()||
(Q=Q.Y,Q.H()&&(B?(B=!1,$=Q.copy()):$.Gh(Q))));B&&($=new A(0,0,0,0));v.width=$.width;v.height=$.height;x.x=$.x;x.y=$.y}null!==h&&h.H()&&(x=h,e||(e=t));B=Q=0;null!==l&&(Q=l.left+l.right,B=l.top+l.bottom);H=y=0;null!==d&&(y=d.width,H=d.height,isFinite(y)&&(y=Math.max(0,y-Q)),isFinite(H)&&(H=Math.max(0,H-B)));$=h=0;null!==d&&null!==e?("NaN"===e&&(e=t),d.H()?(h=y,$=H):isNaN(H)?(h=y,$=v.height*e):(h=v.width*e,$=H)):null!==d?d.H()?(e=Math.min(y/v.width,H/v.height),h=y,$=H):isNaN(H)?(e=y/v.width,h=y,$=v.height*
e):(e=H/v.height,h=v.width*e,$=H):null!==e?"NaN"===e&&f.H()?(e=Math.min((f.width-Q)/v.width,(f.height-B)/v.height),e>t?(e=t,h=v.width,$=v.height):(h=f.width,$=f.height)):(h=v.width*e,$=v.height*e):(e=t,h=v.width,$=v.height);null!==l?(h+=Q,$+=B):l=new eb(0);null!==f&&(d=f.width,f=f.height,"svg"!==b.context&&c&&!In&&(h>d||$>f)&&(w.trace("Diagram.makeImage(data): Diagram width or height is larger than the default max size. ("+Math.ceil(h)+"x"+Math.ceil($)+" vs 2000x2000) Consider increasing the max size."),
In=!0),isNaN(d)&&(d=2E3),isNaN(f)&&(f=2E3),isFinite(d)&&(h=Math.min(h,d)),isFinite(f)&&($=Math.min($,f)));s.width=Math.ceil(h);s.height=Math.ceil($);if("svg"===b.context)return u=new Lc(s.Gd,p,q),Em(a,u,l,new ha(Math.ceil(h),Math.ceil($)),e,x,k,m,r,n),a.Co=!0,u;Em(a,u,l,new ha(Math.ceil(h),Math.ceil($)),e,x,k,m,r,n);a.Co=!0;return s}D.inherit=function(a,b){w.j(a,"function",D,"inherit");w.j(b,"function",D,"inherit");b.PG&&w.k("Cannot inherit from "+w.hf(b));w.La(a,b)};
function yl(){this.CD=null;this.RG="63ad05bbe23a1786468a4c741b6d2";this.Fi=this.RG===this._tk?!0:null}
function Jn(a){var b="f",c=window[w.Gg("76a715b2f73f148a")][w.Gg("72ba13b5")],d=w.Gg;if(window[d("7da7")]&&window[d("7da7")][d("76a115b6ed251eaf4692")]){a.Fi=!0;var e=window[d("7da7")][d("76a115b6ed251eaf4692")],e=d(e).split(d("39e9"));if(6>e.length)return;var f=d(e[1]).split(".");if("7da71ca0"!==e[4])return;var h=d(w[d("6cae19")]).split(".");if(f[0]>h[0]||f[0]===h[0]&&f[1]>=h[1]){f=c[d("76ad18b4f73e")];for(h=c[d("73a612b6fb191d")](d("35e7"))+2;h<f;h++)b+=c[h];f=b[d("73a612b6fb191d")](d(e[2]));0>
f&&d(e[2])!==d("7da71ca0ad381e90")&&(f=b[d("73a612b6fb191d")](d("76a715b2ef3e149757")));0>f&&(f=b[d("73a612b6fb191d")](d("76a715b2ef3e149757")));a.Fi=!(0<=f&&f<b[d("73a612b6fb191d")](d("35")));if(!a.Fi)return}else return}f=c[d("76ad18b4f73e")];for(h=c[d("73a612b6fb191d")](d("35e7"))+2;h<f;h++)b+=c[h];f=b[d("73a612b6fb191d")](d(w.adym));0>f&&d(w.adym)!==d("7da71ca0ad381e90")&&(f=b[d("73a612b6fb191d")](d("76a715b2ef3e149757")));a.Fi=!(0<=f&&f<b[d("73a612b6fb191d")](d("35")));a.Fi&&(b=window.document[d("79ba13b2f7333e8846865a7d00")]("div"),
c=d("02cncncn"),"."===c[0]&&(c=c[d("69bd14a0f724128a44")](1)),b[d("79a417a0f0181a8946")]=c,window.document[d("78a712aa")]?(window.document[d("78a712aa")][d("7bb806b6ed32388c4a875b")](b),c=window[d("7dad0290ec3b0b91578e5b40007031bf")](b)[d("7dad0283f1390b81519f4645156528bf")](d("78a704b7e62456904c9b12701b6532a8")),window.document[d("78a712aa")][d("68ad1bbcf533388c4a875b")](b),c&&-1!==c.indexOf(d(w.nH))&&-1!==c.indexOf(d(w.oH))&&(a.Fi=!1)):(a.Fi=null,a.Fi=!1))}
yl.prototype.km=function(a){a.qf.setTransform(a.zd,0,0,a.zd,0,0);null===this.Fi&&Jn(this);return 0<this.Fi&&this!==this.CD?!0:!1};yl.prototype.t=function(){this.CD=null};
function zl(a,b){void 0!==b&&null!==b||w.k("Diagram setup requires an argument DIV.");null!==a.Mb&&w.k("Diagram has already completed setup.");"string"===typeof b?a.Mb=window.document.getElementById(b):b instanceof HTMLDivElement?a.Mb=b:w.k("No DIV or DIV id supplied: "+b);null===a.Mb&&w.k("Invalid DIV id; could not get element with id: "+b);void 0!==a.Mb.Z&&w.k("Invalid div id; div already has a Diagram associated with it.");"static"===window.getComputedStyle(a.Mb,null).position&&(a.Mb.style.position=
"relative");a.Mb.style["-webkit-tap-highlight-color"]="rgba(255, 255, 255, 0)";a.Mb.style["-ms-touch-action"]="none";a.Mb.innerHTML="";a.Mb.Z=a;var c=new Tc(a);c.Gd.innerHTML="This text is displayed if your browser does not support the Canvas HTML element.";void 0!==c.style&&(c.style.position="absolute",c.style.top="0px",c.style.left="0px","rtl"===window.getComputedStyle(a.Mb,null).getPropertyValue("direction")&&(a.Lr=!0),c.style.zIndex="2",c.style.PL="none",c.style.webkitUserSelect="none",c.style.MozUserSelect=
"none");a.Ib=a.Mb.clientWidth||1;a.Lb=a.Mb.clientHeight||1;a.Eb=c;a.qf=c.wk;var d=a.qf;a.dD=(window.devicePixelRatio||1)/(d.webkitBackingStorePixelRatio||d.mozBackingStorePixelRatio||d.msBackingStorePixelRatio||d.oBackingStorePixelRatio||d.backingStorePixelRatio||1);a.zd=a.computePixelRatio();Gm(a,a.Ib,a.Lb);a.uv=d[w.Gg("7eba17a4ca3b1a8346")][w.Gg("78a118b7")](d,w.km,4,4);a.Mb.insertBefore(c.Gd,a.Mb.firstChild);c=new Tc(null);c.width=1;c.height=1;a.Qy=c;a.xC=c.wk;var c=w.createElement("div"),e=w.createElement("div");
c.style.position="absolute";c.style.overflow="auto";c.style.width=a.Ib+"px";c.style.height=a.Lb+"px";c.style.zIndex="1";e.style.position="absolute";e.style.width="1px";e.style.height="1px";a.Mb.appendChild(c);c.appendChild(e);c.onscroll=Fl;c.onmousedown=Hl;c.ontouchstart=Hl;c.Z=a;c.NG=!0;c.OG=!0;a.sw=c;a.Qs=e;a.Tx=w.tE(function(){a.jk=null;a.na()},300,!1);a.xB=w.tE(function(){Ak(a)},250,!1);a.preventDefault=function(a){a.preventDefault();return!1};a.Nn=function(b){if(a.isEnabled){a.Cm=!0;var c=a.Tc;
w.Dn&&c.tj?(b.preventDefault(),b.simulated=!0,a.Zs=b):(a.Tc=a.Pb,a.Pb=c,Ql(a,a,b,c,!0),a.simulatedMouseMove(b,null,b.target.Z)||(a.doMouseMove(),a.Za.isBeyondDragSize()&&(a.jl=0),Ul(c,b)))}};a.Mn=function(b){if(a.isEnabled){a.Cm=!0;var c=a.Tc;if(w.Dn&&null!==a.Zs)a.Zs=b,b.preventDefault();else if(w.Dn&&400>b.timeStamp-a.Gm)b.preventDefault();else if(a.gl)b.preventDefault();else{a.Tc=a.Pb;a.Pb=c;Ql(a,a,b,c,!0);c.Nl=!0;c.Fe=b.detail;if(w.gF||w.hF)b.timeStamp-a.Gm<a.QD&&!a.Za.isBeyondDragSize()?a.jl++:
a.jl=1,a.Gm=b.timeStamp,c.Fe=a.jl;a.Hi=c;!0===c.ur.simulated?(b.preventDefault(),b.simulated=!0):(Jh=null,a.doMouseDown(),a.Hi=a.Hi.copy(),1===b.button?b.preventDefault():Ul(c,b))}}};a.Pn=function(b){if(a.isEnabled)if(a.gl&&2===b.button)b.preventDefault();else if(a.gl&&0===b.button&&(a.gl=!1),a.ht)b.preventDefault();else{a.Cm=!0;var c=a.Tc;if(w.Dn){if(400>b.timeStamp-a.Gm){b.preventDefault();return}a.Gm=b.timeStamp}if(w.Dn&&null!==a.Zs)a.Zs=null,b.preventDefault();else{a.Tc=a.Pb;a.Pb=c;Ql(a,a,b,c,
!0);c.up=!0;c.Fe=b.detail;if(w.gF||w.hF)c.Fe=a.jl;c.bubbles=b.bubbles;b.target.Z&&(c.Ug=b.target.Z);a.simulatedMouseUp(b,null,new z,c.Ug)||(a.doMouseUp(),Ph(a),Ul(c,b))}}};a.Ng=function(b){if(a.isEnabled){var c=a.Tc;a.Tc=a.Pb;a.Pb=c;Ql(a,a,b,c,!0);c.bubbles=!0;c.Ml=void 0!==b.wheelDelta?b.wheelDelta:-40*b.detail;a.doMouseWheel();Ul(c,b)}};a.On=function(){if(a.isEnabled){a.Cm=!1;var b=a.Za;b.cancelWaitAfter();b instanceof bh&&b.hideToolTip()}};a.qB=function(b){if(a.isEnabled){a.ht=!1;a.gl=!0;var c=
a.Tc;a.Tc=a.Pb;a.Pb=c;Sl(a,b,b.targetTouches[0],c,1<b.touches.length);a.doMouseDown();Ul(c,b)}};a.pB=function(b){if(a.isEnabled){var c=a.Tc;a.Tc=a.Pb;a.Pb=c;var d=null;0<b.changedTouches.length?d=b.changedTouches[0]:0<b.targetTouches.length&&(d=b.targetTouches[0]);Tl(a,b,d,c,1<b.touches.length);a.simulatedMouseMove(d?d:b,null,c.Ug)||a.doMouseMove();Ul(c,b)}};a.oB=function(b){if(a.isEnabled)if(a.ht)b.preventDefault();else{var c=a.Tc;a.Tc=a.Pb;a.Pb=c;if(!(1<b.touches.length)){var d=null,e=null;0<b.changedTouches.length?
e=b.changedTouches[0]:0<b.targetTouches.length&&(e=b.targetTouches[0]);c.g=a;c.Fe=1;if(null!==e){d=window.document.elementFromPoint(e.clientX,e.clientY);null!==d&&d.Z instanceof D&&d.Z!==a&&Rl(d.Z,e,c);Rl(a,b.changedTouches[0],c);var m=e.screenX,n=e.screenY,p=a.UC;b.timeStamp-a.Gm<a.QD&&!(25<Math.abs(p.x-m)||25<Math.abs(p.y-n))?a.jl++:a.jl=1;c.Fe=a.jl;a.Gm=b.timeStamp;a.UC.l(m,n)}c.ud=0;c.button=0;c.buttons=1;c.Nl=!1;c.up=!0;c.Ml=0;c.Ac=!1;c.bubbles=!1;c.event=b;c.timestamp=Date.now();c.Ug=null===
d?b.target.Z:d.Z?d.Z:null;c.Pe=null;a.simulatedMouseUp(e?e:b,null,new z,c.Ug)||a.doMouseUp();Ul(c,b);a.gl=!1}}};a.EF=function(b){if("touch"===b.pointerType){var c=a.pD;void 0===c[b.pointerId]&&(a.kw++,c[b.pointerId]=b);a.Zi[0]=null;a.Zi[1]=null;for(var d in c)if(null===a.Zi[0])a.Zi[0]=c[d];else if(null===a.Zi[1]){a.Zi[1]=c[d];break}a.isEnabled&&(a.ht=!1,a.gl=!0,c=a.Tc,a.Tc=a.Pb,a.Pb=c,Sl(a,b,b,c,1<a.kw),a.doMouseDown(),Ul(c,b))}};a.GF=function(b){if("touch"===b.pointerType&&!(2>a.kw)){var c=a.Zi;
c[0].pointerId===b.pointerId&&(c[0]=b);c[1].pointerId===b.pointerId&&(c[1]=b);a.isEnabled&&(c=a.Tc,a.Tc=a.Pb,a.Pb=c,Tl(a,b,b,c,!0),a.simulatedMouseMove(b,null,c.Ug)||(a.doMouseMove(),Ul(c,b)))}};a.FF=function(b){if("touch"===b.pointerType){var c=a.pD;void 0!==c[b.pointerId]&&(a.kw--,delete c[b.pointerId],c=a.Zi,null!==c[0]&&c[0].pointerId===b.pointerId&&(c[0]=null),null!==c[1]&&c[1].pointerId===b.pointerId&&(c[1]=null))}};d.Ee(!0);Cl(a)}
function Kn(a){1<arguments.length&&w.k("Palette constructor can only take one optional argument, the DIV HTML element or its id.");D.call(this,a);this.zt=!0;this.Dl=!1;this.cb=!0;this.qE=wb;this.Rb=new Ln}w.La(Kn,D);w.fa("Palette",Kn);
function vl(a){1<arguments.length&&w.k("Overview constructor can only take one optional argument, the DIV HTML element or its id.");D.call(this,a);this.Pa.isEnabled=!1;this.Rc=!0;this.fk=null;this.vv=!0;this.xJ("drawShadows",!1);var b=new S,c=new X;c.stroke="magenta";c.kb=2;c.fill="transparent";c.name="BOXSHAPE";b.dm=!0;b.ZA="BOXSHAPE";b.AA="BOXSHAPE";b.TF="BOXSHAPE";b.cursor="move";b.add(c);this.rm=b;c=new dh;c.type=Gj;c.zf=Fb;var d=new Hj;d.Uf=!0;c.add(d);d=new X;d.oh=Fb;d.Cb="Rectangle";d.Aa=new ha(64,
64);d.cursor="se-resize";d.alignment=Kb;c.add(d);b.RF=c;this.gn=this.sk=!1;this.tf=this.Bt=!0;this.kE=new eb(0,0,0,0);this.Bz=new Tc(null);this.QG=this.Bz.wk;this.ab.re=new Mn;this.ab.UF=new Nn;var e=this;this.click=function(){var a=e.fk;if(null!==a){var b=a.sb,c=e.R.ca;a.position=new z(c.x-b.width/2,c.y-b.height/2)}};this.BF=function(){On(e)};this.AF=function(){null!==e.fk&&(e.qc(),e.na())};this.Fl=Ol;this.Rc=!1}w.La(vl,D);w.fa("Overview",vl);
function Pn(a){a.Rc||a.Xd||!1!==a.Mf||(a.Mf=!0,requestAnimationFrame(function(){if(a.Mf&&!a.Xd&&(a.Mf=!1,null!==a.Mb)){a.Xd=!0;Ai(a);a.qe.H()||Nl(a,a.sh());null===a.Mb&&w.k("No div specified");null===a.Eb&&w.k("No canvas specified");if(a.Be){var b=a.fk;if(null!==b&&!b.Pa.kf&&!b.Pa.oc){var b=a.qf,c=a.Bz;b.setTransform(1,0,0,1,0,0);b.clearRect(0,0,a.Eb.width,a.Eb.height);b.drawImage(c.Gd,0,0);c=a.cd;c.reset();1!==a.scale&&c.scale(a.scale);0===a.position.x&&0===a.position.y||c.translate(-a.position.x,
-a.position.y);b.scale(a.zd,a.zd);b.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy);for(var c=a.$b.n,d=c.length,e=0;e<d;e++)c[e].se(b,a);a.fl=!1;a.Be=!1}}a.Xd=!1}}))}vl.prototype.computePixelRatio=function(){return 1};
vl.prototype.se=function(){null===this.Mb&&w.k("No div specified");null===this.Eb&&w.k("No canvas specified");if(this.Be){var a=this.fk;if(null!==a&&!a.Pa.kf){Bm(this);var b=a.Bn;(null!==b&&b.visible&&isNaN(b.width)||isNaN(b.height))&&Yl(a);var c=this.Eb,b=this.qf,d=this.Bz,e=this.QG;d.width=c.width;d.height=c.height;b.Ee(!0);b.setTransform(1,0,0,1,0,0);b.clearRect(0,0,c.width,c.height);d=this.cd;d.reset();1!==this.scale&&d.scale(this.scale);0===this.position.x&&0===this.position.y||d.translate(-this.position.x,
-this.position.y);b.scale(this.zd,this.zd);b.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);for(var d=this.vv,f=this.sb,h=a.$b.n,k=h.length,a=0;a<k;a++){var l=h[a],m=b,n=f,p=d;if(l.visible&&0!==l.vc&&(void 0===p&&(p=!0),p||!l.Jc)){1!==l.vc&&(m.globalAlpha=l.vc);for(var p=this.scale,l=l.zb.n,q=l.length,r=0;r<q;r++){var s=l[r],u=s.Y;u.Kg(n)&&(1<u.width*p||1<u.height*p?s.se(m,this):hl(s,m))}m.globalAlpha=1}}e.drawImage(c.Gd,0,0);c=this.$b.n;e=c.length;for(a=0;a<e;a++)c[a].se(b,this);this.Be=this.fl=!1}}};
w.defineProperty(vl,{NA:"observed"},function(){return this.fk},function(a){var b=this.fk;null!==a&&w.G(a,D,vl,"observed");a instanceof vl&&w.k("Overview.observed Diagram may not be an Overview itself: "+a);b!==a&&(null!==b&&(this.remove(this.rh),b.MF("ViewportBoundsChanged",this.BF),b.MF("DocumentBoundsChanged",this.AF),b.hw.remove(this)),this.fk=a,null!==a&&(a.Lz("ViewportBoundsChanged",this.BF),a.Lz("DocumentBoundsChanged",this.AF),a.hw.add(this),this.add(this.rh),On(this)),this.qc(),this.h("observed",
b,a))});w.defineProperty(vl,{rh:"box"},function(){return this.rm},function(a){var b=this.rm;b!==a&&(this.rm=a,this.remove(b),this.add(this.rm),On(this),this.h("box",b,a))});w.defineProperty(vl,{NK:"drawsTemporaryLayers"},function(){return this.vv},function(a){this.vv!==a&&(this.vv=a,this.Sx())});
function On(a){var b=a.rh;if(null!==b){var c=a.fk;if(null!==c){a.Be=!0;var c=c.sb,d=b.Eu,e=w.im();e.l(c.width,c.height);d.Aa=e;w.zk(e);a=2/a.scale;d instanceof X&&(d.kb=a);b.location=new z(c.x-a/2,c.y-a/2)}}}vl.prototype.sh=function(){var a=this.fk;return null===a?cd:a.qe};vl.prototype.bF=function(){!0!==this.Be&&(this.Be=!0,Pn(this))};
vl.prototype.uu=function(a,b,c,d,e){this.Rc||(Il(this),this.na(),Vl(this),this.qc(),On(this),this.nh.scale=c,this.nh.position.x=a.x,this.nh.position.y=a.y,this.nh.bounds.set(a),this.nh.isScroll=e,this.Ba("ViewportBoundsChanged",this.nh,a))};function Mn(){hh.call(this);this.pl=null}w.La(Mn,hh);
Mn.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.g;if(null===a||!a.Dl||!a.tf)return!1;var b=a.NA;if(null===b)return!1;if(null===this.findDraggablePart()){var c=b.sb;this.pl=new z(c.width/2,c.height/2);a=a.zc.ca;b.position=new z(a.x-this.pl.x,a.y-this.pl.y)}return!0};Mn.prototype.doActivate=function(){this.pl=null;hh.prototype.doActivate.call(this)};
Mn.prototype.moveParts=function(){var a=this.g,b=a.NA;if(null!==b){var c=a.rh;if(null!==c){if(null===this.pl){var d=a.zc.ca,c=c.location;this.pl=new z(d.x-c.x,d.y-c.y)}a=a.R.ca;b.position=new z(a.x-this.pl.x,a.y-this.pl.y)}}};function Nn(){uj.call(this)}w.La(Nn,uj);Nn.prototype.resize=function(a){var b=this.g.NA;if(null!==b){var c=b.sb.copy();b.position=a.position;(c.width!==a.width||c.height!==a.height)&&0<a.width&&0<a.height&&(b.scale=Math.min(c.width/a.width,c.height/a.height))}};
function Qn(){this.bg=this.Vc=this.vd=this.Bc=0}function ga(a){1<arguments.length&&w.k("Brush constructor can take at most one optional argument, the Brush type.");w.lc(this);this.Q=!1;void 0===a?(this.ma=kg,this.po="black"):"string"===typeof a?(this.ma=kg,this.po=a):(this.ma=a,this.po="black");var b=this.ma;b===lg?(this.qp=wb,this.Eo=Jb):this.Eo=b===$c?this.qp=Fb:this.qp=sb;this.yw=0;this.wv=NaN;this.bh=this.jw=this.ah=null;this.Gy=this.qo=0}w.fa("Brush",ga);var kg;ga.Solid=kg=w.p(ga,"Solid",0);
var lg;ga.Linear=lg=w.p(ga,"Linear",1);var $c;ga.Radial=$c=w.p(ga,"Radial",2);var Rn;ga.Pattern=Rn=w.p(ga,"Pattern",4);var Sn;ga.Lab=Sn=w.p(ga,"Lab",5);var Tn;ga.HSL=Tn=w.p(ga,"HSL",6);ga.prototype.copy=function(){var a=new ga;a.ma=this.ma;a.po=this.po;a.qp=this.qp.S();a.Eo=this.Eo.S();a.yw=this.yw;a.wv=this.wv;null!==this.ah&&(a.ah=this.ah.copy());a.jw=this.jw;return a};g=ga.prototype;g.Ga=function(){this.freeze();Object.freeze(this);return this};
g.freeze=function(){this.Q=!0;null!==this.ah&&this.ah.freeze();return this};g.Ra=function(){Object.isFrozen(this)&&w.k("cannot thaw constant: "+this);this.Q=!1;null!==this.ah&&this.ah.Ra();return this};g.fc=function(a){a.De===ga?this.type=a:w.Ej(this,a)};
g.toString=function(){var a="Brush(";if(this.type===kg)a+=this.color;else if(a=this.type===lg?a+"Linear ":this.type===$c?a+"Radial ":this.type===Rn?a+"Pattern ":a+"(unknown) ",a+=this.start+" "+this.end,null!==this.tk)for(var b=this.tk.i;b.next();)a+=" "+b.key+":"+b.value;return a+")"};
ga.prototype.addColorStop=ga.prototype.addColorStop=function(a,b){this.Q&&w.la(this);("number"!==typeof a||!isFinite(a)||1<a||0>a)&&w.Ea(a,"0 <= loc <= 1",ga,"addColorStop:loc");w.j(b,"string",ga,"addColorStop:color");null===this.ah&&(this.ah=new ka("number","string"));this.ah.add(a,b);this.ma===kg&&(this.type=lg);this.bh=null};
w.defineProperty(ga,{type:"type"},function(){return this.ma},function(a){this.Q&&w.la(this,a);w.mb(a,ga,ga,"type");this.ma=a;this.start.Nd()&&(a===lg?this.start=wb:a===$c&&(this.start=Fb));this.end.Nd()&&(a===lg?this.end=Jb:a===$c&&(this.end=Fb));this.bh=null});w.defineProperty(ga,{color:"color"},function(){return this.po},function(a){this.Q&&w.la(this,a);this.po=a;this.bh=null});
w.defineProperty(ga,{start:"start"},function(){return this.qp},function(a){this.Q&&w.la(this,a);w.G(a,L,ga,"start");this.qp=a.S();this.bh=null});w.defineProperty(ga,{end:"end"},function(){return this.Eo},function(a){this.Q&&w.la(this,a);w.G(a,L,ga,"end");this.Eo=a.S();this.bh=null});w.defineProperty(ga,{Ku:"startRadius"},function(){return this.yw},function(a){this.Q&&w.la(this,a);w.Ed(a,ga,"startRadius");0>a&&w.Ea(a,">= zero",ga,"startRadius");this.yw=a;this.bh=null});
w.defineProperty(ga,{It:"endRadius"},function(){return this.wv},function(a){this.Q&&w.la(this,a);w.Ed(a,ga,"endRadius");0>a&&w.Ea(a,">= zero",ga,"endRadius");this.wv=a;this.bh=null});w.defineProperty(ga,{tk:"colorStops"},function(){return this.ah},function(a){this.Q&&w.la(this,a);this.ah=a;this.bh=null});w.defineProperty(ga,{pattern:"pattern"},function(){return this.jw},function(a){this.Q&&w.la(this,a);this.jw=a;this.bh=null});
ga.randomColor=function(a,b){void 0===a&&(a=128);void 0===b&&(b=Math.max(a,255));var c=Math.abs(b-a),d=Math.floor(a+Math.random()*c).toString(16),e=Math.floor(a+Math.random()*c).toString(16),c=Math.floor(a+Math.random()*c).toString(16);2>d.length&&(d="0"+d);2>e.length&&(e="0"+e);2>c.length&&(c="0"+c);return"#"+d+e+c};var Un=(new Tc(null)).wk,fa;
ga.isValidColor=fa=function(a){if("black"===a)return!0;if(""===a)return!1;Un.fillStyle="#000000";var b=Un.fillStyle;Un.fillStyle=a;if(Un.fillStyle!==b)return!0;Un.fillStyle="#FFFFFF";b=Un.fillStyle;Un.fillStyle=a;return Un.fillStyle!==b};var Vn=new Qn,Wn=new Qn,Xn=new Qn,Yn=new Qn;ga.lighten=function(a){return Zn(a)};
ga.prototype.lightenBy=function(a,b){this.Q&&w.la(this);var c=void 0===a||"number"!==typeof a?.2:a,d=void 0===b?Sn:b;if(this.type===kg)$n(this.color),this.color=ao(c,d);else if((this.type===lg||this.type===$c)&&null!==this.tk)for(var e=this.tk.i;e.next();)$n(e.value),this.addColorStop(e.key,ao(c,d));return this};var Zn;ga.lightenBy=Zn=function(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?Sn:c;$n(a);return ao(b,c)};ga.darken=function(a){return bo(a)};
ga.prototype.darkenBy=function(a,b){this.Q&&w.la(this);var c=void 0===a||"number"!==typeof a?.2:a,d=void 0===b?Sn:b;if(this.type===kg)$n(this.color),this.color=ao(-c,d);else if((this.type===lg||this.type===$c)&&null!==this.tk)for(var e=this.tk.i;e.next();)$n(e.value),this.addColorStop(e.key,ao(-c,d));return this};var bo;ga.darkenBy=bo=function(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?Sn:c;$n(a);return ao(-b,c)};
function ao(a,b){switch(b){case Sn:var c=100*co(Vn.Bc),d=100*co(Vn.vd),e=100*co(Vn.Vc);Xn.Bc=.4124564*c+.3575761*d+.1804375*e;Xn.vd=.2126729*c+.7151522*d+.072175*e;Xn.Vc=.0193339*c+.119192*d+.9503041*e;Xn.bg=Vn.bg;c=eo(Xn.Bc/fo[0]);d=eo(Xn.vd/fo[1]);e=eo(Xn.Vc/fo[2]);Yn.Bc=116*d-16;Yn.vd=500*(c-d);Yn.Vc=200*(d-e);Yn.bg=Xn.bg;Yn.Bc=Math.min(100,Math.max(0,Yn.Bc+100*a));c=(Yn.Bc+16)/116;d=c-Yn.Vc/200;Xn.Bc=fo[0]*ho(Yn.vd/500+c);Xn.vd=fo[1]*(Yn.Bc>io*jo?Math.pow(c,3):Yn.Bc/io);Xn.Vc=fo[2]*ho(d);Xn.bg=
Yn.bg;c=-.969266*Xn.Bc+1.8760108*Xn.vd+.041556*Xn.Vc;d=.0556434*Xn.Bc+-.2040259*Xn.vd+1.0572252*Xn.Vc;Vn.Bc=255*ko((3.2404542*Xn.Bc+-1.5371385*Xn.vd+-.4985314*Xn.Vc)/100);Vn.vd=255*ko(c/100);Vn.Vc=255*ko(d/100);Vn.bg=Xn.bg;Vn.Bc=Math.round(Vn.Bc);255<Vn.Bc?Vn.Bc=255:0>Vn.Bc&&(Vn.Bc=0);Vn.vd=Math.round(Vn.vd);255<Vn.vd?Vn.vd=255:0>Vn.vd&&(Vn.vd=0);Vn.Vc=Math.round(Vn.Vc);255<Vn.Vc?Vn.Vc=255:0>Vn.Vc&&(Vn.Vc=0);return"rgba("+Vn.Bc+", "+Vn.vd+", "+Vn.Vc+", "+Vn.bg+")";case Tn:var e=Vn.Bc/255,f=Vn.vd/
255,h=Vn.Vc/255,k=Math.max(e,f,h),d=Math.min(e,f,h),l=k-d,d=(k+d)/2;if(0===l)c=e=0;else{switch(k){case e:c=(f-h)/l%6;break;case f:c=(h-e)/l+2;break;case h:c=(e-f)/l+4}c*=60;0>c&&(c+=360);e=l/(1-Math.abs(2*d-1))}Wn.Bc=Math.round(c);Wn.vd=Math.round(100*e);Wn.Vc=Math.round(100*d);Wn.bg=Vn.bg;Wn.Vc=Math.min(100,Math.max(0,Wn.Vc+100*a));return"hsla("+Wn.Bc+", "+Wn.vd+"%, "+Wn.Vc+"%, "+Wn.bg+")";default:return w.k("Unknown color space: "+b),"rgba(0, 0, 0, 1)"}}
function $n(a){Un.clearRect(0,0,1,1);Un.fillStyle="#000000";var b=Un.fillStyle;Un.fillStyle=a;Un.fillStyle!==b?(Un.fillRect(0,0,1,1),a=Un.getImageData(0,0,1,1).data,Vn.Bc=a[0],Vn.vd=a[1],Vn.Vc=a[2],Vn.bg=a[3]/255):(Un.fillStyle="#FFFFFF",Un.fillStyle=a,Vn.Bc=0,Vn.vd=0,Vn.Vc=0,Vn.bg=1)}function co(a){a/=255;return.04045>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}function ko(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055}var jo=216/24389,io=24389/27,fo=[95.047,100,108.883];
function eo(a){return a>jo?Math.pow(a,1/3):(io*a+16)/116}function ho(a){var b=a*a*a;return b>jo?b:(116*a-16)/io}
function G(){w.lc(this);this.P=4225027;this.vc=1;this.lh=null;this.Qb="";this.Zb=this.Db=null;this.hb=(new z(NaN,NaN)).freeze();this.Re=Dd;this.Vh=nd;this.Uh=Bd;this.cd=new ia;this.om=new ia;this.Qi=new ia;this.tb=this.Bo=1;this.gg=0;this.Ag=lo;this.Lm=dd;this.od=(new A(NaN,NaN,NaN,NaN)).freeze();this.mc=(new A(NaN,NaN,NaN,NaN)).freeze();this.Sc=(new A(0,0,NaN,NaN)).freeze();this.V=this.As=this.Bs=null;this.nm=this.ge=oc;this.Ns=0;this.aj=1;this.Uq=0;this.xi=1;this.ct=null;this.Rs=-Infinity;this.Wm=
0;this.Xm=bd;this.Ym=dj;this.cr="";this.sc=this.ha=null;this.no=-1;this.bn=this.jg=this.Yk=this.pp=null;this.rz=gj;this.Sm=null}w.ji(G);w.fa("GraphObject",G);
G.prototype.cloneProtected=function(a){a.P=this.P|6144;a.vc=this.vc;a.Qb=this.Qb;a.Db=this.Db;a.Zb=this.Zb;a.hb.assign(this.hb);a.Re=this.Re.S();a.Vh=this.Vh.S();a.Uh=this.Uh.S();a.Qi=this.Qi.copy();a.tb=this.tb;a.gg=this.gg;a.Ag=this.Ag;a.Lm=this.Lm.S();a.od.assign(this.od);a.mc.assign(this.mc);a.Sc.assign(this.Sc);a.As=this.As;null!==this.V&&(a.V=this.V.copy());a.ge=this.ge.S();a.nm=this.nm.S();a.Ns=this.Ns;a.aj=this.aj;a.Uq=this.Uq;a.xi=this.xi;a.ct=this.ct;a.Rs=this.Rs;a.Wm=this.Wm;a.Xm=this.Xm.S();
a.Ym=this.Ym;a.cr=this.cr;null!==this.ha&&(a.ha=this.ha.copy());a.sc=this.sc;a.no=this.no;null!==this.Yk&&(a.Yk=w.Hl(this.Yk));null!==this.jg&&(a.jg=this.jg.copy());a.bn=this.bn};G.prototype.addCopyProperty=G.prototype.YG=function(a){var b=this.Yk;if(w.isArray(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.Yk=b=[];b.push(a)};G.prototype.ki=function(a){a.Bs=null;a.Sm=null;a.I()};
G.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.Yk)for(var b=0;b<this.Yk.length;b++){var c=this.Yk[b];a[c]=this[c]}return a};G.prototype.copy=function(){return this.clone()};G.prototype.fc=function(a){a.De===W?0===a.name.indexOf("Orient")?this.rq=a:w.k("Unknown Link enum value for GraphObject.segmentOrientation property: "+a):a.De===G?this.stretch=a:w.Ej(this,a)};G.prototype.toString=function(){return w.hf(Object.getPrototypeOf(this))+"#"+w.Jd(this)};
var Ij;G.None=Ij=w.p(G,"None",0);var lo;G.Default=lo=w.p(G,"Default",0);var mo;G.Vertical=mo=w.p(G,"Vertical",4);var no;G.Horizontal=no=w.p(G,"Horizontal",5);var Ie;G.Fill=Ie=w.p(G,"Fill",3);var Kj;G.Uniform=Kj=w.p(G,"Uniform",1);var Lj;G.UniformToFill=Lj=w.p(G,"UniformToFill",2);var oo;G.FlipVertical=oo=w.p(G,"FlipVertical",1);var po;G.FlipHorizontal=po=w.p(G,"FlipHorizontal",2);var qo;G.FlipBoth=qo=w.p(G,"FlipBoth",3);function ro(a){null===a.ha&&(a.ha=new so)}
G.prototype.Kd=function(){if(null===this.V){var a=new to;a.Rj=sb;a.ok=sb;a.Pj=10;a.mk=10;a.Oj=uo;a.lk=uo;a.Qj=0;a.nk=0;this.V=a}};function vo(a,b,c,d,e,f,h){var k=.001,l=f.length;a.moveTo(b,c);d-=b;k=e-c;0===d&&(d=.001);e=k/d;for(var m=Math.sqrt(d*d+k*k),n=0,p=!0,q=0===h?!1:!0;.1<=m;){if(q){k=f[n++%l];for(k-=h;0>k;)k+=f[n++%l],p=!p;q=!1}else k=f[n++%l];k>m&&(k=m);var r=Math.sqrt(k*k/(1+e*e));0>d&&(r=-r);b+=r;c+=e*r;p?a.lineTo(b,c):a.moveTo(b,c);m-=k;p=!p}}
G.prototype.raiseChangedEvent=G.prototype.Wc=function(a,b,c,d,e,f,h){var k=this.U;if(null!==k&&(k.Tn(a,b,c,d,e,f,h),wo(this)&&c===this&&a===Mf&&xo(this,k,b),c===k&&0!==(k.P&16777216)&&null!==k.data))for(a=this.wa.n,c=a.length,d=0;d<c;d++)e=a[d],e instanceof C&&Im(e,function(a){null!==a.data&&0!==(a.P&16777216)&&a.Hb(b)})};
function xo(a,b,c){var d=a.Pl();if(null!==d)for(var e=a.sc.i;e.next();){var f=e.value,h=null;if(null!==f.yq){h=Yg(f,d,a);if(null===h)continue;f.ky(a,h,c,null)}else if(f.zx){var k=b.g;null===k||k.Ne||f.ky(a,k.ba.Fk,c,d)}else{var l=d.data;if(null===l)continue;k=b.g;null===k||k.Ne||f.ky(a,l,c,d)}h===a&&(k=d.hx(f.hm),null!==k&&f.vG(k,h,c))}}G.prototype.hx=function(a){return this.no===a?this:null};G.prototype.raiseChanged=G.prototype.h=function(a,b,c){this.Wc(Mf,a,this,b,c)};
function yo(a,b,c,d,e){var f=a.od,h=a.Qi;h.reset();zo(a,h,b,c,d,e);a.Qi=h;f.x=b;f.y=c;f.width=d;f.height=e;h.cu()||h.sG(f)}function Ao(a,b,c,d){if(!1===a.Sg)return!1;d.multiply(a.transform);return c?a.Kg(b,d):a.on(b,d)}
G.prototype.JE=function(a,b,c){if(!1===this.Sg)return!1;var d=this.Ia;b=a.uf(b);var e=!1;c&&(e=Ma(a.x,a.y,0,0,0,d.height)<b||Ma(a.x,a.y,0,d.height,d.width,d.height)<b||Ma(a.x,a.y,d.width,d.height,d.width,0)<b||Ma(a.x,a.y,d.width,0,0,0)<b);c||(e=Ma(a.x,a.y,0,0,0,d.height)<b&&Ma(a.x,a.y,0,d.height,d.width,d.height)<b&&Ma(a.x,a.y,d.width,d.height,d.width,0)<b&&Ma(a.x,a.y,d.width,0,0,0)<b);return e};G.prototype.Yg=function(){return!0};
G.prototype.containsPoint=G.prototype.Ha=function(a){var b=w.K();b.assign(a);this.transform.nb(b);var c=this.Y;if(!c.H())return w.v(b),!1;var d=this.g;if(null!==d&&d.gl){var e=d.Ut("extraTouchThreshold"),f=d.Ut("extraTouchArea"),h=f/2,k=this.Ia,d=this.nj()*d.scale,l=1/d;if(k.width*d<e&&k.height*d<e)return a=db(c.x-h*l,c.y-h*l,c.width+f*l,c.height+f*l,b.x,b.y),w.v(b),a}if(this instanceof dh||this instanceof X?db(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y):c.Ha(b))return e=!1,e=this.jg&&!this.jg.Ha(b)?
!1:null!==this.Zb&&c.Ha(b)?!0:null!==this.Db&&this.Sc.Ha(a)?!0:this.uk(a),w.v(b),e;w.v(b);return!1};G.prototype.uk=function(a){var b=this.Ia;return db(0,0,b.width,b.height,a.x,a.y)};G.prototype.containsRect=G.prototype.vk=function(a){if(0===this.angle)return this.Y.vk(a);var b=this.Ia,b=w.Vg(0,0,b.width,b.height),c=this.transform,d=!1,e=w.xb(a.x,a.y);b.Ha(c.li(e))&&(e.l(a.x,a.bottom),b.Ha(c.li(e))&&(e.l(a.right,a.bottom),b.Ha(c.li(e))&&(e.l(a.right,a.y),b.Ha(c.li(e))&&(d=!0))));w.v(e);w.Gb(b);return d};
G.prototype.containedInRect=G.prototype.on=function(a,b){if(void 0===b)return a.vk(this.Y);var c=this.Ia,d=!1,e=w.xb(0,0);a.Ha(b.nb(e))&&(e.l(0,c.height),a.Ha(b.nb(e))&&(e.l(c.width,c.height),a.Ha(b.nb(e))&&(e.l(c.width,0),a.Ha(b.nb(e))&&(d=!0))));w.v(e);return d};
G.prototype.intersectsRect=G.prototype.Kg=function(a,b){if(void 0===b&&(b=this.transform,0===this.angle))return a.Kg(this.Y);var c=this.Ia,d=b,e=w.xb(0,0),f=w.xb(0,c.height),h=w.xb(c.width,c.height),k=w.xb(c.width,0),l=!1;if(a.Ha(d.nb(e))||a.Ha(d.nb(f))||a.Ha(d.nb(h))||a.Ha(d.nb(k)))l=!0;else{var c=w.Vg(0,0,c.width,c.height),m=w.xb(a.x,a.y);c.Ha(d.li(m))?l=!0:(m.l(a.x,a.bottom),c.Ha(d.li(m))?l=!0:(m.l(a.right,a.bottom),c.Ha(d.li(m))?l=!0:(m.l(a.right,a.y),c.Ha(d.li(m))&&(l=!0))));w.v(m);w.Gb(c);!l&&
(qe(a,e,f)||qe(a,f,h)||qe(a,h,k)||qe(a,k,e))&&(l=!0)}w.v(e);w.v(f);w.v(h);w.v(k);return l};G.prototype.getDocumentPoint=G.prototype.Wa=function(a,b){void 0===b&&(b=new z);if(a instanceof L){a.Nd()&&w.k("getDocumentPoint:s Spot must be specific: "+a.toString());var c=this.Ia;b.l(a.x*c.width+a.offsetX,a.y*c.height+a.offsetY)}else b.set(a);this.ph.nb(b);return b};
G.prototype.getDocumentAngle=G.prototype.xn=function(){var a;a=this.ph;1===a.m11&&0===a.m12?a=0:(a=180*Math.atan2(a.m12,a.m11)/Math.PI,0>a&&(a+=360));return a};G.prototype.getDocumentScale=G.prototype.nj=function(){if(0!==(this.P&4096)===!1)return this.Bo;var a=this.tb;return null!==this.O?a*this.O.nj():a};G.prototype.getLocalPoint=G.prototype.OE=function(a,b){void 0===b&&(b=new z);b.assign(a);this.ph.li(b);return b};
G.prototype.getNearestIntersectionPoint=G.prototype.PE=function(a,b,c){return this.zn(a.x,a.y,b.x,b.y,c)};g=G.prototype;g.zn=function(a,b,c,d,e){var f=this.transform,h=1/(f.m11*f.m22-f.m12*f.m21),k=f.m22*h,l=-f.m12*h,m=-f.m21*h,n=f.m11*h,p=h*(f.m21*f.dy-f.m22*f.dx),q=h*(f.m12*f.dx-f.m11*f.dy);if(null!==this.jn)return f=this.Y,oe(f.left,f.top,f.right,f.bottom,a,b,c,d,e);h=a*k+b*m+p;a=a*l+b*n+q;b=c*k+d*m+p;c=c*l+d*n+q;e.l(0,0);d=this.Ia;c=oe(0,0,d.width,d.height,h,a,b,c,e);e.transform(f);return c};
function rk(a,b,c,d,e){if(!1!==ym(a)){var f=a.margin,h=f.right+f.left,f=f.top+f.bottom;b=Math.max(b-h,0);c=Math.max(c-f,0);e=e||0;d=Math.max((d||0)-h,0);e=Math.max(e-f,0);var h=a.angle,f=0,f=a.Aa,k=0;a instanceof X&&(k=a.kb);90===h||270===h?(b=isFinite(f.height)?f.height+k:b,c=isFinite(f.width)?f.width+k:c):(b=isFinite(f.width)?f.width+k:b,c=isFinite(f.height)?f.height+k:c);var f=d||0,k=e||0,l=a instanceof C;switch(Bo(a,!0)){case Ij:k=f=0;l&&(c=b=Infinity);break;case Ie:isFinite(b)&&b>d&&(f=b);isFinite(c)&&
c>e&&(k=c);break;case no:isFinite(b)&&b>d&&(f=b);k=0;l&&(c=Infinity);break;case mo:isFinite(c)&&c>e&&(k=c),f=0,l&&(b=Infinity)}var l=a.Af,m=a.zh;f>l.width&&m.width<l.width&&(f=l.width);k>l.height&&m.height<l.height&&(k=l.height);d=Math.max(f/a.scale,m.width);e=Math.max(k/a.scale,m.height);l.width<d&&(d=Math.min(m.width,d));l.height<e&&(e=Math.min(m.height,e));b=Math.min(l.width,b);c=Math.min(l.height,c);b=Math.max(d,b);c=Math.max(e,c);if(90===h||270===h)f=b,b=c,c=f,f=d,d=e,e=f;a.od.Ra();a.Ln(b,c,
d,e);a.od.freeze();a.od.H()||w.k("Non-real measuredBounds has been set. Object "+a+", measuredBounds: "+a.od.toString());Xl(a,!1)}}g.Ln=function(){};g.rj=function(){return!1};
g.gc=function(a,b,c,d,e){this.Ii();var f=w.Df();f.assign(this.mc);this.mc.Ra();if(!1===zm(this)){var h=this.mc;h.x=a;h.y=b;h.width=c;h.height=d}else this.hj(a,b,c,d);this.mc.freeze();this.jg=void 0===e?null:e;c=!1;void 0!==e?c=!0:null!==this.O&&(e=this.O.Sc,d=this.za,null!==this.jn&&(d=this.mc),c=b+d.height,d=a+d.width,c=!(0<=a+.05&&d<=e.width+.05&&0<=b+.05&&c<=e.height+.05),this instanceof Ch&&(a=this.Sc,this.Wv>a.height||this.Oi.ef>a.width))&&(c=!0);this.P=c?this.P|256:this.P&-257;this.mc.H()||
w.k("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.mc.toString());this.Lx(f,this.mc);Co(this,!1);w.Gb(f)};g.hj=function(){};
function Do(a,b,c,d,e){var f=a.Y;f.x=b;f.y=c;f.width=d;f.height=e;if(!a.Aa.H()){f=a.od;c=a.margin;b=c.right+c.left;var h=c.top+c.bottom;c=f.width+b;f=f.height+h;d+=b;e+=h;b=Bo(a,!0);c===d&&f===e&&(b=Ij);switch(b){case Ij:if(c>d||f>e)Xl(a,!0),rk(a,c>d?d:c,f>e?e:f);break;case Ie:Xl(a,!0);rk(a,d,e,0,0);break;case no:Xl(a,!0);rk(a,d,f,0,0);break;case mo:Xl(a,!0),rk(a,c,e,0,0)}}}
g.Lx=function(a,b){var c=this.U;null!==c&&null!==c.g&&(c.Eu!==this&&c.SF!==this&&c.VF!==this||Eo(c,!0),this.na(),Qa(a,b)||(c.Vl(),this.dw(c)))};g.dw=function(a){null!==this.Pd&&(Eo(a,!0),a instanceof T&&Fo(a,this))};w.defineProperty(G,{vq:"shadowVisible"},function(){return this.bn},function(a){var b=this.bn;b!==a&&(this.bn=a,this.na(),this.h("shadowVisible",b,a))});
G.prototype.se=function(a,b){if(this.visible){var c=this.mc;if(0!==c.width&&0!==c.height&&!isNaN(c.x)&&!isNaN(c.y)){var d=this.opacity,e=1;if(1!==d){if(0===d)return;e=a.globalAlpha;a.globalAlpha=e*d}if(a instanceof Lc)a:{if(this.visible){var f=null,h=a.Bx;if(this instanceof C&&(this.type===Go||this.type===Ho))Io(this,a,b);else{var k=this.mc;if(0!==k.width&&0!==k.height&&!isNaN(k.x)&&!isNaN(k.y)){var l=this.transform,m=this.O;0!==(this.P&4096)===!0&&Jo(this);var c=0!==(this.P&256),n=!1;this instanceof
Ch&&(a.font=this.font);if(c){n=m.Yg()?m.Ia:m.Y;if(null!==this.jg)var p=this.jg,q=p.x,r=p.y,s=p.width,p=p.height;else q=Math.max(k.x,n.x),r=Math.max(k.y,n.y),s=Math.min(k.right,n.right)-q,p=Math.min(k.bottom,n.bottom)-r;if(q>k.width+k.x||k.x>n.width+n.x||r>k.height+k.y||k.y>n.height+n.y)break a;n=!0;Nc(a,1,0,0,1,0,0);a.save();a.beginPath();a.rect(q,r,s,p);a.clip()}if(this.rj()){var u=this;if(!u.isVisible())break a}a.uh.Sb=[1,0,0,1,0,0];q=!1;this.rj()&&this.Zl&&b.oj("drawShadows")&&(r=this.an,a.hB(r.x*
b.scale*b.zd,r.y*b.scale*b.zd,u.zg),a.Xn(),a.shadowColor=u.$m);u=!1;this.U&&b.oj("drawShadows")&&(u=this.U.Zl);!0===this.vq?(a.Xn(),!1===q&&u&&(Nc(a,1,0,0,1,0,0),a.$a(),q=!0)):!1===this.vq&&a.Wn();null!==this.Zb&&(Ko(this,a,this.Zb,!0,!0),!1===q&&u&&(Nc(a,1,0,0,1,0,0),a.$a(),q=!0),this.Zb instanceof ga&&this.Zb.type===$c?(a.beginPath(),a.rect(k.x,k.y,k.width,k.height),a.Hg(this.Zb)):a.fillRect(k.x,k.y,k.width,k.height));this instanceof C?Nc(a,l.m11,l.m12,l.m21,l.m22,l.dx,l.dy):a.uh.Sb=[l.m11,l.m12,
l.m21,l.m22,l.dx,l.dy];null!==this.Db&&(!1===q&&u&&(Nc(a,1,0,0,1,0,0),a.$a(),q=!0),s=this.Ia,l=k=0,r=s.width,s=s.height,p=0,this instanceof X&&(s=this.gb.jb,k=s.x,l=s.y,r=s.width,s=s.height,p=this.fi),Ko(this,a,this.Db,!0,!1),this.Db instanceof ga&&this.Db.type===$c?(a.beginPath(),a.rect(k-p/2,l-p/2,r+p,s+p),a.Hg(this.Db)):a.fillRect(k-p/2,l-p/2,r+p,s+p));u&&(null!==this.Db||null!==this.Zb||null!==m&&0!==(m.P&512)||null!==m&&(m.type===Bl||m.type===Gj)&&m.Hd()!==this)?(Lo(this,!0),null===this.vq&&
a.Wn()):Lo(this,!1);this.xk(a,b);u&&0!==(this.P&512)===!0&&a.Xn();this.rj()&&u&&a.Wn();c&&(a.restore(),n&&a.wf.pop());this instanceof C&&(f=a.wf.pop());!0===q&&a.wf.pop();null!==a.BE&&(null===f&&(h===a.Bx?(Nc(a,1,0,0,1,0,0),f=a.wf.pop()):f=a.Bx),a.BE(this,f))}}}}else{if(this instanceof C&&(this.type===Go||this.type===Ho)){Io(this,a,b);1!==d&&(a.globalAlpha=e);return}this instanceof W&&this.lu(!1);f=this.transform;h=this.O;0!==(this.P&4096)===!0&&Jo(this);m=0!==(this.P&256);a.Kp&&(m=!1);this instanceof
Ch&&(a.font=this.font);if(m){n=h.Yg()?h.Ia:h.Y;null!==this.jg?(q=this.jg,k=q.x,l=q.y,u=q.width,q=q.height):(k=Math.max(c.x,n.x),l=Math.max(c.y,n.y),u=Math.min(c.right,n.right)-k,q=Math.min(c.bottom,n.bottom)-l);if(k>c.width+c.x||c.x>n.width+n.x||l>c.height+c.y||c.y>n.height+n.y){1!==d&&(a.globalAlpha=e);return}a.save();a.beginPath();a.rect(k,l,u,q);a.clip()}if(this.rj()){if(!this.isVisible()){1!==d&&(a.globalAlpha=e);return}this.Zl&&b.oj("drawShadows")&&(n=this.an,a.hB(n.x*b.scale*b.zd,n.y*b.scale*
b.zd,this.zg),a.Xn(),a.shadowColor=this.$m)}n=!1;this.U&&b.oj("drawShadows")&&(n=this.U.Zl);!0===this.vq?a.Xn():!1===this.vq&&a.Wn();null!==this.Zb&&(Ko(this,a,this.Zb,!0,!0),this.Zb instanceof ga&&this.Zb.type===$c?(a.beginPath(),a.rect(c.x,c.y,c.width,c.height),a.Hg(this.Zb)):a.fillRect(c.x,c.y,c.width,c.height));f.cu()||a.transform(f.m11,f.m12,f.m21,f.m22,f.dx,f.dy);null!==this.Db&&(u=this.Ia,k=c=0,l=u.width,u=u.height,q=0,this instanceof X&&(u=this.gb.jb,c=u.x,k=u.y,l=u.width,u=u.height,q=this.fi),
Ko(this,a,this.Db,!0,!1),this.Db instanceof ga&&this.Db.type===$c?(a.beginPath(),a.rect(c-q/2,k-q/2,l+q,u+q),a.Hg(this.Db)):a.fillRect(c-q/2,k-q/2,l+q,u+q));n&&(null!==this.Db||null!==this.Zb||null!==h&&0!==(h.P&512)||null!==h&&(h.type===Bl||h.type===Gj)&&h.Hd()!==this)?(Lo(this,!0),null===this.vq&&a.Wn()):Lo(this,!1);this.xk(a,b);n&&0!==(this.P&512)===!0&&a.Xn();this.rj()&&n&&a.Wn();m?(a.restore(),this instanceof C?a.Ee(!0):a.Ee(!1)):f.cu()||(h=1/(f.m11*f.m22-f.m12*f.m21),a.transform(f.m22*h,-f.m12*
h,-f.m21*h,f.m11*h,h*(f.m21*f.dy-f.m22*f.dx),h*(f.m12*f.dx-f.m11*f.dy)))}1!==d&&(a.globalAlpha=e)}}};
function Io(a,b,c){var d=a.mc;0===d.width||0===d.height||isNaN(d.x)||isNaN(d.y)||(null!==a.Zb&&(Ko(a,b,a.Zb,!0,!0),a.Zb instanceof ga&&a.Zb.type===$c?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Hg(a.Zb)):b.fillRect(d.x,d.y,d.width,d.height)),null!==a.Db&&(Ko(a,b,a.Db,!0,!1),a.Db instanceof ga&&a.Db.type===$c?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Hg(a.Db)):b.fillRect(d.x,d.y,d.width,d.height)),a.xk(b,c))}G.prototype.xk=function(){};
function Ko(a,b,c,d,e){if(null!==c){var f=1,h=1;if("string"===typeof c)d?b.fillStyle=c:b.strokeStyle=c;else if(c.type===kg)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{var k,h=a.Ia,f=h.width,h=h.height;if(e)var l=a.Y,f=l.width,h=l.height;var m=b instanceof Uc;if(m&&c.bh&&(c.type===Rn||c.qo===f&&c.Gy===h))k=c.bh;else{var n=l=0,p=0,q=0,r=0,s=0,s=r=0;e&&(l=a.Y,f=l.width,h=l.height,r=l.x,s=l.y);l=c.start.x*f+c.start.offsetX;n=c.start.y*h+c.start.offsetY;p=c.end.x*f+c.end.offsetX;q=c.end.y*h+c.end.offsetY;
l+=r;p+=r;n+=s;q+=s;if(c.type===lg)k=b.createLinearGradient(l,n,p,q);else if(c.type===$c)s=isNaN(c.It)?Math.max(f,h)/2:c.It,isNaN(c.Ku)?(r=0,s=Math.max(f,h)/2):r=c.Ku,k=b.createRadialGradient(l,n,r,p,q,s);else if(c.type===Rn)try{k=b.createPattern(c.pattern,"repeat")}catch(u){k=null}else w.wd(c.type,"Brush type");if(c.type!==Rn&&(e=c.tk,null!==e))for(e=e.i;e.next();)k.addColorStop(e.key,e.value);if(m&&(c.bh=k,null!==k&&(c.qo=f,c.Gy=h),null===k&&c.type===Rn&&-1!==c.qo)){c.qo=-1;var t=a.g;null!==t&&
-1===c.qo&&w.setTimeout(function(){t.Sx()},600)}}d?b.fillStyle=k:b.strokeStyle=k}}}G.prototype.isContainedBy=G.prototype.Xl=function(a){if(a instanceof C)a:{if(this!==a&&null!==a)for(var b=this.O;null!==b;){if(b===a){a=!0;break a}b=b.O}a=!1}else a=!1;return a};G.prototype.isVisibleObject=G.prototype.vj=function(){if(!this.visible)return!1;var a=this.O;return null!==a?a.vj():!0};
G.prototype.isEnabledObject=G.prototype.au=function(){for(var a=this instanceof C?this:this.O;null!==a&&a.isEnabled;)a=a.O;return null===a};w.defineProperty(G,{CE:"enabledChanged"},function(){return null!==this.ha?this.ha.sr:null},function(a){ro(this);var b=this.ha.sr;b!==a&&(null!==a&&w.j(a,"function",G,"enabledChanged"),this.ha.sr=a,this.h("enabledChanged",b,a))});
function Jo(a){if(0!==(a.P&2048)===!0){var b=a.cd;b.reset();if(!a.mc.H()||!a.od.H()){Mo(a,!1);return}b.translate(a.mc.x,a.mc.y);b.translate(-a.za.x,-a.za.y);var c=a.Ia;zo(a,b,c.x,c.y,c.width,c.height);Mo(a,!1);No(a,!0)}0!==(a.P&4096)===!0&&(b=a.O,null===b?(a.om.set(a.cd),a.Bo=a.scale,No(a,!1)):null!==b.ph&&(c=a.om,c.reset(),b.Yg()?c.multiply(b.om):null!==b.O&&c.multiply(b.O.om),c.multiply(a.cd),a.Bo=a.scale*b.Bo,No(a,!1)))}
function zo(a,b,c,d,e,f){1!==a.scale&&b.scale(a.scale);if(0!==a.angle){var h=Fb;a.rj()&&a.zf.fd()&&(h=a.zf);var k=w.K();if(a instanceof S&&a.Xf!==a)for(c=a.Xf,d=c.Ia,k.Hu(d.x,d.y,d.width,d.height,h),c.Qi.nb(k),k.offset(-c.za.x,-c.za.y),h=c.O;null!==h&&h!==a;)h.Qi.nb(k),k.offset(-h.za.x,-h.za.y),h=h.O;else k.Hu(c,d,e,f,h);b.rotate(a.angle,k.x,k.y);w.v(k)}}g=G.prototype;g.I=function(a){void 0===a&&(a=!1);if(!0!==ym(this)){Xl(this,!0);Co(this,!0);var b=this.O;null===b||a||b.I()}};
g.bq=function(){!0!==ym(this)&&(Xl(this,!0),Co(this,!0))};function Oo(a){if(!1===zm(a)){var b=a.O;null!==b?b.I():a.rj()&&(b=a.g,null!==b&&(b.qg.add(a),a instanceof T&&a.Tf(),b.Le()));Co(a,!0)}}g.Ii=function(){0!==(this.P&2048)===!1&&(Mo(this,!0),No(this,!0))};g.uA=function(){No(this,!0)};g.na=function(){var a=this.U;null!==a&&a.na()};
function Bo(a,b){var c=a.stretch,d=a.O;if(null!==d&&d.ma===Po)return Qo(a,d.be(a.Yb),d.ae(a.column),b);if(null!==d&&d.ma===Bl&&d.Hd()===a)return Ro(a,Ie,b);if(c===lo){if(null!==d){if(d.ma===Gj&&d.Hd()===a)return Ro(a,Ie,b);c=d.Zd;return c===lo?Ro(a,Ij,b):Ro(a,c,b)}return Ro(a,Ij,b)}return Ro(a,c,b)}
function Qo(a,b,c,d){var e=a.stretch;if(e!==lo)return Ro(a,e,d);var f=e=null;switch(b.stretch){case mo:f=!0;break;case Ie:f=!0}switch(c.stretch){case no:e=!0;break;case Ie:e=!0}b=a.O.Zd;null===e&&(e=b===no||b===Ie);null===f&&(f=b===mo||b===Ie);return!0===e&&!0===f?Ro(a,Ie,d):!0===e?Ro(a,no,d):!0===f?Ro(a,mo,d):Ro(a,Ij,d)}
function Ro(a,b,c){if(c)return b;if(b===Ij)return Ij;c=a.Aa;if(c.H())return Ij;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===no)return Ij;if(b===Ie)return mo}else{if(b===mo)return Ij;if(b===Ie)return no}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===mo)return Ij;if(b===Ie)return no}else{if(b===no)return Ij;if(b===Ie)return mo}return b}
w.defineProperty(G,{rq:"segmentOrientation"},function(){return this.Ym},function(a){var b=this.Ym;b!==a&&(this.Ym=a,this.I(),this.h("segmentOrientation",b,a),a===dj&&(this.angle=0))});w.defineProperty(G,{Me:"segmentIndex"},function(){return this.Rs},function(a){a=Math.round(a);var b=this.Rs;b!==a&&(this.Rs=a,this.I(),this.h("segmentIndex",b,a))});
w.defineProperty(G,{XA:"segmentFraction"},function(){return this.Wm},function(a){isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.Wm;b!==a&&(this.Wm=a,this.I(),this.h("segmentFraction",b,a))});w.defineProperty(G,{YA:"segmentOffset"},function(){return this.Xm},function(a){var b=this.Xm;b.L(a)||(this.Xm=a=a.S(),this.I(),this.h("segmentOffset",b,a))});w.defineProperty(G,{stretch:"stretch"},function(){return this.Ag},function(a){var b=this.Ag;b!==a&&(this.Ag=a,this.I(),this.h("stretch",b,a))});
w.defineProperty(G,{name:"name"},function(){return this.Qb},function(a){var b=this.Qb;b!==a&&(this.Qb=a,null!==this.U&&(this.U.Nm=null),this.h("name",b,a))});w.defineProperty(G,{opacity:"opacity"},function(){return this.vc},function(a){var b=this.vc;b!==a&&(w.j(a,"number",G,"opacity"),(0>a||1<a)&&w.Ea(a,"0 <= value <= 1",G,"opacity"),this.vc=a,this.h("opacity",b,a),a=this.g,b=this.U,null!==a&&null!==b&&a.na(jl(b,b.Y)))});
w.defineProperty(G,{visible:"visible"},function(){return 0!==(this.P&1)},function(a){var b=0!==(this.P&1);b!==a&&(this.P^=1,this.h("visible",b,a),b=this.O,null!==b?b.I():this.rj()&&this.td(a),this.na(),So(this))});w.defineProperty(G,{Sg:"pickable"},function(){return 0!==(this.P&2)},function(a){var b=0!==(this.P&2);b!==a&&(this.P^=2,this.h("pickable",b,a))});
w.defineProperty(G,{QH:"fromLinkableDuplicates"},function(){return 0!==(this.P&4)},function(a){var b=0!==(this.P&4);b!==a&&(this.P^=4,this.h("fromLinkableDuplicates",b,a))});w.defineProperty(G,{RH:"fromLinkableSelfNode"},function(){return 0!==(this.P&8)},function(a){var b=0!==(this.P&8);b!==a&&(this.P^=8,this.h("fromLinkableSelfNode",b,a))});
w.defineProperty(G,{IJ:"toLinkableDuplicates"},function(){return 0!==(this.P&16)},function(a){var b=0!==(this.P&16);b!==a&&(this.P^=16,this.h("toLinkableDuplicates",b,a))});w.defineProperty(G,{JJ:"toLinkableSelfNode"},function(){return 0!==(this.P&32)},function(a){var b=0!==(this.P&32);b!==a&&(this.P^=32,this.h("toLinkableSelfNode",b,a))});w.defineProperty(G,{Uf:"isPanelMain"},function(){return 0!==(this.P&64)},function(a){var b=0!==(this.P&64);b!==a&&(this.P^=64,this.I(),this.h("isPanelMain",b,a))});
w.defineProperty(G,{sx:"isActionable"},function(){return 0!==(this.P&128)},function(a){var b=0!==(this.P&128);b!==a&&(this.P^=128,this.h("isActionable",b,a))});w.defineProperty(G,{jn:"areaBackground"},function(){return this.Zb},function(a){var b=this.Zb;b!==a&&(a instanceof ga&&a.freeze(),this.Zb=a,this.na(),this.h("areaBackground",b,a))});
w.defineProperty(G,{background:"background"},function(){return this.Db},function(a){var b=this.Db;b!==a&&(a instanceof ga&&a.freeze(),this.Db=a,this.na(),this.h("background",b,a))});function Lo(a,b){a.P=b?a.P|512:a.P&-513}function wo(a){return 0!==(a.P&1024)}function To(a,b){a.P=b?a.P|1024:a.P&-1025}function Mo(a,b){a.P=b?a.P|2048:a.P&-2049}function No(a,b){a.P=b?a.P|4096:a.P&-4097}function ym(a){return 0!==(a.P&8192)}function Xl(a,b){a.P=b?a.P|8192:a.P&-8193}
function zm(a){return 0!==(a.P&16384)}function Co(a,b){a.P=b?a.P|16384:a.P&-16385}w.u(G,{U:"part"},function(){if(this.rj())return this;if(null!==this.Sm)return this.Sm;var a;for(a=this.O;a;){if(a instanceof S)return this.Sm=a;a=a.O}return null});w.u(G,{O:"panel"},function(){return this.lh});G.prototype.em=function(a){this.lh=a};w.u(G,{layer:"layer"},function(){var a=this.U;return null!==a?a.layer:null},{configurable:!0});w.u(G,{g:"diagram"},function(){var a=this.U;return null!==a?a.g:null},{configurable:!0});
w.defineProperty(G,{position:"position"},function(){return this.hb},function(a){var b=a.x,c=a.y,d=this.hb,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))?this.eB():(a=a.S(),this.dB(a,d)&&this.h("position",d,a))});G.prototype.eB=function(){};G.prototype.dB=function(a){this.hb=a;Oo(this);this.Ii();return!0};G.prototype.hy=function(a,b){this.hb.l(a,b);this.Ii()};w.u(G,{Y:"actualBounds"},function(){return this.mc});
w.defineProperty(G,{scale:"scale"},function(){return this.tb},function(a){var b=this.tb;b!==a&&(0>=a&&w.k("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.tb=a,this.Ii(),this.I(),this.h("scale",b,a))});w.defineProperty(G,{angle:"angle"},function(){return this.gg},function(a){var b=this.gg;b!==a&&(a%=360,0>a&&(a+=360),b!==a&&(this.gg=a,this.I(),this.Ii(),this.h("angle",b,a)))});
w.defineProperty(G,{Aa:"desiredSize"},function(){return this.Re},function(a){var b=a.width,c=a.height,d=this.Re,e=d.width,f=d.height;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(this.Re=a=a.S(),this.I(),this instanceof X&&this.Ke(),this.h("desiredSize",d,a),wo(this)&&(a=this.U,null!==a&&(xo(this,a,"width"),xo(this,a,"height"))))});
w.defineProperty(G,{width:"width"},function(){return this.Re.width},function(a){var b=this.Re.width;b===a||isNaN(b)&&isNaN(a)||(b=this.Re,this.Re=a=(new ha(a,this.Re.height)).freeze(),this.I(),this instanceof X&&this.Ke(),this.h("desiredSize",b,a),wo(this)&&(a=this.U,null!==a&&xo(this,a,"width")))});
w.defineProperty(G,{height:"height"},function(){return this.Re.height},function(a){var b=this.Re.height;b===a||isNaN(b)&&isNaN(a)||(b=this.Re,this.Re=a=(new ha(this.Re.width,a)).freeze(),this.I(),this instanceof X&&this.Ke(),this.h("desiredSize",b,a),wo(this)&&(a=this.U,null!==a&&xo(this,a,"height")))});
w.defineProperty(G,{zh:"minSize"},function(){return this.Vh},function(a){var b=this.Vh;b.L(a)||(a=a.copy(),isNaN(a.width)&&(a.width=0),isNaN(a.height)&&(a.height=0),a.freeze(),this.Vh=a,this.I(),this.h("minSize",b,a))});w.defineProperty(G,{Af:"maxSize"},function(){return this.Uh},function(a){var b=this.Uh;b.L(a)||(a=a.copy(),isNaN(a.width)&&(a.width=Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.Uh=a,this.I(),this.h("maxSize",b,a))});w.u(G,{za:"measuredBounds"},function(){return this.od});
w.u(G,{Ia:"naturalBounds"},function(){return this.Sc},{configurable:!0});w.defineProperty(G,{margin:"margin"},function(){return this.Lm},function(a){"number"===typeof a&&(a=new eb(a));var b=this.Lm;b.L(a)||(this.Lm=a=a.S(),this.I(),this.h("margin",b,a))});w.u(G,{transform:null},function(){0!==(this.P&2048)===!0&&Jo(this);return this.cd});w.u(G,{ph:null},function(){0!==(this.P&4096)===!0&&Jo(this);return this.om});
w.defineProperty(G,{alignment:"alignment"},function(){return this.ge},function(a){var b=this.ge;b.L(a)||(a.Nd()&&!a.Uc()&&w.k("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+a),this.ge=a=a.S(),Oo(this),this.h("alignment",b,a))});w.defineProperty(G,{column:"column"},function(){return this.Uq},function(a){a=Math.round(a);var b=this.Uq;b!==a&&(0>a&&w.Ea(a,">= 0",G,"column"),this.Uq=a,this.I(),this.h("column",b,a))});
w.defineProperty(G,{qH:"columnSpan"},function(){return this.xi},function(a){a=Math.round(a);var b=this.xi;b!==a&&(1>a&&w.Ea(a,">= 1",G,"columnSpan"),this.xi=a,this.I(),this.h("columnSpan",b,a))});w.defineProperty(G,{Yb:"row"},function(){return this.Ns},function(a){a=Math.round(a);var b=this.Ns;b!==a&&(0>a&&w.Ea(a,">= 0",G,"row"),this.Ns=a,this.I(),this.h("row",b,a))});
w.defineProperty(G,{rowSpan:"rowSpan"},function(){return this.aj},function(a){a=Math.round(a);var b=this.aj;b!==a&&(1>a&&w.Ea(a,">= 1",G,"rowSpan"),this.aj=a,this.I(),this.h("rowSpan",b,a))});w.defineProperty(G,{iy:"spanAllocation"},function(){return this.ct},function(a){var b=this.ct;b!==a&&(null!==a&&w.j(a,"function",G,"spanAllocation"),this.ct=a,this.I(),this.h("spanAllocation",b,a))});
w.defineProperty(G,{oh:"alignmentFocus"},function(){return this.nm},function(a){var b=this.nm;b.L(a)||(!a.Nd()||a.Uc()||a.L(sb)&&this instanceof T||w.k("GraphObject.alignmentFocus must be a real Spot or Spot.Default, not: "+a),this.nm=a=a.S(),this.I(),this.h("alignmentFocus",b,a))});
w.defineProperty(G,{Pd:"portId"},function(){return this.As},function(a){var b=this.As;if(b!==a){var c=this.U;null===c||c instanceof T||(w.k("Cannot set portID on a Link: "+a),c=null);null!==b&&null!==c&&Uo(c,this);this.As=a;if(null!==a&&c){c.Ck=!0;null===c.le&&Vo(c);var d=this.Pd;null!==d&&c.le.add(d,this)}this.h("portId",b,a)}});function Wo(a){var b=a.U;if(b instanceof T&&(null!==a.Pd||a===b.port)){var c=b.g;null===c||c.oa.fb||Fo(b,a)}}
function So(a){var b=a.g;null===b||b.oa.fb||(a instanceof C?a instanceof T?a.Tf():Xo(a,a,function(a){Wo(a)}):Wo(a))}w.defineProperty(G,{Bb:"toSpot"},function(){return null!==this.V?this.V.ok:sb},function(a){this.Kd();var b=this.V.ok;b.L(a)||(a=a.S(),this.V.ok=a,this.h("toSpot",b,a),Wo(this))});
w.defineProperty(G,{jm:"toEndSegmentLength"},function(){return null!==this.V?this.V.mk:10},function(a){this.Kd();var b=this.V.mk;b!==a&&(0>a&&w.Ea(a,">= 0",G,"toEndSegmentLength"),this.V.mk=a,this.h("toEndSegmentLength",b,a),Wo(this))});w.defineProperty(G,{Lu:"toEndSegmentDirection"},function(){return null!==this.V?this.V.lk:uo},function(a){this.Kd();var b=this.V.lk;b!==a&&(w.Gt("GraphObject.toEndSegmentDirection","2.0"),this.V.lk=a,this.h("toEndSegmentDirection",b,a),Wo(this))});
w.defineProperty(G,{Mu:"toShortLength"},function(){return null!==this.V?this.V.nk:0},function(a){this.Kd();var b=this.V.nk;b!==a&&(this.V.nk=a,this.h("toShortLength",b,a),Wo(this))});w.defineProperty(G,{mG:"toLinkable"},function(){return null!==this.V?this.V.lt:null},function(a){this.Kd();var b=this.V.lt;b!==a&&(this.V.lt=a,this.h("toLinkable",b,a))});
w.defineProperty(G,{KJ:"toMaxLinks"},function(){return null!==this.V?this.V.mt:Infinity},function(a){this.Kd();var b=this.V.mt;b!==a&&(0>a&&w.Ea(a,">= 0",G,"toMaxLinks"),this.V.mt=a,this.h("toMaxLinks",b,a))});w.defineProperty(G,{Ab:"fromSpot"},function(){return null!==this.V?this.V.Rj:sb},function(a){this.Kd();var b=this.V.Rj;b.L(a)||(a=a.S(),this.V.Rj=a,this.h("fromSpot",b,a),Wo(this))});
w.defineProperty(G,{Rl:"fromEndSegmentLength"},function(){return null!==this.V?this.V.Pj:10},function(a){this.Kd();var b=this.V.Pj;b!==a&&(0>a&&w.Ea(a,">= 0",G,"fromEndSegmentLength"),this.V.Pj=a,this.h("fromEndSegmentLength",b,a),Wo(this))});w.defineProperty(G,{St:"fromEndSegmentDirection"},function(){return null!==this.V?this.V.Oj:uo},function(a){this.Kd();var b=this.V.Oj;b!==a&&(w.Gt("GraphObject.fromEndSegmentDirection","2.0"),this.V.Oj=a,this.h("fromEndSegmentDirection",b,a),Wo(this))});
w.defineProperty(G,{Tt:"fromShortLength"},function(){return null!==this.V?this.V.Qj:0},function(a){this.Kd();var b=this.V.Qj;b!==a&&(this.V.Qj=a,this.h("fromShortLength",b,a),Wo(this))});w.defineProperty(G,{ME:"fromLinkable"},function(){return null!==this.V?this.V.vr:null},function(a){this.Kd();var b=this.V.vr;b!==a&&(this.V.vr=a,this.h("fromLinkable",b,a))});
w.defineProperty(G,{jA:"fromMaxLinks"},function(){return null!==this.V?this.V.wr:Infinity},function(a){this.Kd();var b=this.V.wr;b!==a&&(0>a&&w.Ea(a,">= 0",G,"fromMaxLinks"),this.V.wr=a,this.h("fromMaxLinks",b,a))});w.defineProperty(G,{cursor:"cursor"},function(){return this.cr},function(a){var b=this.cr;b!==a&&(w.j(a,"string",G,"cursor"),this.cr=a,this.h("cursor",b,a))});
w.defineProperty(G,{click:"click"},function(){return null!==this.ha?this.ha.wi:null},function(a){ro(this);var b=this.ha.wi;b!==a&&(null!==a&&w.j(a,"function",G,"click"),this.ha.wi=a,this.h("click",b,a))});w.defineProperty(G,{Ht:"doubleClick"},function(){return null!==this.ha?this.ha.Ei:null},function(a){ro(this);var b=this.ha.Ei;b!==a&&(null!==a&&w.j(a,"function",G,"doubleClick"),this.ha.Ei=a,this.h("doubleClick",b,a))});
w.defineProperty(G,{Uz:"contextClick"},function(){return null!==this.ha?this.ha.yi:null},function(a){ro(this);var b=this.ha.yi;b!==a&&(null!==a&&w.j(a,"function",G,"contextClick"),this.ha.yi=a,this.h("contextClick",b,a))});w.defineProperty(G,{nu:"mouseEnter"},function(){return null!==this.ha?this.ha.ls:null},function(a){ro(this);var b=this.ha.ls;b!==a&&(null!==a&&w.j(a,"function",G,"mouseEnter"),this.ha.ls=a,this.h("mouseEnter",b,a))});
w.defineProperty(G,{ou:"mouseLeave"},function(){return null!==this.ha?this.ha.ms:null},function(a){ro(this);var b=this.ha.ms;b!==a&&(null!==a&&w.j(a,"function",G,"mouseLeave"),this.ha.ms=a,this.h("mouseLeave",b,a))});w.defineProperty(G,{JA:"mouseOver"},function(){return null!==this.ha?this.ha.Vi:null},function(a){ro(this);var b=this.ha.Vi;b!==a&&(null!==a&&w.j(a,"function",G,"mouseOver"),this.ha.Vi=a,this.h("mouseOver",b,a))});
w.defineProperty(G,{IA:"mouseHover"},function(){return null!==this.ha?this.ha.Ui:null},function(a){ro(this);var b=this.ha.Ui;b!==a&&(null!==a&&w.j(a,"function",G,"mouseHover"),this.ha.Ui=a,this.h("mouseHover",b,a))});w.defineProperty(G,{HA:"mouseHold"},function(){return null!==this.ha?this.ha.Ti:null},function(a){ro(this);var b=this.ha.Ti;b!==a&&(null!==a&&w.j(a,"function",G,"mouseHold"),this.ha.Ti=a,this.h("mouseHold",b,a))});
w.defineProperty(G,{TI:"mouseDragEnter"},function(){return null!==this.ha?this.ha.js:null},function(a){ro(this);var b=this.ha.js;b!==a&&(null!==a&&w.j(a,"function",G,"mouseDragEnter"),this.ha.js=a,this.h("mouseDragEnter",b,a))});w.defineProperty(G,{UI:"mouseDragLeave"},function(){return null!==this.ha?this.ha.ks:null},function(a){ro(this);var b=this.ha.ks;b!==a&&(null!==a&&w.j(a,"function",G,"mouseDragLeave"),this.ha.ks=a,this.h("mouseDragLeave",b,a))});
w.defineProperty(G,{GA:"mouseDrop"},function(){return null!==this.ha?this.ha.Si:null},function(a){ro(this);var b=this.ha.Si;b!==a&&(null!==a&&w.j(a,"function",G,"mouseDrop"),this.ha.Si=a,this.h("mouseDrop",b,a))});w.defineProperty(G,{ZD:"actionDown"},function(){return null!==this.ha?this.ha.Cq:null},function(a){ro(this);var b=this.ha.Cq;b!==a&&(null!==a&&w.j(a,"function",G,"actionDown"),this.ha.Cq=a,this.h("actionDown",b,a))});
w.defineProperty(G,{$D:"actionMove"},function(){return null!==this.ha?this.ha.Dq:null},function(a){ro(this);var b=this.ha.Dq;b!==a&&(null!==a&&w.j(a,"function",G,"actionMove"),this.ha.Dq=a,this.h("actionMove",b,a))});w.defineProperty(G,{aE:"actionUp"},function(){return null!==this.ha?this.ha.Eq:null},function(a){ro(this);var b=this.ha.Eq;b!==a&&(null!==a&&w.j(a,"function",G,"actionUp"),this.ha.Eq=a,this.h("actionUp",b,a))});
w.defineProperty(G,{YD:"actionCancel"},function(){return null!==this.ha?this.ha.Bq:null},function(a){ro(this);var b=this.ha.Bq;b!==a&&(null!==a&&w.j(a,"function",G,"actionCancel"),this.ha.Bq=a,this.h("actionCancel",b,a))});w.defineProperty(G,{nB:"toolTip"},function(){return null!==this.ha?this.ha.dj:null},function(a){ro(this);var b=this.ha.dj;b!==a&&(this.ha.dj=a,this.h("toolTip",b,a))});
w.defineProperty(G,{contextMenu:"contextMenu"},function(){return null!==this.ha?this.ha.zi:null},function(a){ro(this);var b=this.ha.zi;b!==a&&(this.ha.zi=a,this.h("contextMenu",b,a))});G.prototype.bind=G.prototype.bind=function(a){a.Bg=this;var b=this.Pl();null!==b&&Yo(b)&&w.k("Cannot add a Binding to a template that has already been copied: "+a);null===this.sc&&(this.sc=new I(Vg));this.sc.add(a)};
G.prototype.findTemplateBinder=G.prototype.Pl=function(){for(var a=this instanceof C?this:this.O;null!==a;){if(null!==a.Wk)return a;a=a.O}return null};G.prototype.setProperties=function(a){w.Fu(this,a)};var Zo;
G.make=Zo=function(a,b){var c=arguments,d=null,e=null;if("function"===typeof a)e=a;else if("string"===typeof a){var f=$o.ka(a);"function"===typeof f?(c=w.Hl(arguments),d=f(c),w.Qa(d)||w.k('GraphObject.make invoked object builder "'+a+'", but it did not return an Object')):e=da[a]}null===d&&(void 0!==e&&null!==e&&e.constructor||w.k("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: "+a),d=new e);f=1;if(d instanceof D&&1<c.length){var h=d,e=c[1];if("string"===
typeof e||e instanceof HTMLDivElement)zl(h,e),f++}for(;f<c.length;f++)e=c[f],void 0===e?w.k("Undefined value at argument "+f+" for object being constructed by GraphObject.make: "+d):ap(d,e);return d};
function ap(a,b){if("string"===typeof b)if(a instanceof Ch)a.text=b;else if(a instanceof X)a.Cb=b;else if(a instanceof tl)a.source=b;else if(a instanceof C){var c=pa(C,b);null!==c?a.type=c:w.k("Unknown Panel type as an argument to GraphObject.make: "+b)}else a instanceof ga?(c=pa(ga,b),null!==c?a.type=c:w.k("Unknown Brush type as an argument to GraphObject.make: "+b)):a instanceof Fe?(c=pa(Fe,b),null!==c?a.type=c:w.k("Unknown Geometry type as an argument to GraphObject.make: "+b)):a instanceof yf?
(c=pa(yf,b),null!==c?a.type=c:w.k("Unknown PathSegment type as an argument to GraphObject.make: "+b)):w.k("Unable to use a string as an argument to GraphObject.make: "+b);else if(b instanceof G)c=b,a instanceof C||w.k("A GraphObject can only be added to a Panel, not to: "+a),a.add(c);else if(b instanceof Pg){var d=b,c=a,e;d.ve&&c.getRowDefinition?e=c.getRowDefinition(d.index):!d.ve&&c.getColumnDefinition?e=c.getColumnDefinition(d.index):w.k("A RowColumnDefinition can only be added to a Panel, not to: "+
a);e.Mp(d)}else if(b instanceof ea)"function"===typeof a.fc?a.fc(b):w.Ej(a,b);else if(b instanceof Vg)a instanceof G?a.bind(b):a instanceof Pg?a.bind(b):w.k("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+a);else if(b instanceof He)a instanceof Fe?a.cc.add(b):w.k("A PathFigure can only be added to a Geometry, not to: "+a);else if(b instanceof yf)a instanceof He?a.vb.add(b):w.k("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof pg)a instanceof
D?a.Rb=b:a instanceof U?a.Rb=b:w.k("A Layout can only be assigned to a Diagram or a Group, not to: "+a);else if(Array.isArray(b))for(c=0;c<b.length;c++)ap(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof ga){e=new sa;for(c in b)d=parseFloat(c),isNaN(d)?e[c]=b[c]:a.addColorStop(d,b[c]);w.Fu(a,e)}else if(a instanceof Pg){void 0!==b.row?(e=b.row,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&w.k("Must specify non-negative integer row for RowColumnDefinition "+b+", not: "+e),a.ve=!0,
a.index=e):void 0!==b.column&&(e=b.column,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&w.k("Must specify non-negative integer column for RowColumnDefinition "+b+", not: "+e),a.ve=!1,a.index=e);e=new sa;for(c in b)"row"!==c&&"column"!==c&&(e[c]=b[c]);w.Fu(a,e)}else w.Fu(a,b);else w.k('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+a)}var $o=new ka("string","function");
G.getBuilders=function(){var a=new ka("string","function"),b;for(b in $o)if(b!==b.toLowerCase()){var c=$o[b];"function"===typeof c&&a.add(b,c)}a.freeze();return a};var bp;G.defineBuilder=bp=function(a,b){w.j(a,"string",G,"defineBuilder:name");w.j(b,"function",G,"defineBuilder:func");var c=a.toLowerCase();""!==a&&"none"!==c&&a!==c||w.k("Shape.defineFigureGenerator name must not be empty or None or all-lower-case: "+a);$o.add(a,b)};var cp;
G.takeBuilderArgument=cp=function(a,b,c){void 0===c&&(c=null);var d=a[1];if("function"===typeof c?c(d):"string"===typeof d)return a.splice(1,1),d;if(void 0===b)throw Error("no "+("function"===typeof c?"satisfactory":"string")+" argument for GraphObject builder "+a[0]);return b};
bp("Button",function(){var a=new ga(lg);a.addColorStop(0,"white");a.addColorStop(1,"lightgray");var b=new ga(lg);b.addColorStop(0,"white");b.addColorStop(1,"dodgerblue");a=Zo(C,Bl,{sx:!0,CE:function(a,b){var e=a.sd("ButtonBorder");null!==e&&(e.fill=b?a._buttonFillNormal:a._buttonFillDisabled)},_buttonFillNormal:a,_buttonStrokeNormal:"gray",_buttonFillOver:b,_buttonStrokeOver:"blue",_buttonFillDisabled:"darkgray"},Zo(X,{name:"ButtonBorder",Cb:"Rectangle",A:new L(0,0,2.761423749153968,2.761423749153968),
B:new L(1,1,-2.761423749153968,-2.761423749153968),fill:a,stroke:"gray"}));a.nu=function(a,b){if(b.au()){var e=b.sd("ButtonBorder");if(e instanceof X){var f=b._buttonFillOver;b._buttonFillNormal=e.fill;e.fill=f;f=b._buttonStrokeOver;b._buttonStrokeNormal=e.stroke;e.stroke=f}}};a.ou=function(a,b){if(b.au()){var e=b.sd("ButtonBorder");e instanceof X&&(e.fill=b._buttonFillNormal,e.stroke=b._buttonStrokeNormal)}};return a});
bp("TreeExpanderButton",function(){var a=Zo("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},Zo(X,{name:"ButtonIcon",Cb:"MinusLine",Aa:yd},(new Vg("figure","isTreeExpanded",function(a,c){var d=c.O;return a?d._treeExpandedFigure:d._treeCollapsedFigure})).Kx()),{visible:!1},(new Vg("visible","isTreeLeaf",function(a){return!a})).Kx());a.click=function(a,c){var d=c.U;d instanceof dh&&(d=d.Nf);if(d instanceof T){var e=d.g;if(null!==e){e=e.ob;if(d.gd){if(!e.canCollapseTree(d))return}else if(!e.canExpandTree(d))return;
a.Ac=!0;d.gd?e.collapseTree(d):e.expandTree(d)}}};return a});
bp("SubGraphExpanderButton",function(){var a=Zo("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},Zo(X,{name:"ButtonIcon",Cb:"MinusLine",Aa:yd},(new Vg("figure","isSubGraphExpanded",function(a,c){var d=c.O;return a?d._subGraphExpandedFigure:d._subGraphCollapsedFigure})).Kx()));a.click=function(a,c){var d=c.U;d instanceof dh&&(d=d.Nf);if(d instanceof U){var e=d.g;if(null!==e){e=e.ob;if(d.we){if(!e.canCollapseSubGraph(d))return}else if(!e.canExpandSubGraph(d))return;a.Ac=
!0;d.we?e.collapseSubGraph(d):e.expandSubGraph(d)}}};return a});bp("ContextMenuButton",function(){var a=Zo("Button");a.stretch=no;var b=a.sd("ButtonBorder");b instanceof X&&(b.Cb="Rectangle",b.A=new L(0,0,2,3),b.B=new L(1,1,-2,-2));return a});
bp("PanelExpanderButton",function(a){var b=cp(a,"COLLAPSIBLE"),c=Zo("Button",{_buttonExpandedFigure:"TriangleUp",_buttonCollapsedFigure:"TriangleDown"},Zo(X,"TriangleUp",{name:"ButtonIcon",Aa:new ha(6,4)},(new Vg("figure","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).Kx(b)));a=c.sd("ButtonBorder");a instanceof X&&(a.stroke=null,a.fill="transparent");c.click=function(a,c){var f=c.g;if(null!==f&&!f.cb){var h=c.Pl();null===h&&(h=c.U);null!==h&&(h=h.sd(b),null!==h&&
(f.Tb("Collapse/Expand Panel"),h.visible=!h.visible,f.Fd("Collapse/Expand Panel")))}};return c});
bp("CheckBoxButton",function(a){var b=cp(a);a=Zo("Button",{"ButtonBorder.fill":"white","ButtonBorder.stroke":"gray",width:14,height:14},Zo(X,{name:"ButtonIcon",SH:"M0 4 L3 9 9 0",kb:2,stretch:Ie,kA:Kj,visible:!1},""!==b?(new Vg("visible",b)).HI():[]));a.click=function(a,d){var e=a.g;if(!(null===e||e.cb||""!==b&&e.ba.cb)){a.Ac=!0;var f=d.sd("ButtonIcon");e.Tb("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a,d);e.Fd("checkbox")}};return a});
bp("CheckBox",function(a){a=cp(a);a=Zo("CheckBoxButton",a,{name:"Button",margin:new eb(0,1,0,0)});var b=Zo(C,"Horizontal",a,{sx:!0,margin:1,_buttonFillNormal:a._buttonFillNormal,_buttonStrokeNormal:a._buttonStrokeNormal,_buttonFillOver:a._buttonFillOver,_buttonStrokeOver:a._buttonStrokeOver,_buttonFillDisabled:a._buttonFillDisabled,nu:a.nu,ou:a.ou,click:a.click,_buttonClick:a.click});a.nu=null;a.ou=null;a.click=null;return b});
function so(){this.sr=this.zi=this.dj=this.Bq=this.Eq=this.Dq=this.Cq=this.Si=this.ks=this.js=this.Ti=this.Ui=this.Vi=this.ms=this.ls=this.yi=this.Ei=this.wi=null}so.prototype.copy=function(){var a=new so;a.wi=this.wi;a.Ei=this.Ei;a.yi=this.yi;a.ls=this.ls;a.ms=this.ms;a.Vi=this.Vi;a.Ui=this.Ui;a.Ti=this.Ti;a.js=this.js;a.ks=this.ks;a.Si=this.Si;a.Cq=this.Cq;a.Dq=this.Dq;a.Eq=this.Eq;a.Bq=this.Bq;a.dj=this.dj;a.zi=this.zi;a.sr=this.sr;return a};
function C(a){G.call(this);void 0===a?this.ma=Nj:(w.mb(a,C,C,"type"),this.ma=a);this.wa=new I(G);this.ff=dd;this.ma===El&&(this.En=!0);this.gr=oc;this.Ci=lo;this.ma===Po&&dp(this);this.Cp=Kj;this.Er=Ad;this.Fr=bd;this.Br=0;this.Ar=100;this.Dr=10;this.Cr=0;this.Wk=this.Vd=this.Sj=this.xm=this.zm=null;this.Rr=NaN;this.sg=this.Zj=null;this.To="category";this.rg=null;this.fj=new A(NaN,NaN,NaN,NaN);this.kk=this.Os=this.dn=null;this.Hj=""}w.La(C,G);w.ji(C);w.fa("Panel",C);
function dp(a){a.Lj=dd;a.Mh=1;a.Bi=null;a.um=null;a.Lh=1;a.Kh=null;a.tm=null;a.Yd=[];a.Td=[];a.Vm=ep;a.sm=ep;a.ej=0;a.Ni=0}
C.prototype.cloneProtected=function(a){G.prototype.cloneProtected.call(this,a);a.ma=this.ma;a.ff=this.ff.S();a.gr=this.gr.S();a.Ci=this.Ci;if(a.ma===Po){a.Lj=this.Lj.S();a.Mh=this.Mh;a.Bi=this.Bi;a.um=this.um;a.Lh=this.Lh;a.Kh=this.Kh;a.tm=this.tm;var b=[];if(0<this.Yd.length)for(var c=this.Yd,d=c.length,e=0;e<d;e++)if(void 0!==c[e]){var f=c[e].copy();f.em(a);b[e]=f}a.Yd=b;b=[];if(0<this.Td.length)for(c=this.Td,d=c.length,e=0;e<d;e++)void 0!==c[e]&&(f=c[e].copy(),f.em(a),b[e]=f);a.Td=b;a.Vm=this.Vm;
a.sm=this.sm;a.ej=this.ej;a.Ni=this.Ni}a.Cp=this.Cp;a.Er=this.Er.S();a.Fr=this.Fr.S();a.Br=this.Br;a.Ar=this.Ar;a.Dr=this.Dr;a.Cr=this.Cr;a.zm=this.zm;a.Sj=this.Sj;a.Vd=this.Vd;a.Wk=this.Wk;a.Rr=this.Rr;a.Zj=this.Zj;a.sg=this.sg;a.To=this.To;a.fj.assign(this.fj);a.Hj=this.Hj;null!==this.Os&&(a.Os=this.Os)};C.prototype.ki=function(a){G.prototype.ki.call(this,a);a.wa=this.wa;for(var b=a.wa.n,c=b.length,d=0;d<c;d++)b[d].lh=a;a.dn=null};
C.prototype.copy=function(){var a=G.prototype.copy.call(this);if(null!==a){for(var b=this.wa.n,c=b.length,d=0;d<c;d++){var e=b[d].copy(),f=a;e.em(f);e.Sm=null;var h=f.wa,k=h.count;h.Ld(k,e);h=f.U;if(null!==h){h.Nm=null;null!==e.Pd&&h instanceof T&&(h.Ck=!0);var l=f.g;null!==l&&l.oa.fb||h.Wc(Of,"elements",f,null,e,null,k)}}return a}return null};C.prototype.fc=function(a){a.De===C?this.type=a:G.prototype.fc.call(this,a)};C.prototype.toString=function(){return"Panel("+this.type+")#"+w.Jd(this)};var Nj;
C.Position=Nj=w.p(C,"Position",0);C.Horizontal=w.p(C,"Horizontal",1);var Al;C.Vertical=Al=w.p(C,"Vertical",2);var Gj;C.Spot=Gj=w.p(C,"Spot",3);var Bl;C.Auto=Bl=w.p(C,"Auto",4);var Po;C.Table=Po=w.p(C,"Table",5);C.Viewbox=w.p(C,"Viewbox",6);var Go;C.TableRow=Go=w.p(C,"TableRow",7);var Ho;C.TableColumn=Ho=w.p(C,"TableColumn",8);var aj;C.Link=aj=w.p(C,"Link",9);var El;C.Grid=El=w.p(C,"Grid",10);var fp;C.Graduated=fp=w.p(C,"Graduated",11);
w.defineProperty(C,{type:"type"},function(){return this.ma},function(a){var b=this.ma;b!==a&&(b!==Go&&b!==Ho||w.k("Cannot change Panel.type when it is already a TableRow or a TableColumn: "+a),this.ma=a,this.ma===El?this.En=!0:this.ma===Po&&dp(this),this.I(),this.h("type",b,a))});w.u(C,{elements:"elements"},function(){return this.wa.i});w.u(C,{Ia:"naturalBounds"},function(){return this.Sc});
w.defineProperty(C,{padding:"padding"},function(){return this.ff},function(a){"number"===typeof a?(0>a&&w.Ea(a,">= 0",C,"padding"),a=new eb(a)):(w.G(a,eb,C,"padding"),0>a.left&&w.Ea(a.left,">= 0",C,"padding:value.left"),0>a.right&&w.Ea(a.right,">= 0",C,"padding:value.right"),0>a.top&&w.Ea(a.top,">= 0",C,"padding:value.top"),0>a.bottom&&w.Ea(a.bottom,">= 0",C,"padding:value.bottom"));var b=this.ff;b.L(a)||(this.ff=a=a.S(),this.I(),this.h("padding",b,a))});
w.defineProperty(C,{Ll:"defaultAlignment"},function(){return this.gr},function(a){var b=this.gr;b.L(a)||(this.gr=a=a.S(),this.I(),this.h("defaultAlignment",b,a))});w.defineProperty(C,{Zd:"defaultStretch"},function(){return this.Ci},function(a){var b=this.Ci;b!==a&&(w.mb(a,G,C,"defaultStretch"),this.Ci=a,this.I(),this.h("defaultStretch",b,a))});
w.defineProperty(C,{IK:"defaultSeparatorPadding"},function(){return void 0===this.Lj?dd:this.Lj},function(a){if(void 0!==this.Lj){"number"===typeof a&&(a=new eb(a));var b=this.Lj;b.L(a)||(this.Lj=a=a.S(),this.I(),this.h("defaultSeparatorPadding",b,a))}});
w.defineProperty(C,{GK:"defaultRowSeparatorStroke"},function(){return void 0===this.Bi?null:this.Bi},function(a){var b=this.Bi;b!==a&&(null===a||"string"===typeof a||a instanceof ga)&&(a instanceof ga&&a.freeze(),this.Bi=a,this.na(),this.h("defaultRowSeparatorStroke",b,a))});
w.defineProperty(C,{HK:"defaultRowSeparatorStrokeWidth"},function(){return void 0===this.Mh?1:this.Mh},function(a){if(void 0!==this.Mh){var b=this.Mh;b!==a&&isFinite(a)&&0<=a&&(this.Mh=a,this.I(),this.h("defaultRowSeparatorStrokeWidth",b,a))}});
w.defineProperty(C,{FK:"defaultRowSeparatorDashArray"},function(){return void 0===this.um?null:this.um},function(a){if(void 0!==this.um){var b=this.um;if(b!==a){null===a||Array.isArray(a)||w.wd(a,"Array",C,"defaultRowSeparatorDashArray:value");if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||w.k("defaultRowSeparatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.um=a;this.na();
this.h("defaultRowSeparatorDashArray",b,a)}}});w.defineProperty(C,{AK:"defaultColumnSeparatorStroke"},function(){return void 0===this.Kh?null:this.Kh},function(a){if(void 0!==this.Kh){var b=this.Kh;b!==a&&(null===a||"string"===typeof a||a instanceof ga)&&(a instanceof ga&&a.freeze(),this.Kh=a,this.na(),this.h("defaultColumnSeparatorStroke",b,a))}});
w.defineProperty(C,{BK:"defaultColumnSeparatorStrokeWidth"},function(){return void 0===this.Lh?1:this.Lh},function(a){if(void 0!==this.Lh){var b=this.Lh;b!==a&&isFinite(a)&&0<=a&&(this.Lh=a,this.I(),this.h("defaultColumnSeparatorStrokeWidth",b,a))}});
w.defineProperty(C,{zK:"defaultColumnSeparatorDashArray"},function(){return void 0===this.tm?null:this.tm},function(a){if(void 0!==this.tm){var b=this.tm;if(b!==a){null===a||Array.isArray(a)||w.wd(a,"Array",C,"defaultColumnSeparatorDashArray:value");if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||w.k("defaultColumnSeparatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.tm=
a;this.na();this.h("defaultColumnSeparatorDashArray",b,a)}}});w.defineProperty(C,{SL:"viewboxStretch"},function(){return this.Cp},function(a){var b=this.Cp;b!==a&&(w.mb(a,G,C,"viewboxStretch"),this.Cp=a,this.I(),this.h("viewboxStretch",b,a))});
w.defineProperty(C,{px:"gridCellSize"},function(){return this.Er},function(a){var b=this.Er;if(!b.L(a)){w.G(a,ha,C,"gridCellSize");a.H()&&0!==a.width&&0!==a.height||w.k("Invalid Panel.gridCellSize: "+a);this.Er=a.S();var c=this.g;null!==c&&this===c.Bn&&Yl(c);this.na();this.h("gridCellSize",b,a)}});
w.defineProperty(C,{VE:"gridOrigin"},function(){return this.Fr},function(a){var b=this.Fr;if(!b.L(a)){w.G(a,z,C,"gridOrigin");a.H()||w.k("Invalid Panel.gridOrigin: "+a);this.Fr=a.S();var c=this.g;null!==c&&this===c.Bn&&Yl(c);this.na();this.h("gridOrigin",b,a)}});w.defineProperty(C,{Bk:"graduatedMin"},function(){return this.Br},function(a){w.Ed(a,C,"graduatedMin");var b=this.Br;b!==a&&(this.Br=a,this.I(),this.h("graduatedMin",b,a),wo(this)&&(a=this.U,null!==a&&xo(this,a,"graduatedRange")))});
w.defineProperty(C,{nA:"graduatedMax"},function(){return this.Ar},function(a){w.Ed(a,C,"graduatedMax");var b=this.Ar;b!==a&&(this.Ar=a,this.I(),this.h("graduatedMax",b,a),wo(this)&&(a=this.U,null!==a&&xo(this,a,"graduatedRange")))});w.u(C,{ox:"graduatedRange"},function(){return this.nA-this.Bk});w.defineProperty(C,{oA:"graduatedTickUnit"},function(){return this.Dr},function(a){w.Ed(a,C,"graduatedTickUnit");var b=this.Dr;b!==a&&0<a&&(this.Dr=a,this.I(),this.h("graduatedTickUnit",b,a))});
w.defineProperty(C,{UE:"graduatedTickBase"},function(){return this.Cr},function(a){w.Ed(a,C,"graduatedTickBase");var b=this.Cr;b!==a&&(this.Cr=a,this.I(),this.h("graduatedTickBase",b,a))});g=C.prototype;g.dw=function(a){G.prototype.dw.call(this,a);for(var b=this.wa.n,c=b.length,d=0;d<c;d++)b[d].dw(a)};
g.xk=function(a,b){if(this.ma===El){var c=this.nj()*b.scale;0>=c&&(c=1);var d=this.px,e=d.width,d=d.height,f=this.Ia,h=f.width,f=f.height,k=Math.ceil(h/e),l=Math.ceil(f/d),m=this.VE;a.save();a.beginPath();a.rect(0,0,h,f);a.clip();for(var n=[],p=this.wa.n,q=p.length,r=0;r<q;r++){var s=p[r],u=[];n.push(u);if(s.visible)for(var s=Tm(s.Cb),t=r+1;t<q;t++){var x=p[t];x.visible&&Tm(x.Cb)===s&&(x=x.interval,2<=x&&u.push(x))}}p=this.wa.n;q=p.length;for(r=0;r<q;r++){var v=p[r];if(v.visible&&(u=v.interval,!(2>
e*u*c))){var s=n[r],t=!1,B=!0,y=v.jG;null!==y&&(t=!0,B=a.dA(y,v.sf));if("LineV"===v.Cb){a.lineWidth=v.kb;Ko(this,a,v.stroke,!1,!1);a.beginPath();for(var H=x=Math.floor(-m.x/e);H<=x+k;H++){var E=H*e+m.x;0<=E&&E<h&&gp(H,u,s)&&(t&&!B?vo(a,E,0,E,f,y,v.sf):(a.moveTo(E,0),a.lineTo(E,f)))}a.stroke()}else if("LineH"===v.Cb){a.lineWidth=v.kb;Ko(this,a,v.stroke,!1,!1);a.beginPath();for(H=x=Math.floor(-m.y/d);H<=x+l;H++)E=H*d+m.y,0<=E&&E<=f&&gp(H,u,s)&&(t&&!B?vo(a,0,E,h,E,y,v.sf):(a.moveTo(0,E),a.lineTo(h,E)));
a.stroke()}else if("BarV"===v.Cb)for(Ko(this,a,v.fill,!0,!1),v=v.width,isNaN(v)&&(v=e),H=x=Math.floor(-m.x/e);H<=x+k;H++)E=H*e+m.x,0<=E&&E<h&&gp(H,u,s)&&a.fillRect(E,0,v,f);else if("BarH"===v.Cb)for(Ko(this,a,v.fill,!0,!1),v=v.height,isNaN(v)&&(v=d),H=x=Math.floor(-m.y/d);H<=x+l;H++)E=H*d+m.y,0<=E&&E<=f&&gp(H,u,s)&&a.fillRect(0,E,h,v);t&&a.aA()}}a.restore();a.Ee(!1)}else if(this.ma===fp){e=this.Ia;c=e.width;e=e.height;a.save();a.beginPath();a.rect(-1,-1,c+1,e+1);a.clip();c=this.Hd();c.se(a,b);e=this.nj()*
b.scale;0>=e&&(e=1);d=c.Y;h=this.wa.n;f=this.zm;k=h.length;for(l=0;l<k;l++)if(q=h[l],m=f[l],n=m.length,q.visible&&q!==c&&0!==m.length)if(q instanceof X){if(!(2>this.oA*q.interval*e))for(r=q.za,u=q.kb*q.scale,s=q.oh,s.Nd()&&(s=wb),p=0;p<n;p++){var t=q,x=m[p][0],H=d,v=m[p][1],B=r,y=u,E=s,V=t.cd;V.reset();V.translate(x.x+H.x,x.y+H.y);V.rotate(v+t.angle,0,0);V.translate(-B.width*E.x+E.offsetX+y/2,-B.height*E.y+E.offsetY+y/2);V.scale(t.scale,t.scale);Mo(t,!1);t.om.set(t.cd);t.Bo=t.scale;No(t,!1);q.se(a,
b);q.cd.reset()}}else if(q instanceof Ch)for(null===this.kk&&(this.kk=new Ch),r=this.kk,Ep(q,r),p=0;p<n;p++)x=m[p],3<x.length&&(s=x[6],r.Dd=x[2],r.gg=x[3],r.je=x[4],r.Oi=x[5],r.Sc=x[8],r.gc(s.x,s.y,s.width,s.height),q=r,u=d,t=x[7],x=x[8],H=q.cd,H.reset(),H.translate(s.x+u.x,s.y+u.y),H.translate(-t.x,-t.y),zo(q,H,x.x,x.y,x.width,x.height),Mo(q,!1),q.om.set(q.cd),q.Bo=q.scale,No(q,!1),r.se(a,b));a.restore();a.Ee(!0)}else{this.ma===Po&&(a.lineCap="butt",Fp(this,a,!0,this.Yd,!0),Fp(this,a,!1,this.Td,
!0),Gp(this,a,!0,this.Yd),Gp(this,a,!1,this.Td),Fp(this,a,!0,this.Yd,!1),Fp(this,a,!1,this.Td,!1));(c=this.Zt)&&a.save();e=this.Hd();d=this.wa.n;h=d.length;for(f=0;f<h;f++)k=d[f],c&&k===e&&(a.Kp=!0),k.se(a,b),c&&k===e&&(a.Kp=!1);c&&(a.restore(),a.Ee(!0))}};
function Ep(a,b){b.P=a.P|6144;b.vc=a.vc;b.Db=a.Db;b.Zb=a.Zb;b.Re=a.Re.S();b.Vh=a.Vh.S();b.Uh=a.Uh.S();b.Qi=a.Qi.copy();b.tb=a.tb;b.gg=a.gg;b.Ag=a.Ag;b.Lm=a.Lm.S();b.ge=a.ge.S();b.nm=a.nm.S();b.Wm=a.Wm;b.Xm=a.Xm.S();b.Ym=a.Ym;null!==a.jg&&(b.jg=a.jg.copy());b.bn=a.bn;a instanceof Ch&&(b.Dd=a.Dd,b.pc=a.pc,b.lg=a.lg,b.ul=a.ul,b.kg=a.kg,b.yl=a.yl,b.Dm=a.Dm,b.Yj=a.Yj,b.Xj=a.Xj,b.Xi=a.Xi,b.qk=a.qk,b.wm=null,b.bi=a.bi,b.ci=a.ci,b.fh=a.fh,b.Wo=a.Wo,b.pg=a.pg,b.og=a.og,b.ng=a.ng,b.ym=a.ym)}
function Gp(a,b,c,d){for(var e=d.length,f=a.Y,h=c?a.be(0):a.ae(0),k=0;k<e;k++){var l=d[k];if(void 0!==l&&l!==h&&0!==l.Ja){if(c){if(l.position>f.height)continue}else if(l.position>f.width)continue;var m=l.tq;isNaN(m)&&(m=c?a.Mh:a.Lh);var n=l.sq;null===n&&(n=c?a.Bi:a.Kh);0!==m&&null!==n&&(Ko(a,b,n,!1,!1),b.beginPath(),n=l.position+m,c?n>f.height&&(m-=n-f.height):n>f.width&&(m-=n-f.width),l=l.position+m/2,b.lineWidth=m,n=a.padding,c?(l+=n.top,m=n.left,n=f.width-n.right,b.moveTo(m,l),b.lineTo(n,l)):(l+=
n.left,m=n.top,n=f.height-n.bottom,b.moveTo(l,m),b.lineTo(l,n)),b.stroke())}}}
function Fp(a,b,c,d,e){for(var f=d.length,h=a.Y,k=0;k<f;k++){var l=d[k];if(void 0!==l&&null!==l.background&&l.Zz!==e&&0!==l.Ja){var m=c?h.height:h.width;if(!(l.position>m)){var n=l.Xe(),p=l.tq;isNaN(p)&&(p=c?a.Mh:a.Lh);var q=l.sq;null===q&&(q=c?a.Bi:a.Kh);null===q&&(p=0);n-=p;p=l.position+p;n+=l.Ja;p+n>m&&(n=m-p);0>=n||(m=a.padding,Ko(a,b,l.background,!0,!1),c?b.fillRect(m.left,p+m.top,h.width-(m.left+m.right),n):b.fillRect(p+m.left,m.top,n,h.height-(m.top+m.bottom)))}}}}
function gp(a,b,c){if(0!==a%b)return!1;b=c.length;for(var d=0;d<b;d++)if(0===a%c[d])return!1;return!0}function Tm(a){return"LineV"===a||"BarV"===a}
g.zn=function(a,b,c,d,e){var f=this.Yg(),h=this.transform,k=1/(h.m11*h.m22-h.m12*h.m21),l=h.m22*k,m=-h.m12*k,n=-h.m21*k,p=h.m11*k,q=k*(h.m21*h.dy-h.m22*h.dx),r=k*(h.m12*h.dx-h.m11*h.dy);if(null!==this.jn)return h=this.Y,oe(h.left,h.top,h.right,h.bottom,a,b,c,d,e);if(null!==this.background)f=a*l+b*n+q,k=a*m+b*p+r,a=c*l+d*n+q,l=c*m+d*p+r,e.l(0,0),c=this.Ia,c=oe(0,0,c.width,c.height,f,k,a,l,e),e.transform(h);else{f||(l=1,n=m=0,p=1,r=q=0);k=a*l+b*n+q;a=a*m+b*p+r;l=c*l+d*n+q;d=c*m+d*p+r;e.l(l,d);m=(l-
k)*(l-k)+(d-a)*(d-a);c=!1;p=this.wa.n;r=p.length;n=w.K();q=null;b=Infinity;var s=null;this.Zt&&(s=w.K(),q=this.Hd(),(c=q.zn(k,a,l,d,s))&&(b=(k-s.x)*(k-s.x)+(a-s.y)*(a-s.y)));for(var u=0;u<r;u++){var t=p[u];t.visible&&t!==q&&t.zn(k,a,l,d,n)&&(c=!0,t=(k-n.x)*(k-n.x)+(a-n.y)*(a-n.y),t<m&&(m=t,e.set(n)))}this.Zt&&(b>m&&e.set(s),w.v(s));w.v(n);f&&e.transform(h)}return c};
g.I=function(a){G.prototype.I.call(this,a);if(this.ma===Bl||this.ma===aj)a=this.Hd(),null!==a&&a.I(!0);a=this.wa.n;for(var b=a.length,c=0;c<b;c++){var d=a[c];if(!d.Aa.H()){var e=Bo(d,!1);(d instanceof Hj||d instanceof C||d instanceof Ch||e!==Ij)&&d.I(!0)}}};g.bq=function(){if(!1===ym(this)){Xl(this,!0);Co(this,!0);for(var a=this.wa.n,b=a.length,c=0;c<b;c++)a[c].bq()}};g.Ii=function(){if(0!==(this.P&2048)===!1){Mo(this,!0);No(this,!0);for(var a=this.wa.n,b=a.length,c=0;c<b;c++)a[c].uA()}};
g.uA=function(){No(this,!0);for(var a=this.wa.n,b=a.length,c=0;c<b;c++)a[c].uA()};
g.Ln=function(a,b,c,d){var e=this.fj;e.width=0;e.height=0;var f=this.Aa,h=this.zh;void 0===c&&(c=h.width,d=h.height);c=Math.max(c,h.width);d=Math.max(d,h.height);var k=this.Af;isNaN(f.width)||(a=Math.min(f.width,k.width));isNaN(f.height)||(b=Math.min(f.height,k.height));a=Math.max(c,a);b=Math.max(d,b);var l=this.padding;a=Math.max(a-l.left-l.right,0);b=Math.max(b-l.top-l.bottom,0);var m=this.wa.n;if(0!==m.length){var n=this.ma.Qb;switch(n){case "Position":var p=a,q=b,r=c,s=d,u=m.length;e.x=0;e.y=
0;e.width=0;e.height=0;for(var t=Hp(this),x=0;x<u;x++){var v=m[x];if(v.visible||v===t){var B=v.margin,y=B.right+B.left,H=B.top+B.bottom;rk(v,p,q,r,s);var E=v.za,V=Math.max(E.width+y,0),ba=Math.max(E.height+H,0),Q=v.position.x,$=v.position.y;isFinite(Q)||(Q=0);isFinite($)||($=0);if(v instanceof X){var ca=v;if(ca.fF)var R=ca.kb/2,Q=Q-R,$=$-R}bb(e,Q,$,V,ba)}}break;case "Vertical":for(var Ra=a,hb=c,qa=m.length,Ja=w.lb(),za=Hp(this),Pb=0;Pb<qa;Pb++){var Lb=m[Pb];if(Lb.visible||Lb===za){var ae=Bo(Lb,!1);
if(ae!==Ij&&ae!==mo)Ja.push(Lb);else{var pd=Lb.margin,rc=pd.right+pd.left,xg=pd.top+pd.bottom;rk(Lb,Ra,Infinity,hb,0);var Df=Lb.za,Wa=Math.max(Df.width+rc,0),lb=Math.max(Df.height+xg,0);e.width=Math.max(e.width,Wa);e.height+=lb}}}var na=Ja.length;if(0!==na){this.Aa.width?Ra=Math.min(this.Aa.width,this.Af.width):0!==e.width&&(Ra=Math.min(e.width,this.Af.width));for(Pb=0;Pb<na;Pb++)if(Lb=Ja[Pb],Lb.visible||Lb===za)pd=Lb.margin,rc=pd.right+pd.left,xg=pd.top+pd.bottom,rk(Lb,Ra,Infinity,hb,0),Df=Lb.za,
Wa=Math.max(Df.width+rc,0),lb=Math.max(Df.height+xg,0),e.width=Math.max(e.width,Wa),e.height+=lb;w.va(Ja)}break;case "Horizontal":for(var la=b,ib=d,jb=m.length,fb=w.lb(),se=Hp(this),Ed=0;Ed<jb;Ed++){var tb=m[Ed];if(tb.visible||tb===se){var Le=Bo(tb,!1);if(Le!==Ij&&Le!==no)fb.push(tb);else{var ed=tb.margin,ag=ed.right+ed.left,Ef=ed.top+ed.bottom;rk(tb,Infinity,la,0,ib);var yg=tb.za,kb=Math.max(yg.width+ag,0),wc=Math.max(yg.height+Ef,0);e.width+=kb;e.height=Math.max(e.height,wc)}}}var qd=fb.length;
if(0!==qd){this.Aa.height?la=Math.min(this.Aa.height,this.Af.height):0!==e.height&&(la=Math.min(e.height,this.Af.height));for(Ed=0;Ed<qd;Ed++)if(tb=fb[Ed],tb.visible||tb===se)ed=tb.margin,ag=ed.right+ed.left,Ef=ed.top+ed.bottom,rk(tb,Infinity,la,0,ib),yg=tb.za,kb=Math.max(yg.width+ag,0),wc=Math.max(yg.height+Ef,0),e.width+=kb,e.height=Math.max(e.height,wc);w.va(fb)}break;case "Spot":a:{var bg=a,Bb=b,Mb=c,te=d,zg=m.length,Fd=this.Hd(),mb=Fd.margin,Jc=0,Ff=0,Me=mb.right+mb.left,Wh=mb.top+mb.bottom;
rk(Fd,bg,Bb,Mb,te);for(var Sa=Fd.za,cb=Sa.width,xc=Sa.height,sc=Math.max(cb+Me,0),Vc=Math.max(xc+Wh,0),jh=this.Zt,Ya=w.Vg(-mb.left,-mb.top,sc,Vc),xb=!0,ub=Hp(this),yc=0;yc<zg;yc++){var yb=m[yc];if(yb!==Fd&&(yb.visible||yb===ub)){mb=yb.margin;Jc=mb.right+mb.left;Ff=mb.top+mb.bottom;rk(yb,bg,Bb,0,0);var Sa=yb.za,sc=Math.max(Sa.width+Jc,0),Vc=Math.max(Sa.height+Ff,0),ob=yb.alignment;ob.Uc()&&(ob=this.Ll);ob.fd()||(ob=Fb);var Gb=yb.oh;Gb.Uc()&&(Gb=Fb);var be=null;yb instanceof C&&""!==yb.Hj&&(yb.gc(0,
0,Sa.width,Sa.height),be=yb.sd(yb.Hj),be===yb&&(be=null));var Cb,Qb;if(null!==be){for(var fd=be.Ia,Xh=be.margin,Nb=w.xb(Gb.x*fd.width+Gb.offsetX-Xh.left,Gb.y*fd.height+Gb.offsetY-Xh.top);be!==yb;)be.transform.nb(Nb),be=be.O;Cb=ob.x*cb+ob.offsetX-Nb.x;Qb=ob.y*xc+ob.offsetY-Nb.y;w.v(Nb)}else Cb=ob.x*cb+ob.offsetX-(Gb.x*Sa.width-Gb.offsetX)-mb.left,Qb=ob.y*xc+ob.offsetY-(Gb.y*Sa.height-Gb.offsetY)-mb.top;xb?(xb=!1,e.x=Cb,e.y=Qb,e.width=sc,e.height=Vc):bb(e,Cb,Qb,sc,Vc)}}xb?e.assign(Ya):jh?e.$E(Ya.x,
Ya.y,Ya.width,Ya.height):bb(e,Ya.x,Ya.y,Ya.width,Ya.height);w.Gb(Ya);var Ob=Fd.stretch;Ob===lo&&(Ob=Bo(Fd,!1));switch(Ob){case Ij:break a;case Ie:if(!isFinite(bg)&&!isFinite(Bb))break a;break;case no:if(!isFinite(bg))break a;break;case mo:if(!isFinite(Bb))break a}Sa=Fd.za;cb=Sa.width;xc=Sa.height;sc=Math.max(cb+Me,0);Vc=Math.max(xc+Wh,0);mb=Fd.margin;Ya=w.Vg(-mb.left,-mb.top,sc,Vc);for(yc=0;yc<zg;yc++)yb=m[yc],yb===Fd||!yb.visible&&yb!==ub||(mb=yb.margin,Jc=mb.right+mb.left,Ff=mb.top+mb.bottom,Sa=
yb.za,sc=Math.max(Sa.width+Jc,0),Vc=Math.max(Sa.height+Ff,0),ob=yb.alignment,ob.Uc()&&(ob=this.Ll),ob.fd()||(ob=Fb),Gb=yb.oh,Gb.Uc()&&(Gb=Fb),xb?(xb=!1,e.x=ob.x*cb+ob.offsetX-(Gb.x*Sa.width-Gb.offsetX)-mb.left,e.y=ob.y*xc+ob.offsetY-(Gb.y*Sa.height-Gb.offsetY)-mb.top,e.width=sc,e.height=Vc):bb(e,ob.x*cb+ob.offsetX-(Gb.x*Sa.width-Gb.offsetX)-mb.left,ob.y*xc+ob.offsetY-(Gb.y*Sa.height-Gb.offsetY)-mb.top,sc,Vc));xb?e.assign(Ya):jh?e.$E(Ya.x,Ya.y,Ya.width,Ya.height):bb(e,Ya.x,Ya.y,Ya.width,Ya.height);
w.Gb(Ya)}break;case "Auto":var zc=a,Wc=b,rd=c,Ag=d,Yh=m.length,pb=this.Hd(),Xc=pb.margin,Zh=zc,Ne=Wc,ec=Xc.right+Xc.left,ue=Xc.top+Xc.bottom;rk(pb,zc,Wc,rd,Ag);var Wb=pb.za,Ac=0,sd=null;pb instanceof X&&(sd=pb,Ac=sd.kb*sd.scale);var fc=Math.max(Wb.width+ec,0),Ta=Math.max(Wb.height+ue,0),gc=Ip(pb),$h=gc.x*fc+gc.offsetX,bf=gc.y*Ta+gc.offsetY,Gd=Jp(pb),Oe=Gd.x*fc+Gd.offsetX,kh=Gd.y*Ta+Gd.offsetY;isFinite(zc)&&(Zh=Math.max(Math.abs($h-Oe)-Ac,0));isFinite(Wc)&&(Ne=Math.max(Math.abs(bf-kh)-Ac,0));var Hd=
w.im();Hd.l(0,0);for(var lh=Hp(this),jj=0;jj<Yh;jj++){var mh=m[jj];if(mh!==pb&&(mh.visible||mh===lh)){var Xc=mh.margin,Dk=Xc.right+Xc.left,zb=Xc.top+Xc.bottom;rk(mh,Zh,Ne,0,0);Wb=mh.za;fc=Math.max(Wb.width+Dk,0);Ta=Math.max(Wb.height+zb,0);Hd.l(Math.max(fc,Hd.width),Math.max(Ta,Hd.height))}}if(1===Yh)e.width=fc,e.height=Ta,w.zk(Hd);else{var gc=Ip(pb),Gd=Jp(pb),ce=0,gd=0;Gd.x!==gc.x&&Gd.y!==gc.y&&(ce=Hd.width/Math.abs(Gd.x-gc.x),gd=Hd.height/Math.abs(Gd.y-gc.y));w.zk(Hd);Ac=0;null!==sd&&(Ac=sd.kb*
sd.scale,Jj(sd)===Kj&&(ce=gd=Math.max(ce,gd)));var ce=ce+(Math.abs(gc.offsetX)+Math.abs(Gd.offsetX)+Ac),gd=gd+(Math.abs(gc.offsetY)+Math.abs(Gd.offsetY)+Ac),Pe=pb.stretch;Pe===lo&&(Pe=Bo(pb,!1));switch(Pe){case Ij:Ag=rd=0;break;case Ie:isFinite(zc)&&(ce=zc);isFinite(Wc)&&(gd=Wc);break;case no:isFinite(zc)&&(ce=zc);Ag=0;break;case mo:rd=0,isFinite(Wc)&&(gd=Wc)}pb.bq();rk(pb,ce,gd,rd,Ag);e.width=pb.za.width+ec;e.height=pb.za.height+ue}break;case "Table":for(var ai=a,bi=b,kj=c,lj=d,Db=m.length,nh=w.lb(),
oh=w.lb(),ma=0;ma<Db;ma++){var aa=m[ma],de=aa instanceof C?aa:null;if(null===de||de.type!==Go&&de.type!==Ho||!aa.visible)nh.push(aa);else{oh.push(de);for(var cg=de.wa.n,ci=cg.length,hc=0;hc<ci;hc++){var di=cg[hc];de.type===Go?di.Yb=aa.Yb:de.type===Ho&&(di.column=aa.column);nh.push(di)}}}Db=nh.length;0===Db&&(this.be(0),this.ae(0));for(var ic=[],ma=0;ma<Db;ma++)aa=nh[ma],Xl(aa,!0),Co(aa,!0),ic[aa.Yb]||(ic[aa.Yb]=[]),ic[aa.Yb][aa.column]||(ic[aa.Yb][aa.column]=[]),ic[aa.Yb][aa.column].push(aa);w.va(nh);
for(var cf=w.lb(),Qe=w.lb(),df=w.lb(),ve={count:0},we={count:0},Yc=ai,Id=bi,ph=this.Yd,Db=ph.length,ma=0;ma<Db;ma++){var Z=ph[ma];void 0!==Z&&(Z.Ja=0)}ph=this.Td;Db=ph.length;for(ma=0;ma<Db;ma++)Z=ph[ma],void 0!==Z&&(Z.Ja=0);for(var ef=ic.length,dg=0,ma=0;ma<ef;ma++)ic[ma]&&(dg=Math.max(dg,ic[ma].length));for(var qh=Math.min(this.ej,ef-1),rh=Math.min(this.Ni,dg-1),Jd=0,ef=ic.length,Ek=Hp(this),ma=0;ma<ef;ma++)if(ic[ma])for(var dg=ic[ma].length,qb=this.be(ma),hc=qb.Ja=0;hc<dg;hc++)if(ic[ma][hc]){var Ua=
this.ae(hc);void 0===cf[hc]&&(Ua.Ja=0,cf[hc]=!0);for(var bm=ic[ma][hc],Fk=bm.length,mj=0;mj<Fk;mj++)if(aa=bm[mj],aa.visible||aa===Ek){var ei=1<aa.aj||1<aa.xi;ei&&(ma<qh||hc<rh||Qe.push(aa));var tc=aa.margin,xe=tc.right+tc.left,td=tc.top+tc.bottom,Kc=Qo(aa,qb,Ua,!1),Gk=aa.Aa,cm=!isNaN(Gk.height),dm=!isNaN(Gk.width)&&cm;ei||Kc===Ij||dm||ma<qh||hc<rh||(void 0!==ve[hc]||Kc!==Ie&&Kc!==no||(ve[hc]=-1,ve.count++),void 0!==we[ma]||Kc!==Ie&&Kc!==mo||(we[ma]=-1,we.count++),df.push(aa));rk(aa,Infinity,Infinity,
0,0);if(!(ma<qh||hc<rh)){var Gf=aa.za,Rb=Math.max(Gf.width+xe,0),Kd=Math.max(Gf.height+td,0);if(1===aa.aj&&(Kc===Ij||Kc===no)){var Z=this.be(ma),Ld=Z.Xe(),Jd=Math.max(Kd-Z.Ja,0);Jd+Ld>Id&&(Jd=Math.max(Id-Ld,0));var Bc=0===Z.Ja;Z.Ja+=Jd;Id=Math.max(Id-(Jd+(Bc?Ld:0)),0)}1!==aa.xi||Kc!==Ij&&Kc!==mo||(Z=this.ae(hc),Ld=Z.Xe(),Jd=Math.max(Rb-Z.Ja,0),Jd+Ld>Yc&&(Jd=Math.max(Yc-Ld,0)),Bc=0===Z.Ja,Z.Ja+=Jd,Yc=Math.max(Yc-(Jd+(Bc?Ld:0)),0));ei&&aa.bq()}}}w.va(cf);for(var ee=0,ud=0,Db=this.Lp,ma=0;ma<Db;ma++){var Bg=
this.Td[ma];void 0!==Bg&&(ee+=Bg.Sa,0!==Bg.Sa&&(ee+=Bg.Xe()))}Db=this.qq;for(ma=0;ma<Db;ma++){var nj=this.Yd[ma];void 0!==nj&&(ud+=nj.Sa,0!==nj.Sa&&(ud+=nj.Xe()))}for(var Yc=Math.max(ai-ee,0),sh=Id=Math.max(bi-ud,0),th=Yc,Db=df.length,ma=0;ma<Db;ma++){var aa=df[ma],qb=this.be(aa.Yb),Ua=this.ae(aa.column),fi=aa.za,tc=aa.margin,xe=tc.right+tc.left,td=tc.top+tc.bottom;ve[aa.column]=0===Ua.Ja&&void 0!==ve[aa.column]?Math.max(fi.width+xe,ve[aa.column]):null;we[aa.Yb]=0===qb.Ja&&void 0!==we[aa.Yb]?Math.max(fi.height+
td,we[aa.Yb]):null}var gi=0,eg=0,jc;for(jc in we)"count"!==jc&&(gi+=we[jc]);for(jc in ve)"count"!==jc&&(eg+=ve[jc]);for(var Va=w.im(),ma=0;ma<Db;ma++)if(aa=df[ma],aa.visible||aa===Ek){var qb=this.be(aa.Yb),Ua=this.ae(aa.column),Md=0;isFinite(Ua.width)?Md=Ua.width:(Md=isFinite(Yc)&&null!==ve[aa.column]?0===eg?Ua.Ja+Yc:ve[aa.column]/eg*th:null!==ve[aa.column]?Yc:Ua.Ja||Yc,Md=Math.max(0,Md-Ua.Xe()));var Nd=0;isFinite(qb.height)?Nd=qb.height:(Nd=isFinite(Id)&&null!==we[aa.Yb]?0===gi?qb.Ja+Id:we[aa.Yb]/
gi*sh:null!==we[aa.Yb]?Id:qb.Ja||Id,Nd=Math.max(0,Nd-qb.Xe()));Va.l(Math.max(Ua.xj,Math.min(Md,Ua.mf)),Math.max(qb.xj,Math.min(Nd,qb.mf)));Kc=Qo(aa,qb,Ua,!1);switch(Kc){case no:Va.height=Math.max(Va.height,qb.Ja+Id);break;case mo:Va.width=Math.max(Va.width,Ua.Ja+Yc)}tc=aa.margin;xe=tc.right+tc.left;td=tc.top+tc.bottom;aa.bq();rk(aa,Va.width,Va.height,Ua.xj,qb.xj);Gf=aa.za;Rb=Math.max(Gf.width+xe,0);Kd=Math.max(Gf.height+td,0);isFinite(Yc)&&(Rb=Math.min(Rb,Va.width));isFinite(Id)&&(Kd=Math.min(Kd,
Va.height));var ff=0,ff=qb.Ja;qb.Ja=Math.max(qb.Ja,Kd);Jd=qb.Ja-ff;Id=Math.max(Id-Jd,0);ff=Ua.Ja;Ua.Ja=Math.max(Ua.Ja,Rb);Jd=Ua.Ja-ff;Yc=Math.max(Yc-Jd,0)}w.va(df);for(var Hf=w.im(),Db=Qe.length,ma=0;ma<Db;ma++)if(aa=Qe[ma],aa.visible||aa===Ek){qb=this.be(aa.Yb);Ua=this.ae(aa.column);Va.l(Math.max(Ua.xj,Math.min(ai,Ua.mf)),Math.max(qb.xj,Math.min(bi,qb.mf)));Kc=Qo(aa,qb,Ua,!1);switch(Kc){case Ie:0!==Ua.Ja&&(Va.width=Math.min(Va.width,Ua.Ja));0!==qb.Ja&&(Va.height=Math.min(Va.height,qb.Ja));break;
case no:0!==Ua.Ja&&(Va.width=Math.min(Va.width,Ua.Ja));break;case mo:0!==qb.Ja&&(Va.height=Math.min(Va.height,qb.Ja))}isFinite(Ua.width)&&(Va.width=Ua.width);isFinite(qb.height)&&(Va.height=qb.height);Hf.l(0,0);for(var nb=1;nb<aa.aj&&!(aa.Yb+nb>=this.qq);nb++)Z=this.be(aa.Yb+nb),Hf.height+=Math.max(Z.xj,isNaN(Z.gf)?Z.mf:Math.min(Z.gf,Z.mf));for(nb=1;nb<aa.xi&&!(aa.column+nb>=this.Lp);nb++)Z=this.ae(aa.column+nb),Hf.width+=Math.max(Z.xj,isNaN(Z.gf)?Z.mf:Math.min(Z.gf,Z.mf));Va.width+=Hf.width;Va.height+=
Hf.height;tc=aa.margin;xe=tc.right+tc.left;td=tc.top+tc.bottom;rk(aa,Va.width,Va.height,kj,lj);for(var Gf=aa.za,Rb=Math.max(Gf.width+xe,0),Kd=Math.max(Gf.height+td,0),gf=0,nb=0;nb<aa.aj&&!(aa.Yb+nb>=this.qq);nb++)Z=this.be(aa.Yb+nb),gf+=Z.total||0;if(gf<Kd){var hd=Kd-gf,Cg=Kd-gf;if(null!==aa.iy)for(var hf=aa.iy,nb=0;nb<aa.aj&&!(0>=hd)&&!(aa.Yb+nb>=this.qq);nb++){var Z=this.be(aa.Yb+nb),Cc=Z.Sa||0,hi=hf(aa,Z,Cg);Z.Ja=Math.min(Z.mf,Cc+hi);Z.Sa!==Cc&&(hd-=Z.Sa-Cc)}for(;0<hd;){Cc=Z.Sa||0;isNaN(Z.height)&&
Z.mf>Cc&&(Z.Ja=Math.min(Z.mf,Cc+hd),Z.Sa!==Cc&&(hd-=Z.Sa-Cc));if(0===Z.index)break;Z=this.be(Z.index-1)}}for(var Re=0,nb=0;nb<aa.xi&&!(aa.column+nb>=this.Lp);nb++)Z=this.ae(aa.column+nb),Re+=Z.total||0;if(Re<Rb){hd=Rb-Re;Cg=Rb-Re;if(null!==aa.iy)for(hf=aa.iy,nb=0;nb<aa.xi&&!(0>=hd)&&!(aa.column+nb>=this.Lp);nb++)Z=this.ae(aa.column+nb),Cc=Z.Sa||0,hi=hf(aa,Z,Cg),Z.Ja=Math.min(Z.mf,Cc+hi),Z.Sa!==Cc&&(hd-=Z.Sa-Cc);for(;0<hd;){Cc=Z.Sa||0;isNaN(Z.width)&&Z.mf>Cc&&(Z.Ja=Math.min(Z.mf,Cc+hd),Z.Sa!==Cc&&
(hd-=Z.Sa-Cc));if(0===Z.index)break;Z=this.ae(Z.index-1)}}}w.va(Qe);w.zk(Hf);w.zk(Va);for(var Dg=0,Eg=0,Kc=Bo(this,!0),oj=this.Aa,Hk=this.Af,ye=ud=ee=0,Zc=0,Db=this.Lp,ma=0;ma<Db;ma++)void 0!==this.Td[ma]&&(Z=this.ae(ma),isFinite(Z.width)?(ye+=Z.width,ye+=Z.Xe()):Kp(Z)===Lp?(ye+=Z.Sa,ye+=Z.Xe()):0!==Z.Sa&&(ee+=Z.Sa,ee+=Z.Xe()));var Dg=isFinite(oj.width)?Math.min(oj.width,Hk.width):Kc!==Ij&&isFinite(ai)?ai:ee,Dg=Math.max(Dg,this.zh.width),Dg=Math.max(Dg-ye,0),Ik=Math.max(Dg/ee,1);isFinite(Ik)||(Ik=
1);for(ma=0;ma<Db;ma++)void 0!==this.Td[ma]&&(Z=this.ae(ma),isFinite(Z.width)||Kp(Z)===Lp||(Z.Ja=Z.Sa*Ik),Z.position=e.width,0!==Z.Sa&&(e.width+=Z.Sa,e.width+=Z.Xe()));Db=this.qq;for(ma=0;ma<Db;ma++)void 0!==this.Yd[ma]&&(Z=this.be(ma),isFinite(Z.height)?(Zc+=Z.height,Zc+=Z.Xe()):Kp(Z)===Lp?(Zc+=Z.Sa,Zc+=Z.Xe()):0!==Z.Sa&&(ud+=Z.Sa,0!==Z.Sa&&(ud+=Z.Xe())));var Eg=isFinite(oj.height)?Math.min(oj.height,Hk.height):Kc!==Ij&&isFinite(bi)?bi:ud,Eg=Math.max(Eg,this.zh.height),Eg=Math.max(Eg-Zc,0),uh=Math.max(Eg/
ud,1);isFinite(uh)||(uh=1);for(ma=0;ma<Db;ma++)void 0!==this.Yd[ma]&&(Z=this.be(ma),isFinite(Z.height)||Kp(Z)===Lp||(Z.Ja=Z.Sa*uh),Z.position=e.height,0!==Z.Sa&&(e.height+=Z.Sa,0!==Z.Sa&&(e.height+=Z.Xe())));Db=oh.length;for(ma=0;ma<Db;ma++){var id=oh[ma];id.type===Go?(Md=e.width,Z=this.be(id.Yb),Nd=Z.Ja):(Z=this.ae(id.column),Md=Z.Ja,Nd=e.height);id.od.l(0,0,Md,Nd);Xl(id,!1);ic[id.Yb]||(ic[id.Yb]=[]);ic[id.Yb][id.column]||(ic[id.Yb][id.column]=[]);ic[id.Yb][id.column].push(id)}w.va(oh);this.Os=ic;
break;case "Viewbox":var pj=a,fm=b,ht=c,it=d;1<m.length&&w.k("Viewbox Panel cannot contain more than one GraphObject.");var jf=m[0];jf.tb=1;jf.bq();rk(jf,Infinity,Infinity,ht,it);var Jk=jf.za,gm=jf.margin,jt=gm.right+gm.left,kt=gm.top+gm.bottom;if(isFinite(pj)||isFinite(fm)){var aw=jf.scale,hm=Jk.width,im=Jk.height,lt=Math.max(pj-jt,0),mt=Math.max(fm-kt,0),Kk=1;this.Cp===Kj?0!==hm&&0!==im&&(Kk=Math.min(lt/hm,mt/im)):0!==hm&&0!==im&&(Kk=Math.max(lt/hm,mt/im));0===Kk&&(Kk=1E-4);jf.tb*=Kk;aw!==jf.scale&&
(Xl(jf,!0),rk(jf,Infinity,Infinity,ht,it))}Jk=jf.za;e.width=isFinite(pj)?pj:Math.max(Jk.width+jt,0);e.height=isFinite(fm)?fm:Math.max(Jk.height+kt,0);break;case "Link":var nt=m.length;if(this instanceof dh||this instanceof W){var ji=null;this instanceof W&&(ji=this);this instanceof dh&&(ji=this.Nf);if(ji instanceof W){var Lk=ji;if(0===nt){var jm=this.Ia;Pa(jm,0,0);var ze=this.za;ze.l(0,0,0,0)}else{var km=this instanceof dh?null:ji.path,Fg=ji.Un,kf=this.fj;kf.assign(Fg);kf.x=0;kf.y=0;var vh=Lk.points,
ki=ji.qa;this.lu(!1);var ot=Fg.width,pt=Fg.height;this.Ri.l(Fg.x,Fg.y);null===this.$g&&(this.$g=new I(A));this.$g.clear();null!==km&&(Mp(km,ot,pt,this),ze=km.za,kf.Gh(ze),this.$g.add(ze));for(var Gg=w.Ef(),Mk=w.K(),Hg=w.K(),hp=0;hp<nt;hp++){var Xb=m[hp];if(Xb!==km)if(Xb.Uf&&Xb instanceof X)Mp(Xb,ot,pt,this),ze=Xb.za,kf.Gh(ze),this.$g.add(ze);else if(2>ki)rk(Xb,Infinity,Infinity),ze=Xb.za,kf.Gh(ze),this.$g.add(ze);else{var vd=Xb.Me,rt=Xb.XA,ip=Xb.oh;ip.Nd()&&(ip=Fb);var fg=Xb.rq,bw=Xb.YA,Nk=0,Ok=0,
lm=0;if(vd<-ki||vd>=ki){var st=Lk.wF,If=Lk.vF;fg!==dj&&(lm=Lk.computeAngle(Xb,fg,If),Xb.gg=lm);Nk=st.x-Fg.x;Ok=st.y-Fg.y}else{var Od,lf;if(0<=vd)Od=vh.da(vd),lf=vd<ki-1?vh.da(vd+1):Od;else{var li=ki+vd;Od=vh.da(li);lf=0<li?vh.da(li-1):Od}if(Od.Ic(lf)){var mi,ni;0<=vd?(mi=0<vd?vh.da(vd-1):Od,ni=vd<ki-2?vh.da(vd+2):lf):(mi=li<ki-1?vh.da(li+1):Od,ni=1<li?vh.da(li-2):lf);var tt=mi.uf(Od),ut=lf.uf(ni),If=tt>ut+10?0<=vd?mi.yc(Od):Od.yc(mi):ut>tt+10?0<=vd?lf.yc(ni):ni.yc(lf):0<=vd?mi.yc(ni):ni.yc(mi)}else If=
0<=vd?Od.yc(lf):lf.yc(Od);fg!==dj&&(lm=Lk.computeAngle(Xb,fg,If),Xb.gg=lm);Nk=Od.x+(lf.x-Od.x)*rt-Fg.x;Ok=Od.y+(lf.y-Od.y)*rt-Fg.y}rk(Xb,Infinity,Infinity);var ze=Xb.za,jm=Xb.Ia,Pk=0;Xb instanceof X&&(Pk=Xb.kb);var oi=jm.width+Pk,qj=jm.height+Pk;Gg.reset();Gg.translate(-ze.x,-ze.y);Gg.scale(Xb.scale,Xb.scale);Gg.rotate(fg===dj?Xb.angle:If,oi/2,qj/2);fg!==Np&&fg!==Op||Gg.rotate(90,oi/2,qj/2);fg!==Pp&&fg!==Qp||Gg.rotate(-90,oi/2,qj/2);fg===Rp&&(45<If&&135>If||225<If&&315>If)&&Gg.rotate(-If,oi/2,qj/
2);var vj=new A(0,0,oi,qj);Mk.Vn(vj,ip);Gg.nb(Mk);var cw=-Mk.x+Pk/2,dw=-Mk.y+Pk/2;Hg.assign(bw);isNaN(Hg.x)&&(Hg.x=0<=vd?oi/2+3:-(oi/2+3));isNaN(Hg.y)&&(Hg.y=-(qj/2+3));Hg.rotate(If);Nk+=Hg.x;Ok+=Hg.y;vj.set(ze);vj.x=Nk+cw;vj.y=Ok+dw;this.$g.add(vj);kf.Gh(vj)}}if(this instanceof W)for(var vt=this.Vf;vt.next();)rk(vt.value,Infinity,Infinity);this.fj=kf;var jp=this.Ri;jp.l(jp.x+kf.x,jp.y+kf.y);Pa(e,kf.width||0,kf.height||0);w.ue(Gg);w.v(Mk);w.v(Hg)}}}break;case "Grid":break;case "Graduated":var ew=
a,fw=b,gw=c,hw=d,Ig=this.Hd();this.xm=[];var wj=Ig.margin,iw=wj.right+wj.left,jw=wj.top+wj.bottom;rk(Ig,ew,fw,gw,hw);var wt=Ig.za,kw=wt.height,lw=Math.max(wt.width+iw,0),mw=Math.max(kw+jw,0),xt=new A(-wj.left,-wj.top,lw,mw);this.xm.push(xt);e.assign(xt);for(var Rk=Ig.vf,yt=Ig.kb,kp=Rk.gA,xj=Rk.lx,pi=Rk.hA,nw=kp.length,lp=0,mp=0,yj=w.lb(),np=0;np<nw;np++){for(var op=kp[np],zt=[],mp=lp=0,ow=op.length,zj=0;zj<ow;zj+=2){var At=op[zj],Bt=op[zj+1];if(0!==zj){var wd=180*Math.atan2(Bt-mp,At-lp)/Math.PI;0>
wd&&(wd+=360);zt.push(wd)}lp=At;mp=Bt}yj.push(zt)}var Ct;if(null===this.Sj){for(var Dt=[],pp=this.wa.n,Et=pp.length,qp=0;qp<Et;qp++){var Sk=pp[qp],Ft=[];Dt.push(Ft);if(Sk.visible)for(var pw=Sk.interval,rp=0;rp<Et;rp++){var Tk=pp[rp];if(Tk.visible&&Sk!==Tk&&!(Sk instanceof X&&!(Tk instanceof X)||Sk instanceof Ch&&!(Tk instanceof Ch))){var Gt=Tk.interval;Gt>pw&&Ft.push(Gt)}}}this.Sj=Dt}Ct=this.Sj;var Ht=this.wa.n,qw=Ht.length,wh=0,It=0,Jt=pi;this.zm=[];for(var mm=[],nm=0;nm<qw;nm++){var xh=Ht[nm],mm=
[];if(xh.visible&&xh!==Ig){var Kt=xh.interval,Lt=this.oA;if(!(2>Lt*Kt*pi/this.ox)){var fe=this.UE,Mt=Ct[nm],qi=xj[0][0],Jf=0,xd=0,It=pi*xh.TE-1E-4,Jt=pi*xh.RE+1E-4,Aj=Lt*Kt;if(fe<this.Bk)var ri=(this.Bk-fe)/Aj,ri=0===ri%1?ri:Math.floor(ri+1),fe=fe+ri*Aj;else fe>this.Bk+Aj&&(ri=Math.floor((fe-this.Bk)/Aj),fe-=ri*Aj);for(;fe<=this.nA;){var sp;a:{for(var rw=Mt.length,tp=0;tp<rw;tp++)if(Xa((fe-this.UE)%(Mt[tp]*this.oA),0)){sp=!1;break a}sp=!0}if(sp&&(wh=(fe-this.Bk)*pi/this.ox,wh>pi&&(wh=pi),It<=wh&&
wh<=Jt)){for(var wd=yj[Jf][xd],Bj=xj[Jf][xd];Jf<xj.length;){for(;wh>qi&&xd<xj[Jf].length-1;)xd++,wd=yj[Jf][xd],Bj=xj[Jf][xd],qi+=Bj;if(wh<=qi)break;Jf++;xd=0;wd=yj[Jf][xd];Bj=xj[Jf][xd];qi+=Bj}var Pd=kp[Jf],Nt=Pd[2*xd],Ot=Pd[2*xd+1],om=(wh-(qi-Bj))/Bj,up=new z(Nt+(Pd[2*xd+2]-Nt)*om+yt/2-Rk.jb.x,Ot+(Pd[2*xd+3]-Ot)*om+yt/2-Rk.jb.y);up.scale(Ig.scale,Ig.scale);var gg=wd,Cj=yj[Jf];1E-4>om?0<xd?gg=Cj[xd-1]:Xa(Pd[0],Pd[Pd.length-2])&&Xa(Pd[1],Pd[Pd.length-1])&&(gg=Cj[Cj.length-1]):.9999<om&&(xd+1<Cj.length?
gg=Cj[xd+1]:Xa(Pd[0],Pd[Pd.length-2])&&Xa(Pd[1],Pd[Pd.length-1])&&(gg=Cj[0]));wd!==gg&&(180<Math.abs(wd-gg)&&(wd<gg?wd+=360:gg+=360),wd=(wd+gg)/2%360);if(xh instanceof Ch){var vp="",vp=null!==xh.SE?xh.SE(fe):(+fe.toFixed(2)).toString();""!==vp&&mm.push([up,wd,vp])}else mm.push([up,wd])}fe+=Aj}}}this.zm.push(mm)}w.va(yj);for(var sw=this.zm,tw=m.length,pm=0;pm<tw;pm++){var si=m[pm],wp=sw[pm];if(si.visible&&si!==Ig&&0!==wp.length){if(si instanceof X){var yh=si,Pt=wp,uw=e,xp=yh.oh;xp.Nd()&&(xp=wb);var vw=
yh.angle;yh.gg=0;rk(yh,Infinity,Infinity);yh.gg=vw;var Qt=yh.za,yp=Qt.width,zp=Qt.height,Rt=w.Vg(0,0,yp,zp),ge=w.K();ge.Vn(Rt,xp);w.Gb(Rt);for(var qm=-ge.x,rm=-ge.y,ti=new A,ww=Pt.length,sm=0;sm<ww;sm++)for(var Ap=Pt[sm],St=Ap[0].x,Tt=Ap[0].y,Ut=Ap[1],tm=0;4>tm;tm++){switch(tm){case 0:ge.l(qm,rm);break;case 1:ge.l(qm+yp,rm);break;case 2:ge.l(qm,rm+zp);break;case 3:ge.l(qm+yp,rm+zp)}ge.rotate(Ut+yh.angle);ge.offset(St,Tt);0===sm&&0===tm?ti.l(ge.x,ge.y,0,0):ti.ri(ge);ge.offset(-St,-Tt);ge.rotate(-Ut-
yh.angle)}w.v(ge);this.xm.push(ti);bb(uw,ti.x,ti.y,ti.width,ti.height)}else if(si instanceof Ch){var Uk=si,Vt=wp,xw=e;null===this.kk&&(this.kk=new Ch);var Kf=this.kk;Ep(Uk,Kf);var Bp=Uk.oh;Bp.Nd()&&(Bp=wb);for(var zh=Uk.rq,yw=Uk.YA,ui=null,um=0,vm=0,Jg=0,Cp=0,zw=Vt.length,wm=0;wm<zw;wm++){var hg=Vt[wm],um=hg[0].x,vm=hg[0].y,Jg=hg[1];zh!==dj&&(Cp=Uk.computeAngle(zh,Jg),Kf.gg=Cp);Kf.text=hg[2];rk(Kf,Infinity,Infinity);var Ah=Kf.za,Dj=Kf.Ia,Ej=Dj.width,Fj=Dj.height,Kg=w.Ef();Kg.reset();Kg.translate(-Ah.x,
-Ah.y);Kg.scale(Kf.scale,Kf.scale);Kg.rotate(zh===dj?Kf.angle:Jg,Ej/2,Fj/2);zh!==Np&&zh!==Op||Kg.rotate(90,Ej/2,Fj/2);zh!==Pp&&zh!==Qp||Kg.rotate(-90,Ej/2,Fj/2);zh===Rp&&(45<Jg&&135>Jg||225<Jg&&315>Jg)&&Kg.rotate(-Jg,Ej/2,Fj/2);var Wt=w.Vg(0,0,Ej,Fj),Vk=w.K();Vk.Vn(Wt,Bp);Kg.nb(Vk);var Aw=-Vk.x,Bw=-Vk.y,Lg=w.K();Lg.assign(yw);isNaN(Lg.x)&&(Lg.x=Ej/2+3);isNaN(Lg.y)&&(Lg.y=-(Fj/2+3));Lg.rotate(Jg);var um=um+(Lg.x+Aw),vm=vm+(Lg.y+Bw),Dp=new A(um,vm,Ah.width,Ah.height),Cw=new A(Ah.x,Ah.y,Ah.width,Ah.height),
Dw=new A(Dj.x,Dj.y,Dj.width,Dj.height),Xt=new Sp;Xt.Mp(Kf.Oi);hg.push(Cp);hg.push(Kf.je);hg.push(Xt);hg.push(Dp);hg.push(Cw);hg.push(Dw);0===wm?ui=Dp.copy():ui.Gh(Dp);w.v(Lg);w.v(Vk);w.Gb(Wt);w.ue(Kg)}this.xm.push(ui);bb(xw,ui.x,ui.y,ui.width,ui.height)}Xl(si,!1)}}break;case "TableRow":case "TableColumn":w.k(this.toString()+" is not an element of a Table Panel. TableRow and TableColumn Panels can only be elements of a Table Panel.");break;default:w.k("Unknown panel type: "+n)}}var mf=e.width,nf=e.height,
xm=this.padding,Ew=xm.top+xm.bottom,mf=mf+(xm.left+xm.right),nf=nf+Ew;isFinite(f.width)&&(mf=f.width);isFinite(f.height)&&(nf=f.height);mf=Math.min(k.width,mf);nf=Math.min(k.height,nf);mf=Math.max(h.width,mf);nf=Math.max(h.height,nf);mf=Math.max(c,mf);nf=Math.max(d,nf);e.width=mf;e.height=nf;Pa(this.Sc,mf,nf);yo(this,0,0,mf,nf)};
C.prototype.findMainElement=C.prototype.Hd=function(){if(null===this.dn){var a=this.wa.n,b=a.length;if(0===b)return null;for(var c=0;c<b;c++){var d=a[c];if(!0===d.Uf)return this.dn=d}this.dn=a[0]}return this.dn};function Hp(a){return null!==a.U?a.U.Xf:null}
C.prototype.hj=function(a,b,c,d){var e=this.fj,f=this.wa.n,h=w.Vg(0,0,0,0);if(0===f.length){var k=this.Y;k.x=a;k.y=b;k.width=c;k.height=d}else{if(!this.Aa.H()){var l=Bo(this,!0),m=this.od,n=m.width,p=m.height,q=this.margin,r=q.left+q.right,s=q.top+q.bottom;n===c&&p===d&&(l=Ij);switch(l){case Ij:if(n>c||p>d)this.I(),rk(this,n>c?c:n,p>d?d:p);break;case Ie:this.I(!0);rk(this,c+r,d+s,0,0);break;case no:this.I(!0);rk(this,c+r,p+s,0,0);break;case mo:this.I(!0),rk(this,n+r,d+s,0,0)}}k=this.Y;k.x=a;k.y=b;
k.width=c;k.height=d;var u=this.ma.Qb;switch(u){case "Position":for(var t=f.length,x=e.x-this.padding.left,v=e.y-this.padding.top,B=0;B<t;B++){var y=f[B],H=y.za,E=y.margin,V=y.position.x,ba=y.position.y;h.x=isNaN(V)?-x:V-x;h.y=isNaN(ba)?-v:ba-v;if(y instanceof X){var Q=y;if(Q.fF){var $=Q.kb/2;h.x-=$;h.y-=$}}h.x+=E.left;h.y+=E.top;h.width=H.width;h.height=H.height;y.visible&&y.gc(h.x,h.y,h.width,h.height)}break;case "Vertical":for(var ca=f.length,R=this.padding.left,Ra=this.mF,hb=Ra?e.height:this.padding.top,
qa=0;qa<ca;qa++){var Ja=R,za=f[qa];if(za.visible){var Pb=za.za,Lb=za.margin,ae=Lb.left+Lb.right,pd=R+this.padding.right,rc=Pb.width,xg=Bo(za,!1);if(isNaN(za.Aa.width)&&xg===Ie||xg===no)rc=Math.max(e.width-ae-pd,0);var Df=rc+ae+pd,Wa=za.alignment;Wa.Uc()&&(Wa=this.Ll);Wa.fd()||(Wa=Fb);Ra&&(hb-=Pb.height+Lb.bottom+Lb.top);za.gc(Ja+Wa.offsetX+Lb.left+(e.width*Wa.x-Df*Wa.x),hb+Wa.offsetY+Lb.top,rc,Pb.height);Ra||(hb+=Pb.height+Lb.bottom+Lb.top)}}break;case "Horizontal":for(var lb=f.length,na=this.padding.top,
la=this.mF,ib=la?e.width:this.padding.left,jb=0;jb<lb;jb++){var fb=na,se=f[jb];if(se.visible){var Ed=se.za,tb=se.margin,Le=tb.top+tb.bottom,ed=na+this.padding.bottom,ag=Ed.height,Ef=Bo(se,!1);if(isNaN(se.Aa.height)&&Ef===Ie||Ef===mo)ag=Math.max(e.height-Le-ed,0);var yg=ag+Le+ed,kb=se.alignment;kb.Uc()&&(kb=this.Ll);kb.fd()||(kb=Fb);la&&(ib-=Ed.width+tb.left+tb.right);se.gc(ib+kb.offsetX+tb.left,fb+kb.offsetY+tb.top+(e.height*kb.y-yg*kb.y),Ed.width,ag);la||(ib+=Ed.width+tb.left+tb.right)}}break;case "Spot":var wc=
f.length,qd=this.Hd(),bg=qd.za,Bb=bg.width,Mb=bg.height,te=this.padding,zg=te.left,Fd=te.top;h.x=zg-e.x;h.y=Fd-e.y;qd.gc(h.x,h.y,Bb,Mb);for(var mb=0;mb<wc;mb++){var Jc=f[mb];if(Jc!==qd){var Ff=Jc.za,Me=Ff.width,Wh=Ff.height,Sa=Jc.alignment;Sa.Uc()&&(Sa=this.Ll);Sa.fd()||(Sa=Fb);var cb=Jc.oh;cb.Uc()&&(cb=Fb);var xc=null;Jc instanceof C&&""!==Jc.Hj&&(xc=Jc.sd(Jc.Hj),xc===Jc&&(xc=null));if(null!==xc){for(var sc=xc.Ia,Vc=w.xb(cb.x*sc.width+cb.offsetX,cb.y*sc.height+cb.offsetY);xc!==Jc;)xc.transform.nb(Vc),
xc=xc.O;h.x=Sa.x*Bb+Sa.offsetX-Vc.x;h.y=Sa.y*Mb+Sa.offsetY-Vc.y;w.v(Vc)}else h.x=Sa.x*Bb+Sa.offsetX-(cb.x*Me-cb.offsetX),h.y=Sa.y*Mb+Sa.offsetY-(cb.y*Wh-cb.offsetY);h.x-=e.x;h.y-=e.y;Jc.visible&&Jc.gc(zg+h.x,Fd+h.y,Me,Wh)}}break;case "Auto":var jh=f.length,Ya=this.Hd(),xb=Ya.za,ub=w.Df();ub.l(0,0,1,1);var yc=Ya.margin,yb=yc.left,ob=yc.top,Gb=this.padding,be=Gb.left,Cb=Gb.top;h.x=yb;h.y=ob;h.width=xb.width;h.height=xb.height;Ya.gc(be+h.x,Cb+h.y,h.width,h.height);var Qb=Ip(Ya),fd=Jp(Ya),Xh=0+Qb.y*xb.height+
Qb.offsetY,Nb=0+fd.x*xb.width+fd.offsetX,Ob=0+fd.y*xb.height+fd.offsetY;ub.x=0+Qb.x*xb.width+Qb.offsetX;ub.y=Xh;bb(ub,Nb,Ob,0,0);ub.x+=yb+be;ub.y+=ob+Cb;for(var zc=0;zc<jh;zc++){var Wc=f[zc];if(Wc!==Ya){var rd=Wc.za,yc=Wc.margin,Ag=Math.max(rd.width+yc.right+yc.left,0),Yh=Math.max(rd.height+yc.top+yc.bottom,0),pb=Wc.alignment;pb.Uc()&&(pb=this.Ll);pb.fd()||(pb=Fb);h.x=ub.width*pb.x+pb.offsetX-Ag*pb.x+yc.left+ub.x;h.y=ub.height*pb.y+pb.offsetY-Yh*pb.y+yc.top+ub.y;h.width=ub.width;h.height=ub.height;
Wc.visible&&(db(ub.x,ub.y,ub.width,ub.height,h.x,h.y,rd.width,rd.height)?Wc.gc(h.x,h.y,rd.width,rd.height):Wc.gc(h.x,h.y,rd.width,rd.height,new A(ub.x,ub.y,ub.width,ub.height)))}}w.Gb(ub);break;case "Table":for(var Xc=f.length,Zh=this.padding,Ne=Zh.left,ec=Zh.top,ue=this.Os,Wb=0,Ac=0,sd=ue.length,fc=0,Ta=0;Ta<sd;Ta++)ue[Ta]&&(fc=Math.max(fc,ue[Ta].length));for(var gc=Math.min(this.ej,sd-1);gc!==sd&&(void 0===this.Yd[gc]||0===this.Yd[gc].Sa);)gc++;for(var gc=Math.min(gc,sd-1),$h=-this.Yd[gc].hb,bf=
Math.min(this.Ni,fc-1);bf!==fc&&(void 0===this.Td[bf]||0===this.Td[bf].Sa);)bf++;for(var bf=Math.min(bf,fc-1),Gd=-this.Td[bf].hb,Oe=w.im(),Ta=0;Ta<sd;Ta++)if(ue[Ta]){var fc=ue[Ta].length,kh=this.be(Ta),Ac=kh.hb+$h+ec;0!==kh.Sa&&(Ac+=kh.oE());for(var Hd=0;Hd<fc;Hd++)if(ue[Ta][Hd]){var lh=this.ae(Hd),Wb=lh.hb+Gd+Ne;0!==lh.Sa&&(Wb+=lh.oE());for(var jj=ue[Ta][Hd],mh=jj.length,Dk=0;Dk<mh;Dk++){var zb=jj[Dk],ce=zb.za,gd=zb instanceof C?zb:null;if(null===gd||gd.type!==Go&&gd.type!==Ho){Oe.l(0,0);for(var Pe=
1;Pe<zb.rowSpan&&!(Ta+Pe>=this.qq);Pe++){var ai=this.be(Ta+Pe);Oe.height+=ai.total}for(Pe=1;Pe<zb.qH&&!(Hd+Pe>=this.Lp);Pe++){var bi=this.ae(Hd+Pe);Oe.width+=bi.total}var kj=lh.Sa+Oe.width,lj=kh.Sa+Oe.height;h.x=Wb;h.y=Ac;h.width=kj;h.height=lj;var Db=Wb,nh=Ac,oh=kj,ma=lj;Wb+kj>e.width&&(oh=Math.max(e.width-Wb,0));Ac+lj>e.height&&(ma=Math.max(e.height-Ac,0));var aa=zb.alignment,de=0,cg=0,ci=0,hc=0;if(aa.Uc()){aa=this.Ll;aa.fd()||(aa=Fb);var de=aa.x,cg=aa.y,ci=aa.offsetX,hc=aa.offsetY,di=lh.alignment,
ic=kh.alignment;di.fd()&&(de=di.x,ci=di.offsetX);ic.fd()&&(cg=ic.y,hc=ic.offsetY)}else de=aa.x,cg=aa.y,ci=aa.offsetX,hc=aa.offsetY;if(isNaN(de)||isNaN(cg))cg=de=.5,hc=ci=0;var cf=ce.width,Qe=ce.height,df=zb.margin,ve=df.left+df.right,we=df.top+df.bottom,Yc=Qo(zb,kh,lh,!1);!isNaN(zb.Aa.width)||Yc!==Ie&&Yc!==no||(cf=Math.max(kj-ve,0));!isNaN(zb.Aa.height)||Yc!==Ie&&Yc!==mo||(Qe=Math.max(lj-we,0));var Id=zb.Af,ph=zb.zh,cf=Math.min(Id.width,cf),Qe=Math.min(Id.height,Qe),cf=Math.max(ph.width,cf),Qe=Math.max(ph.height,
Qe),Z=Qe+we;h.x+=h.width*de-(cf+ve)*de+ci+df.left;h.y+=h.height*cg-Z*cg+hc+df.top;zb.visible&&(db(Db,nh,oh,ma,h.x,h.y,ce.width,ce.height)?zb.gc(h.x,h.y,cf,Qe):zb.gc(h.x,h.y,cf,Qe,new A(Db,nh,oh,ma)))}else{zb.Ii();zb.mc.Ra();var ef=zb.mc;ef.x=gd.type===Go?Ne:Wb;ef.y=gd.type===Ho?ec:Ac;ef.width=ce.width;ef.height=ce.height;zb.mc.freeze();Co(zb,!1)}}}}w.zk(Oe);for(Ta=0;Ta<Xc;Ta++)zb=f[Ta],gd=zb instanceof C?zb:null,null===gd||gd.type!==Go&&gd.type!==Ho||(ef=zb.mc,zb.Sc.Ra(),zb.Sc.l(0,0,ef.width,ef.height),
zb.Sc.freeze());break;case "Viewbox":var dg=f[0],qh=dg.za,rh=dg.margin,Jd=rh.top+rh.bottom,Ek=Math.max(qh.width+(rh.right+rh.left),0),qb=Math.max(qh.height+Jd,0),Ua=dg.alignment;Ua.Uc()&&(Ua=this.Ll);Ua.fd()||(Ua=Fb);h.x=e.width*Ua.x-Ek*Ua.x+Ua.offsetX;h.y=e.height*Ua.y-qb*Ua.y+Ua.offsetY;h.width=qh.width;h.height=qh.height;dg.gc(h.x,h.y,h.width,h.height);break;case "Link":var bm=f.length;if(this instanceof dh||this instanceof W){var Fk=null;this instanceof W&&(Fk=this);this instanceof dh&&(Fk=this.Nf);
var mj=Fk,ei=this instanceof dh?null:mj.path;if(null!==this.$g){var tc=this.$g.n,xe=0;if(null!==ei&&xe<this.$g.count){var td=tc[xe];xe++;ei.gc(td.x-this.fj.x,td.y-this.fj.y,td.width,td.height)}for(var Kc=0;Kc<bm;Kc++){var Gk=f[Kc];Gk!==ei&&xe<this.$g.count&&(td=tc[xe],xe++,Gk.gc(td.x-this.fj.x,td.y-this.fj.y,td.width,td.height))}}var cm=mj.points,dm=cm.count;if(2<=dm&&this instanceof W)for(var Gf=this.Vf;Gf.next();){var Rb=Gf.value,Kd=dm,Ld=cm,Bc=Rb.Me,ee=Rb.XA,ud=Rb.oh,Bg=Rb.rq,nj=Rb.YA,sh=0,th=
0,fi=0;if(Bc<-Kd||Bc>=Kd){var gi=this.wF,eg=this.vF;Bg!==dj&&(fi=this.computeAngle(Rb,Bg,eg),Rb.angle=fi);sh=gi.x;th=gi.y}else{var jc=void 0,Va=void 0;if(0<=Bc)jc=Ld.n[Bc],Va=Bc<Kd-1?Ld.n[Bc+1]:jc;else var Md=Kd+Bc,jc=Ld.n[Md],Va=0<Md?Ld.n[Md-1]:jc;if(jc.Ic(Va)){var Nd=void 0,ff=void 0;0<=Bc?(Nd=0<Bc?Ld.n[Bc-1]:jc,ff=Bc<Kd-2?Ld.n[Bc+2]:Va):(Nd=Md<Kd-1?Ld.n[Md+1]:jc,ff=1<Md?Ld.n[Md-2]:Va);var Hf=Nd.uf(jc),nb=Va.uf(ff),eg=Hf>nb+10?0<=Bc?Nd.yc(jc):jc.yc(Nd):nb>Hf+10?0<=Bc?Va.yc(ff):ff.yc(Va):0<=Bc?Nd.yc(ff):
ff.yc(Nd)}else eg=0<=Bc?jc.yc(Va):Va.yc(jc);Bg!==dj&&(fi=this.computeAngle(Rb,Bg,eg),Rb.angle=fi);sh=jc.x+(Va.x-jc.x)*ee;th=jc.y+(Va.y-jc.y)*ee}if(ud.L(sb))Rb.location=new z(sh,th);else{ud.Nd()&&(ud=Fb);var gf=w.Ef();gf.reset();gf.scale(Rb.scale,Rb.scale);gf.rotate(Rb.angle,0,0);var hd=Rb.Ia,Cg=w.Vg(0,0,hd.width,hd.height),hf=w.K();hf.Vn(Cg,ud);gf.nb(hf);var Cc=-hf.x,hi=-hf.y,Re=nj.copy();isNaN(Re.x)&&(Re.x=0<=Bc?hf.x+3:-(hf.x+3));isNaN(Re.y)&&(Re.y=-(hf.y+3));Re.rotate(eg);sh+=Re.x;th+=Re.y;gf.sG(Cg);
var Cc=Cc+Cg.x,hi=hi+Cg.y,Dg=w.xb(sh+Cc,th+hi);Rb.move(Dg);w.v(Dg);w.v(hf);w.Gb(Cg);w.ue(gf)}}this.lu(!1)}break;case "Grid":break;case "Graduated":if(null!==this.xm){var Eg=this.Hd(),oj=this.zm,Hk=this.xm,ye=0,Zc=Hk[ye];ye++;Eg.gc(Zc.x-e.x,Zc.y-e.y,Zc.width,Zc.height);for(var Ik=f.length,uh=0;uh<Ik;uh++){var id=f[uh],pj=oj[uh];id.visible&&id!==Eg&&0!==pj.length&&(Zc=Hk[ye],ye++,id.gc(Zc.x-e.x,Zc.y-e.y,Zc.width,Zc.height))}this.xm=null}break;case "TableRow":case "TableColumn":w.k(this.toString()+" is not an element of a Table Panel.TableRow and TableColumn panels can only be elements of a Table Panel.");
break;default:w.k("Unknown panel type: "+u)}w.Gb(h)}};C.prototype.uk=function(a){var b=this.Ia,c=Hp(this);if(db(0,0,b.width,b.height,a.x,a.y)){for(var b=this.wa.n,d=b.length,e=w.xb(0,0);d--;){var f=b[d];if(f.visible||f===c)if(La(e.set(a),f.transform),f.Ha(e))return w.v(e),!0}w.v(e);return null===this.Db&&null===this.Zb?!1:!0}return!1};C.prototype.hx=function(a){if(this.no===a)return this;for(var b=this.wa.n,c=b.length,d=0;d<c;d++){var e=b[d].hx(a);if(null!==e)return e}return null};
function Xo(a,b,c){c(a,b);if(b instanceof C){b=b.wa.n;for(var d=b.length,e=0;e<d;e++)Xo(a,b[e],c)}}function Im(a,b){Tp(a,a,b)}function Tp(a,b,c){c(b);b=b.wa.n;for(var d=b.length,e=0;e<d;e++){var f=b[e];f instanceof C&&Tp(a,f,c)}}C.prototype.walkVisualTree=C.prototype.RJ=function(a){Up(this,this,a)};function Up(a,b,c){c(b);if(b instanceof C){b=b.wa.n;for(var d=b.length,e=0;e<d;e++)Up(a,b[e],c)}}C.prototype.findInVisualTree=C.prototype.Kt=function(a){return Vp(this,this,a)};
function Vp(a,b,c){if(c(b))return b;if(b instanceof C){b=b.wa.n;for(var d=b.length,e=0;e<d;e++){var f=Vp(a,b[e],c);if(null!==f)return f}}return null}C.prototype.findObject=C.prototype.sd=function(a){if(this.name===a)return this;for(var b=this.wa.n,c=b.length,d=0;d<c;d++){var e=b[d];if(e.name===a)return e;if(e instanceof C)if(null===e.Zj&&null===e.sg){if(e=e.sd(a),null!==e)return e}else if(fn(e)&&(e=e.wa.first(),null!==e&&(e=e.sd(a),null!==e)))return e}return null};
function Wp(a){a=a.wa.n;for(var b=a.length,c=0,d=0;d<b;d++){var e=a[d];if(e instanceof C)c=Math.max(c,Wp(e));else if(e instanceof X){a:{if(null!==!e.Lf)switch(e.Fo){case "None":case "Square":case "Ellipse":case "Circle":case "LineH":case "LineV":case "FramedRectangle":case "RoundedRectangle":case "Line1":case "Line2":case "Border":case "Cube1":case "Cube2":case "Junction":case "Cylinder1":case "Cylinder2":case "Cylinder3":case "Cylinder4":case "PlusLine":case "XLine":case "ThinCross":case "ThickCross":e=
0;break a}e=e.fi/2*e.cn*e.nj()}c=Math.max(c,e)}}return c}g=C.prototype;g.Yg=function(){return!(this.type===Go||this.type===Ho)};
g.Je=function(a,b,c){if(!1===this.Sg)return null;void 0===b&&(b=null);void 0===c&&(c=null);if(zm(this))return null;var d=this.Ia,e=1/this.nj(),f=this.Yg(),h=f?a:La(w.xb(a.x,a.y),this.transform),k=this.g,l=10,m=5;null!==k&&(l=k.Ut("extraTouchArea"),m=l/2);if(db(-(m*e),-(m*e),d.width+l*e,d.height+l*e,h.x,h.y)){if(!this.En){var e=this.wa.n,n=e.length,k=w.K(),m=(l=this.Zt)?this.Hd():null;if(l&&(m.Yg()?La(k.set(a),m.transform):k.set(a),!m.Ha(k)))return w.v(k),f||w.v(h),null;for(var p=Hp(this);n--;){var q=
e[n];if(q.visible||q===p)if(q.Yg()?La(k.set(a),q.transform):k.set(a),!l||q!==m){var r=null;q instanceof C?r=q.Je(k,b,c):!0===q.Sg&&q.Ha(k)&&(r=q);if(null!==r&&(null!==b&&(r=b(r)),null!==r&&(null===c||c(r))))return w.v(k),f||w.v(h),r}}w.v(k)}if(null===this.background&&null===this.jn)return f||w.v(h),null;a=db(0,0,d.width,d.height,h.x,h.y)?this:null;f||w.v(h);return a}f||w.v(h);return null};
g.Mt=function(a,b,c,d){if(!1===this.Sg)return!1;void 0===b&&(b=null);void 0===c&&(c=null);d instanceof I||d instanceof J||(d=new I(G));var e=this.Ia,f=this.Yg(),h=f?a:La(w.xb(a.x,a.y),this.transform);if(db(0,0,e.width,e.height,h.x,h.y)){if(!this.En){for(var e=this.wa.n,k=e.length,l=w.K(),m=Hp(this);k--;){var n=e[k];if(n.visible||n===m){n.Yg()?La(l.set(a),n.transform):l.set(a);var p=n,n=n instanceof C?n:null;(null!==n?n.Mt(l,b,c,d):p.Ha(l))&&!1!==p.Sg&&(null!==b&&(p=b(p)),null===p||null!==c&&!c(p)||
d.add(p))}}w.v(l)}f||w.v(h);return null!==this.background||null!==this.jn}f||w.v(h);return!1};
g.yk=function(a,b,c,d,e,f){if(!1===this.Sg)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var h=f;void 0===f&&(h=w.Ef(),h.reset());h.multiply(this.transform);if(this.on(a,h))return Xp(this,b,c,e),void 0===f&&w.ue(h),!0;if(this.Kg(a,h)){if(!this.En)for(var k=Hp(this),l=this.wa.n,m=l.length;m--;){var n=l[m];if(n.visible||n===k){var p=n.Y,q=this.Ia;if(!(p.x>q.width||p.y>q.height||0>p.x+p.width||0>p.y+p.height)){p=n;n=n instanceof C?n:null;q=w.Ef();q.set(h);if(null!==n?n.yk(a,b,c,d,e,q):Ao(p,a,d,
q))null!==b&&(p=b(p)),null===p||null!==c&&!c(p)||e.add(p);w.ue(q)}}}void 0===f&&w.ue(h);return d}void 0===f&&w.ue(h);return!1};function Xp(a,b,c,d){for(var e=a.wa.n,f=e.length;f--;){var h=e[f];if(h.visible){var k=h.Y,l=a.Ia;k.x>l.width||k.y>l.height||0>k.x+k.width||0>k.y+k.height||(h instanceof C&&Xp(h,b,c,d),null!==b&&(h=b(h)),null===h||null!==c&&!c(h)||d.add(h))}}}
g.un=function(a,b,c,d,e,f){if(!1===this.Sg)return!1;void 0===c&&(c=null);void 0===d&&(d=null);var h=this.Ia,k=this.Yg(),l=k?a:La(w.xb(a.x,a.y),this.transform),m=k?b:La(w.xb(b.x,b.y),this.transform),n=l.uf(m),p=0<l.x&&l.x<h.width&&0<l.y&&l.y<h.height||Ma(l.x,l.y,0,0,0,h.height)<n||Ma(l.x,l.y,0,h.height,h.width,h.height)<n||Ma(l.x,l.y,h.width,h.height,h.width,0)<n||Ma(l.x,l.y,h.width,0,0,0)<n,h=0<l.x&&l.x<h.width&&0<l.y&&l.y<h.height&&Ma(l.x,l.y,0,0,0,h.height)<n&&Ma(l.x,l.y,0,h.height,h.width,h.height)<
n&&Ma(l.x,l.y,h.width,h.height,h.width,0)<n&&Ma(l.x,l.y,h.width,0,0,0)<n;k||(w.v(l),w.v(m));if(p){if(!this.En){for(var k=w.K(),l=w.K(),m=Hp(this),n=this.wa.n,q=n.length;q--;){var r=n[q];if(r.visible||r===m){var s=r.Y,u=this.Ia;s.x>u.width||s.y>u.height||0>s.x+s.width||0>s.y+s.height||(r.Yg()?(s=r.transform,La(k.set(a),s),La(l.set(b),s)):(k.set(a),l.set(b)),s=r,r=r instanceof C?r:null,null!==r?!r.un(k,l,c,d,e,f):!s.JE(k,l,e))||(null!==c&&(s=c(s)),null===s||null!==d&&!d(s)||f.add(s))}}w.v(k);w.v(l)}return e?
p:h}return!1};function Ip(a){var b=null;a instanceof X&&(b=a.A,b===oc&&(b=null),a=a.vf,null!==a&&null===b&&(b=a.A));null===b&&(b=vb);return b}function Jp(a){var b=null;a instanceof X&&(b=a.B,b===oc&&(b=null),a=a.vf,null!==a&&null===b&&(b=a.B));null===b&&(b=Kb);return b}C.prototype.add=C.prototype.add=function(a){w.G(a,G,C,"add:element");this.Ld(this.wa.count,a)};C.prototype.elt=C.prototype.da=function(a){return this.wa.da(a)};
C.prototype.insertAt=C.prototype.Ld=function(a,b){b instanceof S&&w.k("Cannot add a Part to a Panel: "+b);if(this===b||this.Xl(b))this===b&&w.k("Cannot make a Panel contain itself: "+this.toString()),w.k("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+b.toString());var c=b.O;null!==c&&c!==this&&w.k("Cannot add a GraphObject that already belongs to another Panel to this Panel: "+b.toString()+", already contained by "+c.toString()+", cannot be shared by this Panel: "+
this.toString());this.ma!==El||b instanceof X||w.k("Can only add Shapes to a Grid Panel, not: "+b);this.ma!==fp||b instanceof X||b instanceof Ch||w.k("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+b);b.em(this);b.Sm=null;if(null!==this.eq){var d=b.data;null!==d&&"object"===typeof d&&(null===this.rg&&(this.rg=new ka(Object,C)),this.rg.add(d,b))}var e=this.wa,d=-1;if(c===this){for(var f=-1,h=this.wa.n,k=h.length,l=0;l<k;l++)if(h[l]===b){f=l;break}if(-1!==f){if(f===a||f+1>=e.count&&
a>=e.count)return;e.Xc(f);d=f}else w.k("element "+b.toString()+" has panel "+c.toString()+" but is not contained by it.")}if(0>a||a>e.count)a=e.count;e.Ld(a,b);this.I();b.I();null!==b.Pd?this.Ck=!0:b instanceof C&&!0===b.Ck&&(this.Ck=!0);this.Sj=null;c=this.U;null!==c&&(c.Nm=null,c.bk=NaN,this.Ck&&c instanceof T&&(c.Ck=!0),c.Ck&&c instanceof T&&(c.le=null),e=this.g,null!==e&&e.oa.fb||(-1!==d&&c.Wc(Pf,"elements",this,b,null,d,null),c.Wc(Of,"elements",this,null,b,null,a),this.au()||Yp(this,b,!1)))};
w.defineProperty(C,{Ck:null},function(){return 0!==(this.P&8388608)},function(a){0!==(this.P&8388608)!==a&&(this.P^=8388608)});function Zp(a,b){a.P=b?a.P|16777216:a.P&-16777217}C.prototype.remove=C.prototype.remove=function(a){w.G(a,G,C,"remove:element");for(var b=this.wa.n,c=b.length,d=-1,e=0;e<c;e++)if(b[e]===a){d=e;break}-1!==d&&this.jf(d)};C.prototype.removeAt=C.prototype.Xc=function(a){0<=a&&this.jf(a)};
C.prototype.jf=function(a){var b=this.wa,c=b.da(a);c.Sm=null;c.em(null);if(null!==this.rg){var d=c.data;"object"===typeof d&&this.rg.remove(d)}b.Xc(a);Xl(this,!1);this.I();this.dn===c&&(this.dn=null);this.Sj=null;b=this.U;null!==b&&(b.Nm=null,b.bk=NaN,b.ce(),d=this.g,null!==d&&d.oa.fb||b.Wc(Pf,"elements",this,c,null,a,null))};w.u(C,{qq:"rowCount"},function(){return void 0===this.Yd?0:this.Yd.length});
C.prototype.getRowDefinition=C.prototype.be=function(a){0>a&&w.Ea(a,">= 0",C,"getRowDefinition:idx");a=Math.round(a);var b=this.Yd;if(void 0===b[a]){var c=new Pg;c.em(this);c.ve=!0;c.index=a;b[a]=c}return b[a]};C.prototype.removeRowDefinition=C.prototype.OF=function(a){0>a&&w.Ea(a,">= 0",C,"removeRowDefinition:idx");a=Math.round(a);var b=this.Yd;this.Wc(Pf,"coldefs",this,b[a],null,a,null);b[a]&&delete b[a];this.I()};w.u(C,{Lp:"columnCount"},function(){return void 0===this.Td?0:this.Td.length});
C.prototype.getColumnDefinition=C.prototype.ae=function(a){0>a&&w.Ea(a,">= 0",C,"getColumnDefinition:idx");a=Math.round(a);var b=this.Td;if(void 0===b[a]){var c=new Pg;c.em(this);c.ve=!1;c.index=a;b[a]=c}return b[a]};C.prototype.removeColumnDefinition=C.prototype.LF=function(a){0>a&&w.Ea(a,">= 0",C,"removeColumnDefinition:idx");a=Math.round(a);var b=this.Td;this.Wc(Pf,"coldefs",this,b[a],null,a,null);b[a]&&delete b[a];this.I()};
w.defineProperty(C,{rJ:"rowSizing"},function(){return void 0===this.Vm?ep:this.Vm},function(a){if(void 0!==this.Vm){var b=this.Vm;b!==a&&(a!==ep&&a!==Lp&&w.k("Panel.rowSizing must be RowColumnDefinition.ProportionalExtra or RowColumnDefinition.None, not: "+a),this.Vm=a,this.I(),this.h("rowSizing",b,a))}});
w.defineProperty(C,{pH:"columnSizing"},function(){return void 0===this.sm?ep:this.sm},function(a){if(void 0!==this.sm){var b=this.sm;b!==a&&(a!==ep&&a!==Lp&&w.k("Panel.columnSizing must be RowColumnDefinition.ProportionalExtra or RowColumnDefinition.None, not: "+a),this.sm=a,this.I(),this.h("columnSizing",b,a))}});
w.defineProperty(C,{OL:"topIndex"},function(){return void 0===this.ej?0:this.ej},function(a){if(void 0!==this.ej){var b=this.ej;b!==a&&((!isFinite(a)||0>a)&&w.k("Panel.topIndex must be greater than zero and a real number, not: "+a),this.ej=a,this.I(),this.h("topIndex",b,a))}});
w.defineProperty(C,{aL:"leftIndex"},function(){return void 0===this.Ni?0:this.Ni},function(a){if(void 0!==this.Ni){var b=this.Ni;b!==a&&((!isFinite(a)||0>a)&&w.k("Panel.leftIndex must be greater than zero and a real number, not: "+a),this.Ni=a,this.I(),this.h("leftIndex",b,a))}});C.prototype.findRowForLocalY=function(a){if(0>a)return-1;if(this.type!==Po)return NaN;for(var b=0,c=this.Yd,d=c.length,e=this.ej;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))return e}return-1};
C.prototype.findColumnForLocalX=function(a){if(0>a)return-1;if(this.type!==Po)return NaN;for(var b=0,c=this.Td,d=c.length,e=this.Ni;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))return e}return-1};C.prototype.graduatedPointForValue=function(a,b){void 0===b&&(b=new z(NaN,NaN));if(this.type!==fp)return b.l(NaN,NaN),b;a=Math.min(Math.max(a,this.Bk),this.nA);var c=(a-this.Bk)/this.ox,d=this.Hd();d.vf.XH(c,b);c=w.Ef();c.set(d.transform);b.transform(c);w.ue(c);return b};
C.prototype.graduatedValueForPoint=function(a){if(this.type!==fp)return NaN;var b=this.Hd(),c=b.vf,d=w.Ef();d.set(b.transform);d.qx();a.transform(d);w.ue(d);return c.TH(a)*this.ox+this.Bk};
w.defineProperty(C,{data:"data"},function(){return this.Vd},function(a){var b=this.Vd;if(b!==a){var c=this instanceof S&&!(this instanceof dh);c&&w.j(a,"object",C,"data");fh(this);this.Vd=a;var d=this.g;null!==d&&(c?this instanceof W?(null!==b&&d.Kj.remove(b),null!==a&&d.Kj.add(a,this)):this instanceof S&&(null!==b&&d.Ai.remove(b),null!==a&&d.Ai.add(a,this)):(c=this.O,null!==c&&null!==c.rg&&(null!==b&&c.rg.remove(b),null!==a&&c.rg.add(a,this))));this.h("data",b,a);null!==d&&d.oa.fb||null!==a&&this.Hb()}});
w.defineProperty(C,{fu:"itemIndex"},function(){return this.Rr},function(a){var b=this.Rr;b!==a&&(this.Rr=a,this.h("itemIndex",b,a))});function Yo(a){a=a.Wk;return null!==a&&a.Q}
function fh(a){var b=a.Wk;if(null===b)null!==a.data&&w.k("Template cannot have .data be non-null: "+a),a.Wk=b=new I(Vg);else if(b.Q)return;var c=new I(G);Zp(a,!1);Xo(a,a,function(a,d){var e=d.sc;if(null!==e)for(To(d,!1),e=e.i;e.next();){var f=e.value;f.mode===Xg&&To(d,!0);var h=f.yq;null!==h&&("/"===h&&Zp(a,!0),h=Yg(f,a,d),null!==h&&(c.add(h),null===h.pp&&(h.pp=new I(Vg)),h.pp.add(f)));b.add(f)}if(d instanceof C&&d.type===Po){if(0<d.Yd.length)for(e=d.Yd,f=e.length,h=0;h<f;h++){var k=e[h];if(void 0!==
k&&null!==k.sc)for(var l=k.sc.i;l.next();){var t=l.value;t.Bg=k;t.it=2;t.xp=k.index;b.add(t)}}if(0<d.Td.length)for(e=d.Td,f=e.length,h=0;h<f;h++)if(k=e[h],void 0!==k&&null!==k.sc)for(l=k.sc.i;l.next();)t=l.value,t.Bg=k,t.it=1,t.xp=k.index,b.add(t)}});for(var d=c.i;d.next();){var e=d.value;if(null!==e.pp){To(e,!0);for(var f=e.pp.i;f.next();){var h=f.value;null===e.sc&&(e.sc=new I(Vg));e.sc.add(h)}}e.pp=null}for(d=b.i;d.next();)if(e=d.value,f=e.Bg,null!==f){e.Bg=null;var k=e.jy,l=k.indexOf(".");0<l&&
f instanceof C&&(h=k.substring(0,l),k=k.substr(l+1),l=f.sd(h),null!==l?(f=l,e.jy=k):w.trace('Warning: unable to find GraphObject named "'+h+'" for Binding: '+e.toString()));f instanceof Pg?(e.hm=w.Jd(f.O),f.O.no=e.hm):(e.hm=w.Jd(f),f.no=e.hm)}b.freeze();a instanceof S&&a.de()&&a.Ze()}C.prototype.copyTemplate=function(){var a=this.copy();a.RJ(function(a){a instanceof C&&(a.Wk=null,a.Vd=null);var c=a.sc;null!==c&&(a.sc=null,c.each(function(c){a.bind(c.copy())}))});return a};
C.prototype.updateTargetBindings=C.prototype.Hb=function(a){var b=this.Wk;if(null!==b)for(void 0===a&&(a=""),b=b.i;b.next();){var c=b.value,d=c.gG;if(""===a||""===d||d===a)if(d=c.jy,null!==c.uH||""!==d){var d=this.data,e=c.yq;if(null!==e)d=""===e?this:"/"===e?this:"."===e?this:".."===e?this:this.sd(e);else{var f=this.g;null!==f&&c.zx&&(d=f.ba.Fk)}if(null!==d){var f=this,h=c.hm;if(-1!==h){if(f=this.hx(h),null===f)continue}else null!==c.Bg&&(f=c.Bg);"/"===e?d=f.U:"."===e?d=f:".."===e&&(d=f.O);e=c.it;
if(0!==e){if(!(f instanceof C))continue;h=f;1===e?f=h.ae(c.xp):2===e&&(f=h.be(c.xp))}void 0!==f&&c.vG(f,d)}}}};w.defineProperty(C,{eq:"itemArray"},function(){return this.Zj},function(a){var b=this.Zj;if(b!==a){var c=this.g;null!==c&&null!==b&&Om(c,this);this.Zj=a;null!==c&&null!==a&&Km(c,this);this.h("itemArray",b,a);null!==c&&c.oa.fb||this.SA()}});
function fn(a){return a.type===Gj||a.type===Bl||a.type===aj||a.type===Po&&0<a.wa.length&&(a=a.wa.da(0),a.Uf&&a instanceof C&&(a.type===Go||a.type===Ho))?!0:!1}C.prototype.rebuildItemElements=C.prototype.SA=function(){var a=0;for(fn(this)&&(a=1);this.wa.length>a;)this.jf(this.wa.length-1);a=this.eq;if(null!==a)for(var b=w.Ya(a),c=0;c<b;c++)en(this,w.Da(a,c),c)};
C.prototype.findItemPanelForData=C.prototype.NH=function(a){if(void 0===a||null===a||null===this.rg)return null;w.j(a,"object",C,"findItemPanelForData");return this.rg.ka(a)};
function en(a,b,c){if(!(void 0===b||null===b||0>c)){var d;d=$p(a,b);var e=a.wI,f=null;null!==e&&(f=e.ka(d));null===f&&(aq||(aq=!0,w.trace('No item template Panel found for category "'+d+'" on '+a),w.trace("  Using default item template."),d=new C,e=new Ch,e.bind(new Vg("text","",Qf)),d.add(e),bq=d),f=bq);d=f;null!==d&&(fh(d),d=d.copy(),0!==(d.P&16777216)&&(e=a.Pl(),null!==e&&Zp(e,!0)),"object"===typeof b&&(null===a.rg&&(a.rg=new ka(Object,C)),a.rg.add(b,d)),e=c,fn(a)&&e++,a.Ld(e,d),d.Vd=b,gn(a,e,
c),d.Vd=null,d.data=b)}}function gn(a,b,c){for(a=a.wa;b<a.length;){var d=a.da(b);if(d instanceof C){var e=b,f=c;d.type===Go?d.Yb=e:d.type===Ho&&(d.column=e);d.fu=f}b++;c++}}
w.defineProperty(C,{ZK:"itemTemplate"},function(){return null===this.sg?null:this.sg.ka("")},function(a){if(null===this.sg){if(null===a)return;this.sg=new ka("string",C)}var b=this.sg.ka("");b!==a&&(w.G(a,C,C,"itemTemplate"),(a instanceof S||a.Uf)&&w.k("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+a),this.sg.add("",a),this.h("itemTemplate",b,a),a=this.g,null!==a&&a.oa.fb||this.SA())});
w.defineProperty(C,{wI:"itemTemplateMap"},function(){return this.sg},function(a){var b=this.sg;if(b!==a){w.G(a,ka,C,"itemTemplateMap");for(var c=a.i;c.next();){var d=c.value;(d instanceof S||d.Uf)&&w.k("Template in Panel.itemTemplateMap must not be a Part or be Panel.isPanelMain: "+d)}this.sg=a;this.h("itemTemplateMap",b,a);a=this.g;null!==a&&a.oa.fb||this.SA()}});
w.defineProperty(C,{YK:"itemCategoryProperty"},function(){return this.To},function(a){var b=this.To;b!==a&&("string"!==typeof a&&"function"!==typeof a&&w.wd(a,"string or function",C,"itemCategoryProperty"),this.To=a,this.h("itemCategoryProperty",b,a))});
function $p(a,b){if(null===b)return"";var c=a.To,d="";if("function"===typeof c)d=c(b);else if("string"===typeof c&&"object"===typeof b){if(""===c)return"";d=w.rb(b,c)}else return"";if(void 0===d)return"";if("string"===typeof d)return d;w.k("Panel.getCategoryForItemData found a non-string category for "+b+": "+d);return""}var aq=!1,bq=null;
w.defineProperty(C,{En:"isAtomic"},function(){return 0!==(this.P&1048576)},function(a){var b=0!==(this.P&1048576);b!==a&&(w.j(a,"boolean",C,"isAtomic"),this.P^=1048576,this.h("isAtomic",b,a))});w.defineProperty(C,{Zt:"isClipping"},function(){return 0!==(this.P&2097152)},function(a){var b=0!==(this.P&2097152);b!==a&&(w.j(a,"boolean",C,"isClipping"),this.P^=2097152,this.I(),this.h("isClipping",b,a))});
w.defineProperty(C,{mF:"isOpposite"},function(){return 0!==(this.P&33554432)},function(a){var b=0!==(this.P&33554432);b!==a&&(w.j(a,"boolean",C,"isOpposite"),this.P^=33554432,this.I(),this.h("isOpposite",b,a))});w.defineProperty(C,{isEnabled:"isEnabled"},function(){return 0!==(this.P&4194304)},function(a){var b=0!==(this.P&4194304);if(b!==a){w.j(a,"boolean",C,"isEnabled");var c=null===this.O||this.O.au();this.P^=4194304;this.h("isEnabled",b,a);b=this.g;null!==b&&b.oa.fb||c&&Yp(this,this,a)}});
function Yp(a,b,c){var d=b.CE;null!==d&&d(b,c);if(b instanceof C){b=b.wa.n;for(var d=b.length,e=0;e<d;e++){var f=b[e];c&&f instanceof C&&!f.isEnabled||Yp(a,f,c)}}}w.defineProperty(C,{VJ:"alignmentFocusName"},function(){return this.Hj},function(a){var b=this.Hj;b!==a&&(this.Hj=a,this.I(),this.h("alignmentFocusName",b,a))});
function Pg(){w.lc(this);this.lh=null;this.Ov=!0;this.tc=0;this.gf=NaN;this.dk=0;this.ck=Infinity;this.ge=oc;this.hb=this.Sa=0;this.sc=null;this.$s=cq;this.Ag=lo;this.Vs=this.hk=null;this.Ws=NaN;this.Db=this.Xh=null;this.br=!1}w.fa("RowColumnDefinition",Pg);
Pg.prototype.copy=function(){var a=new Pg;a.Ov=this.Ov;a.tc=this.tc;a.gf=this.gf;a.dk=this.dk;a.ck=this.ck;a.ge=this.ge;a.Sa=this.Sa;a.hb=this.hb;a.Ag=this.Ag;a.$s=this.$s;a.hk=null===this.hk?null:this.hk.S();a.Vs=this.Vs;a.Ws=this.Ws;a.Xh=null;null!==this.Xh&&(a.Xh=w.Hl(this.Xh));a.Db=this.Db;a.br=this.br;a.sc=this.sc;return a};
Pg.prototype.Mp=function(a){w.G(a,Pg,Pg,"copyFrom:pd");a.ve?this.height=a.height:this.width=a.width;this.xj=a.xj;this.mf=a.mf;this.alignment=a.alignment;this.stretch=a.stretch;this.Iu=a.Iu;this.hk=null===a.hk?null:a.hk.S();this.sq=a.sq;this.tq=a.tq;this.Xh=null;a.Xh&&(this.Xh=w.Hl(a.Xh));this.background=a.background;this.Zz=a.Zz;this.sc=a.sc};Pg.prototype.fc=function(a){a.De===Pg?this.Iu=a:w.Ej(this,a)};
Pg.prototype.toString=function(){return"RowColumnDefinition "+(this.ve?"(Row ":"(Column ")+this.index+") #"+w.Jd(this)};var cq;Pg.Default=cq=w.p(Pg,"Default",0);var Lp;Pg.None=Lp=w.p(Pg,"None",1);var ep;Pg.ProportionalExtra=ep=w.p(Pg,"ProportionalExtra",2);Pg.prototype.em=function(a){this.lh=a};
Pg.prototype.computeEffectiveSpacingTop=Pg.prototype.oE=function(){var a=0;if(0!==this.index){var b=this.lh,c=this.sq;null===c&&null!==b&&(c=this.ve?b.Bi:b.Kh);null!==c&&(a=this.tq,isNaN(a)&&(a=null!==b?this.ve?b.Mh:b.Lh:0))}b=this.aG;if(null===b)if(b=this.lh,null!==b)b=b.Lj;else return a;return a+(this.ve?b.top:b.left)};
Pg.prototype.computeEffectiveSpacing=Pg.prototype.Xe=function(){var a=0;if(0!==this.index){var b=this.lh,c=this.sq;null===c&&null!==b&&(c=this.ve?b.Bi:b.Kh);null!==c&&(a=this.tq,isNaN(a)&&(a=null!==b?this.ve?b.Mh:b.Lh:0))}b=this.aG;if(null===b)if(b=this.lh,null!==b)b=b.Lj;else return a;return a+(this.ve?b.top+b.bottom:b.left+b.right)};
Pg.prototype.bd=function(a,b,c,d,e){var f=this.lh;if(null!==f&&(f.Wc(Mf,a,this,b,c,d,e),null!==this.sc&&(b=f.g,null!==b&&!b.Ne&&(f=f.Pl(),null!==f&&(b=f.data,null!==b)))))for(c=this.sc.i;c.next();)c.value.ky(this,b,a,f)};w.u(Pg,{O:"panel"},function(){return this.lh});w.defineProperty(Pg,{ve:"isRow"},function(){return this.Ov},function(a){this.Ov=a});w.defineProperty(Pg,{index:"index"},function(){return this.tc},function(a){this.tc=a});
w.defineProperty(Pg,{height:"height"},function(){return this.gf},function(a){var b=this.gf;b!==a&&(0>a&&w.Ea(a,">= 0",Pg,"height"),this.gf=a,this.Ja=this.Sa,null!==this.O&&this.O.I(),this.bd("height",b,a))});w.defineProperty(Pg,{width:"width"},function(){return this.gf},function(a){var b=this.gf;b!==a&&(0>a&&w.Ea(a,">= 0",Pg,"width"),this.gf=a,this.Ja=this.Sa,null!==this.O&&this.O.I(),this.bd("width",b,a))});
w.defineProperty(Pg,{xj:"minimum"},function(){return this.dk},function(a){var b=this.dk;b!==a&&((0>a||!isFinite(a))&&w.Ea(a,">= 0",Pg,"minimum"),this.dk=a,this.Ja=this.Sa,null!==this.O&&this.O.I(),this.bd("minimum",b,a))});w.defineProperty(Pg,{mf:"maximum"},function(){return this.ck},function(a){var b=this.ck;b!==a&&(0>a&&w.Ea(a,">= 0",Pg,"maximum"),this.ck=a,this.Ja=this.Sa,null!==this.O&&this.O.I(),this.bd("maximum",b,a))});
w.defineProperty(Pg,{alignment:"alignment"},function(){return this.ge},function(a){var b=this.ge;b.L(a)||(this.ge=a.S(),null!==this.O&&this.O.I(),this.bd("alignment",b,a))});w.defineProperty(Pg,{stretch:"stretch"},function(){return this.Ag},function(a){var b=this.Ag;b!==a&&(this.Ag=a,null!==this.O&&this.O.I(),this.bd("stretch",b,a))});
w.defineProperty(Pg,{aG:"separatorPadding"},function(){return this.hk},function(a){"number"===typeof a&&(a=new eb(a));var b=this.hk;null!==a&&null!==b&&b.L(a)||(null!==a&&(a=a.S()),this.hk=a,null!==this.O&&this.O.I(),this.bd("separatorPadding",b,a))});w.defineProperty(Pg,{sq:"separatorStroke"},function(){return this.Vs},function(a){var b=this.Vs;b!==a&&(null===a||"string"===typeof a||a instanceof ga)&&(a instanceof ga&&a.freeze(),this.Vs=a,null!==this.O&&this.O.I(),this.bd("separatorStroke",b,a))});
w.defineProperty(Pg,{tq:"separatorStrokeWidth"},function(){return this.Ws},function(a){var b=this.Ws;b!==a&&(this.Ws=a,null!==this.O&&this.O.I(),this.bd("separatorStrokeWidth",b,a))});
w.defineProperty(Pg,{CL:"separatorDashArray"},function(){return this.Xh},function(a){var b=this.Xh;if(b!==a){null===a||Array.isArray(a)||w.wd(a,"Array",Pg,"separatorDashArray:value");if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||w.k("separatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.Xh=a;null!==this.O&&this.O.na();this.bd("separatorDashArray",b,a)}});
w.defineProperty(Pg,{background:"background"},function(){return this.Db},function(a){var b=this.Db;b!==a&&(null===a||"string"===typeof a||a instanceof ga)&&(a instanceof ga&&a.freeze(),this.Db=a,null!==this.O&&this.O.na(),this.bd("background",b,a))});w.defineProperty(Pg,{Zz:"coversSeparators"},function(){return this.br},function(a){var b=this.br;b!==a&&(w.j(a,"boolean",Pg,"coversSeparators"),this.br=a,null!==this.O&&this.O.na(),this.bd("coversSeparators",b,a))});
w.defineProperty(Pg,{Iu:"sizing"},function(){return this.$s},function(a){var b=this.$s;b!==a&&(this.$s=a,null!==this.O&&this.O.I(),this.bd("sizing",b,a))});function Kp(a){if(a.Iu===cq){var b=a.lh;return a.ve?b.rJ:b.pH}return a.Iu}w.defineProperty(Pg,{Ja:"actual"},function(){return this.Sa},function(a){this.Sa=isNaN(this.gf)?Math.max(Math.min(this.ck,a),this.dk):Math.max(Math.min(this.ck,this.gf),this.dk)});
w.defineProperty(Pg,{total:"total"},function(){return this.Sa+this.Xe()},function(a){this.Sa=isNaN(this.gf)?Math.max(Math.min(this.ck,a),this.dk):Math.max(Math.min(this.ck,this.gf),this.dk);this.Sa=Math.max(0,this.Sa-this.Xe())});w.defineProperty(Pg,{position:"position"},function(){return this.hb},function(a){this.hb=a});
Pg.prototype.bind=Pg.prototype.bind=function(a){a.Bg=this;var b=this.O;if(null!==b){var c=b.Pl();null!==c&&Yo(c)&&w.k("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+a+" on "+b)}null===this.sc&&(this.sc=new I(Vg));this.sc.add(a)};
function X(){G.call(this);this.Lf=this.gb=null;this.Fo="None";this.yr=lo;this.pc=this.yd="black";this.fi=1;this.sp="butt";this.vp="miter";this.cn=10;this.tp=null;this.sf=0;this.ei=this.di=oc;this.xs=this.ws=NaN;this.Ir=!1;this.zs=null;this.Ho=this.zp="None";this.pg=1;this.og=0;this.ng=1}w.La(X,G);w.fa("Shape",X);
X.prototype.cloneProtected=function(a){G.prototype.cloneProtected.call(this,a);a.gb=this.gb;a.Fo=this.Fo;a.yr=this.yr;a.Lf=this.Lf;a.yd=this.yd;a.pc=this.pc;a.fi=this.fi;a.sp=this.sp;a.vp=this.vp;a.cn=this.cn;null!==this.tp&&(a.tp=w.Hl(this.tp));a.sf=this.sf;a.di=this.di.S();a.ei=this.ei.S();a.ws=this.ws;a.xs=this.xs;a.Ir=this.Ir;a.zs=this.zs;a.zp=this.zp;a.Ho=this.Ho;a.pg=this.pg;a.og=this.og;a.ng=this.ng};
X.prototype.fc=function(a){a===Ij||a===Kj||a===Lj||a===lo?this.kA=a:G.prototype.fc.call(this,a)};X.prototype.toString=function(){return"Shape("+("None"!==this.Cb?this.Cb:"None"!==this.zq?this.zq:this.iA)+")#"+w.Jd(this)};
function dq(a,b,c,d){var e=c.length;if(!(4>e)){for(var f=d.za,h=Math.max(1,f.width),f=f.height,k=c[0],l=c[1],m=0,n=0,p=0,q=0,r=0,s=0,u=q=0,t=w.lb(),x=2;x<e;x+=2)m=c[x],n=c[x+1],p=m-k,q=n-l,0===p&&(p=.001),r=q/p,s=Math.atan2(q,p),q=Math.sqrt(p*p+q*q),t.push([p,s,r,q]),u+=q,k=m,l=n;k=c[0];l=c[1];p=d.za.width;d instanceof X&&(p-=d.kb);1>p&&(p=1);for(var e=c=p,m=h/2,n=0===m?!1:!0,x=0,q=t[x],p=q[0],s=q[1],r=q[2],q=q[3],v=0;.1<=u;){0===v&&(n?(e=c,e-=m,u-=m,n=!1):e=c,0===e&&(e=1));if(e>u){w.va(t);return}e>
q?(v=e-q,e=q):v=0;var B=Math.sqrt(e*e/(1+r*r));0>p&&(B=-B);k+=B;l+=r*B;a.translate(k,l);a.rotate(s);a.translate(-(h/2),-(f/2));0===v&&d.xk(a,b);a.translate(h/2,f/2);a.rotate(-s);a.translate(-k,-l);u-=e;q-=e;if(0!==v){x++;if(x===t.length){w.va(t);return}q=t[x];p=q[0];s=q[1];r=q[2];q=q[3];e=v}}w.va(t)}}
X.prototype.xk=function(a,b){if(null!==this.pc||null!==this.yd){null!==this.yd&&Ko(this,a,this.yd,!0,!1);null!==this.pc&&Ko(this,a,this.pc,!1,!1);var c=this.fi;if(0===c){var d=this.U;d instanceof dh&&d.type===aj&&"Selection"===d.rd&&d.qb instanceof X&&d.Nf.Hd()===d.qb&&(c=d.qb.kb)}a.lineWidth=c;a.lineJoin=this.vp;a.lineCap=this.sp;a.miterLimit=this.cn;var e=!1;this.U&&b.oj("drawShadows")&&(e=this.U.Zl);var f=!0;null!==this.pc&&null===this.yd&&(f=!1);var d=!1,h=!0,k=this.jG;null!==k&&(d=!0,h=a.dA(k,
this.sf));var l=this.gb;if(null!==l){if(l.ma===Je)a.beginPath(),d&&!h?vo(a,l.wc,l.Gc,l.yb,l.Fb,k,this.sf):(a.moveTo(l.wc,l.Gc),a.lineTo(l.yb,l.Fb)),null!==this.yd&&a.Hg(this.yd),0!==c&&null!==this.pc&&a.Cj();else if(l.ma===Ke){var m=l.wc,n=l.Gc,p=l.yb,q=l.Fb,l=Math.min(m,p),r=Math.min(n,q),m=Math.abs(p-m),n=Math.abs(q-n);null!==this.yd&&(a.beginPath(),a.rect(l,r,m,n),a.Hg(this.yd));if(null!==this.pc){var s=p=0,u=0;f&&e&&(p=a.shadowOffsetX,s=a.shadowOffsetY,u=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=
0,a.shadowBlur=0);d&&!h?(h=w.lb(),h.push(l),h.push(r),h.push(l+m),h.push(r),h.push(l+m),h.push(r+n),h.push(l),h.push(r+n),h.push(l),h.push(r),a.beginPath(),eq(a,h,k,this.sf),a.Cj(),w.va(h)):0!==c&&(a.beginPath(),a.rect(l,r,m,n),a.Cj());f&&e&&(a.shadowOffsetX=p,a.shadowOffsetY=s,a.shadowBlur=u)}}else if(l.ma===Se)m=l.wc,n=l.Gc,p=l.yb,q=l.Fb,l=Math.abs(p-m)/2,r=Math.abs(q-n)/2,m=Math.min(m,p)+l,n=Math.min(n,q)+r,a.beginPath(),a.moveTo(m,n-r),a.bezierCurveTo(m+ad*l,n-r,m+l,n-ad*r,m+l,n),a.bezierCurveTo(m+
l,n+ad*r,m+ad*l,n+r,m,n+r),a.bezierCurveTo(m-ad*l,n+r,m-l,n+ad*r,m-l,n),a.bezierCurveTo(m-l,n-ad*r,m-ad*l,n-r,m,n-r),a.closePath(),null!==this.yd&&a.Hg(this.yd),d&&!h&&(h=w.lb(),$d(m,n-r,m+ad*l,n-r,m+l,n-ad*r,m+l,n,.5,h),$d(m+l,n,m+l,n+ad*r,m+ad*l,n+r,m,n+r,.5,h),$d(m,n+r,m-ad*l,n+r,m-l,n+ad*r,m-l,n,.5,h),$d(m-l,n,m-l,n-ad*r,m-ad*l,n-r,m,n-r,.5,h),a.beginPath(),eq(a,h,k,this.sf),w.va(h)),0!==c&&null!==this.pc&&(f&&e?(p=a.shadowOffsetX,s=a.shadowOffsetY,u=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=
0,a.shadowBlur=0,a.Cj(),a.shadowOffsetX=p,a.shadowOffsetY=s,a.shadowBlur=u):a.Cj());else if(l.ma===Ge){r=l.Nj;n=r.length;for(q=0;q<n;q++){m=r.n[q];a.beginPath();a.moveTo(m.ia,m.ga);for(var p=m.vb.n,s=p.length,t=null,u=0;u<s;u++){var x=p[u];switch(x.ma){case of:a.moveTo(x.D,x.F);break;case Ue:a.lineTo(x.D,x.F);break;case pf:a.bezierCurveTo(x.Ad,x.Ve,x.mh,x.yg,x.yb,x.Fb);break;case qf:a.quadraticCurveTo(x.Ad,x.Ve,x.yb,x.Fb);break;case rf:if(x.radiusX===x.radiusY)t=Math.PI/180,a.arc(x.Ad,x.Ve,x.radiusX,
x.ye*t,(x.ye+x.of)*t,0>x.of);else{var t=tf(x,m),v=t.length;if(0===v){a.lineTo(x.ja,x.ra);break}for(var B=0;B<v;B++){var y=t[B];0===B&&a.lineTo(y[0],y[1]);a.bezierCurveTo(y[2],y[3],y[4],y[5],y[6],y[7])}}break;case sf:B=v=0;if(null!==t&&t.type===rf){t=tf(t,m);y=t.length;if(0===y){a.lineTo(x.ja,x.ra);break}t=t[y-1]||null;null!==t&&(v=t[6],B=t[7])}else v=null!==t?t.D:m.ia,B=null!==t?t.F:m.ga;t=uf(x,m,v,B);v=t.length;if(0===v){a.lineTo(x.ja,x.ra);break}for(B=0;B<v;B++)y=t[B],a.bezierCurveTo(y[2],y[3],
y[4],y[5],y[6],y[7]);break;default:w.k("Segment not of valid type: "+x.ma)}x.Ph&&a.closePath();t=x}e?(u=s=p=0,m.Qo?(!0===m.Bm&&null!==this.yd?(a.Hg(this.yd),f=!0):f=!1,0!==c&&null!==this.pc&&(f&&(p=a.shadowOffsetX,s=a.shadowOffsetY,u=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0),d&&!h||a.Cj(),f&&(a.shadowOffsetX=p,a.shadowOffsetY=s,a.shadowBlur=u))):(f&&(p=a.shadowOffsetX,s=a.shadowOffsetY,u=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0),!0===m.Bm&&null!==this.yd&&
a.Hg(this.yd),0!==c&&null!==this.pc&&(d&&!h||a.Cj()),f&&(a.shadowOffsetX=p,a.shadowOffsetY=s,a.shadowBlur=u))):(!0===m.Bm&&null!==this.yd&&a.Hg(this.yd),0===c||null===this.pc||d&&!h||a.Cj())}if(d&&!h)for(c=f,f=l.Nj,h=f.length,l=0;l<h;l++){r=f.n[l];a.beginPath();n=w.lb();n.push(r.ia);n.push(r.ga);q=r.ia;m=r.ga;p=q;s=m;u=r.vb.n;x=u.length;for(t=0;t<x;t++){v=u[t];switch(v.ma){case of:eq(a,n,k,this.sf);n.length=0;n.push(v.D);n.push(v.F);q=v.D;m=v.F;p=q;s=m;break;case Ue:n.push(v.D);n.push(v.F);q=v.D;
m=v.F;break;case pf:$d(q,m,v.Ad,v.Ve,v.mh,v.yg,v.yb,v.Fb,.5,n);q=v.D;m=v.F;break;case qf:ke(q,m,v.Ad,v.Ve,v.yb,v.Fb,.5,n);q=v.D;m=v.F;break;case rf:B=tf(v,r);y=B.length;if(0===y){n.push(v.ja);n.push(v.ra);q=v.ja;m=v.ra;break}for(var H=0;H<y;H++){var E=B[H];$d(q,m,E[2],E[3],E[4],E[5],E[6],E[7],.5,n);q=E[6];m=E[7]}break;case sf:B=uf(v,r,q,m);y=B.length;if(0===y){n.push(v.ja);n.push(v.ra);q=v.ja;m=v.ra;break}for(H=0;H<y;H++)E=B[H],$d(q,m,E[2],E[3],E[4],E[5],E[6],E[7],.5,n),q=E[6],m=E[7];break;default:w.k("Segment not of valid type: "+
v.ma)}v.Ph&&(n.push(p),n.push(s),eq(a,n,k,this.sf))}eq(a,n,k,this.sf);w.va(n);null!==this.pc&&(q=n=r=0,c&&e&&(r=a.shadowOffsetX,n=a.shadowOffsetY,q=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0),a.Cj(),c&&e&&(a.shadowOffsetX=r,a.shadowOffsetY=n,a.shadowBlur=q))}}d&&a.aA();if(null!==this.Nx){d=this.Nx;rk(d,Infinity,Infinity);k=d.za;d.gc(0,0,k.width,k.height);c=this.vf;a.save();a.beginPath();k=w.lb();if(c.type===Je)k.push(c.ia),k.push(c.ga),k.push(c.D),k.push(c.F),dq(a,b,k,d);else if(c.type===
Ge)for(h=c.cc.i;h.next();){l=h.value;k.length=0;k.push(l.ia);k.push(l.ga);f=l.ia;r=l.ga;n=f;q=r;m=l.vb.n;p=m.length;for(s=0;s<p;s++){u=m[s];switch(u.ma){case of:dq(a,b,k,d);k.length=0;k.push(u.D);k.push(u.F);f=u.D;r=u.F;n=f;q=r;break;case Ue:k.push(u.D);k.push(u.F);f=u.D;r=u.F;break;case pf:$d(f,r,u.Ad,u.Ve,u.mh,u.yg,u.yb,u.Fb,.5,k);f=u.D;r=u.F;break;case qf:ke(f,r,u.Ad,u.Ve,u.yb,u.Fb,.5,k);f=u.D;r=u.F;break;case rf:c=tf(u,l);e=c.length;if(0===e){k.push(u.ja);k.push(u.ra);f=u.ja;r=u.ra;break}for(x=
0;x<e;x++)t=c[x],$d(f,r,t[2],t[3],t[4],t[5],t[6],t[7],.5,k),f=t[6],r=t[7];break;case sf:c=uf(u,l,f,r);e=c.length;if(0===e){k.push(u.ja);k.push(u.ra);f=u.ja;r=u.ra;break}for(x=0;x<e;x++)t=c[x],$d(f,r,t[2],t[3],t[4],t[5],t[6],t[7],.5,k),f=t[6],r=t[7];break;default:w.k("Segment not of valid type: "+u.ma)}u.Ph&&(k.push(n),k.push(q),dq(a,b,k,d))}dq(a,b,k,d)}else if(c.type===Ke)k.push(c.ia),k.push(c.ga),k.push(c.D),k.push(c.ga),k.push(c.D),k.push(c.F),k.push(c.ia),k.push(c.F),k.push(c.ia),k.push(c.ga),
dq(a,b,k,d);else if(c.type===Se){h=new He;h.ia=c.D;h.ga=(c.ga+c.F)/2;f=new yf(rf);f.ye=0;f.of=360;f.ja=(c.ia+c.D)/2;f.ra=(c.ga+c.F)/2;f.radiusX=Math.abs(c.ia-c.D)/2;f.radiusY=Math.abs(c.ga-c.F)/2;h.add(f);c=tf(f,h);e=c.length;if(0===e)k.push(f.ja),k.push(f.ra);else for(f=h.ia,r=h.ga,x=0;x<e;x++)t=c[x],$d(f,r,t[2],t[3],t[4],t[5],t[6],t[7],.5,k),f=t[6],r=t[7];dq(a,b,k,d)}w.va(k);a.restore();a.Ee(!1)}}}};
function eq(a,b,c,d){var e=b.length;if(!(4>e)){var f=.001,h=c.length,k=b[0],l=b[1];if(4===e)vo(a,k,l,b[2],b[3],c,d);else{a.moveTo(k,l);for(var m=f=0,n=0,p=0,q=0,r=p=0,s=w.lb(),u=2;u<e;u+=2)f=b[u],m=b[u+1],n=f-k,p=m-l,0===n&&(n=.001),q=p/n,p=Math.sqrt(n*n+p*p),s.push([n,q,p]),r+=p,k=f,l=m;k=b[0];l=b[1];b=0;for(var e=!0,f=c[b%h],m=0!==d,u=0,p=s[u],n=p[0],q=p[1],p=p[2],t=0;.1<=r;){0===t&&(f=c[b%h],b++,m&&(d%=f,f-=d,m=!1));f>r&&(f=r);f>p?(t=f-p,f=p):t=0;var x=Math.sqrt(f*f/(1+q*q));0>n&&(x=-x);k+=x;l+=
q*x;e?a.lineTo(k,l):a.moveTo(k,l);r-=f;p-=f;if(0!==t){u++;if(u===s.length){w.va(s);return}p=s[u];n=p[0];q=p[1];p=p[2];f=t}else e=!e}w.va(s)}}}X.prototype.getDocumentPoint=X.prototype.Wa=function(a,b){void 0===b&&(b=new z);if(a instanceof L){a.Nd()&&w.k("getDocumentPoint Spot must be a real, specific Spot, not: "+a.toString());var c=this.Ia,d=this.kb;b.l(a.x*(c.width+d)-d/2+c.x+a.offsetX,a.y*(c.height+d)-d/2+c.y+a.offsetY)}else b.set(a);this.ph.nb(b);return b};
X.prototype.uk=function(a,b){var c=this.vf;if(null===c||null===this.fill&&null===this.stroke)return!1;var d=c.jb,e=this.kb/2;c.type!==Je||b||(e+=2);var f=w.Df();f.assign(d);f.Sf(e+2,e+2);if(!f.Ha(a))return w.Gb(f),!1;d=e+1E-4;if(c.type===Je){if(null===this.stroke)return!1;d=(c.D-c.ia)*(a.x-c.ia)+(c.F-c.ga)*(a.y-c.ga);if(0>(c.ia-c.D)*(a.x-c.D)+(c.ga-c.F)*(a.y-c.F)||0>d)return!1;w.Gb(f);return Xd(c.ia,c.ga,c.D,c.F,e,a.x,a.y)}if(c.type===Ke){var h=c.ia,k=c.ga,l=c.D,m=c.F;f.x=Math.min(h,l);f.y=Math.min(k,
m);f.width=Math.abs(l-h);f.height=Math.abs(m-k);if(null===this.fill){f.Sf(-d,-d);if(f.Ha(a))return w.Gb(f),!1;f.Sf(d,d)}null!==this.stroke&&f.Sf(e,e);e=f.Ha(a);w.Gb(f);return e}if(c.type===Se){var h=c.ia,k=c.ga,l=c.D,m=c.F,c=Math.min(h,l),n=Math.min(k,m),h=Math.abs(l-h)/2,k=Math.abs(m-k)/2,c=a.x-(c+h),n=a.y-(n+k);if(null===this.fill){h-=d;k-=d;if(0>=h||0>=k||1>=c*c/(h*h)+n*n/(k*k))return w.Gb(f),!1;h+=d;k+=d}null!==this.stroke&&(h+=e,k+=e);w.Gb(f);return 0>=h||0>=k?!1:1>=c*c/(h*h)+n*n/(k*k)}if(c.type===
Ge)return w.Gb(f),null===this.fill?wf(c,a.x,a.y,e):c.Ha(a,e,1<this.kb,b);w.k("Unknown Geometry type: "+c.type);return!1};
X.prototype.Ln=function(a,b,c,d){var e=this.Aa,f=this.fi;a=Math.max(a,0);b=Math.max(b,0);var h;if(null!==this.Lf)h=this.vf.jb;else{var k=this.Cb,l=Td[k];if(void 0===l){var m=fq[k];"string"===typeof m&&(m=fq[m]);"function"===typeof m?(l=m(null,100,100),Td[k]=l):w.k("Unsupported Figure: "+k)}h=l.jb}var k=h.width,l=h.height,m=h.width,n=h.height;switch(Bo(this,!0)){case Ij:d=c=0;break;case Ie:m=Math.max(a-f,0);n=Math.max(b-f,0);break;case no:m=Math.max(a-f,0);d=0;break;case mo:c=0,n=Math.max(b-f,0)}isFinite(e.width)&&
(m=e.width);isFinite(e.height)&&(n=e.height);e=this.Af;h=this.zh;c=Math.max(c,h.width)-f;d=Math.max(d,h.height)-f;m=Math.min(e.width,m);n=Math.min(e.height,n);m=isFinite(m)?Math.max(c,m):Math.max(k,c);n=isFinite(n)?Math.max(d,n):Math.max(l,d);c=Jj(this);switch(c){case Ij:break;case Ie:k=m;l=n;break;case Kj:c=Math.min(m/k,n/l);isFinite(c)||(c=1);k*=c;l*=c;break;default:w.k(c+" is not a valid geometryStretch.")}null!==this.Lf?(k=Math.max(k,.01),l=Math.max(l,.01),h=null!==this.Lf?this.Lf:this.gb,e=k,
d=l,c=h.copy(),h=h.jb,e/=h.width,d/=h.height,isFinite(e)||(e=1),isFinite(d)||(d=1),1===e&&1===d||c.scale(e,d),this.gb=c):null!==this.gb&&Xa(this.gb.Po,a-f)&&Xa(this.gb.No,b-f)||(this.gb=X.makeGeometry(this,k,l));h=this.gb.jb;Infinity===a||Infinity===b?yo(this,h.x-f/2,h.y-f/2,0===a&&0===k?0:h.width+f,0===b&&0===l?0:h.height+f):yo(this,-(f/2),-(f/2),m+f,n+f)};
function Mp(a,b,c,d){if(!1!==ym(a)){a.od.Ra();var e=a.fi;0===e&&d instanceof dh&&d.type===aj&&d.qb instanceof X&&(e=d.qb.kb);e*=a.tb;d instanceof W&&null!==d.gb?(b=d.gb.jb,yo(a,b.x-e/2,b.y-e/2,b.width+e,b.height+e)):yo(a,-(e/2),-(e/2),b+e,c+e);a.od.freeze();a.od.H()||w.k("Non-real measuredBounds has been set. Object "+a+", measuredBounds: "+a.od.toString());Xl(a,!1)}}function Jj(a){var b=a.kA;return null!==a.Lf?b===lo?Ie:b:b===lo?Td[a.Cb].Zd:b}X.prototype.hj=function(a,b,c,d){Do(this,a,b,c,d)};
X.prototype.getNearestIntersectionPoint=X.prototype.PE=function(a,b,c){return this.zn(a.x,a.y,b.x,b.y,c)};
X.prototype.zn=function(a,b,c,d,e){var f=this.transform,h=1/(f.m11*f.m22-f.m12*f.m21),k=f.m22*h,l=-f.m12*h,m=-f.m21*h,n=f.m11*h,p=h*(f.m21*f.dy-f.m22*f.dx),q=h*(f.m12*f.dx-f.m11*f.dy),f=a*k+b*m+p,h=a*l+b*n+q,k=c*k+d*m+p,l=c*l+d*n+q,m=this.kb/2,p=this.gb;null===p&&(rk(this,Infinity,Infinity),p=this.gb);q=p.jb;n=!1;if(p.type===Je)if(1.5>=this.kb)n=ne(p.wc,p.Gc,p.yb,p.Fb,f,h,k,l,e);else{var r=0,s=0;p.wc===p.yb?(r=m,s=0):(b=(p.Fb-p.Gc)/(p.yb-p.wc),s=m/Math.sqrt(1+b*b),r=s*b);d=w.lb();b=new z;ne(p.wc+
r,p.Gc+s,p.yb+r,p.Fb+s,f,h,k,l,b)&&d.push(b);b=new z;ne(p.wc-r,p.Gc-s,p.yb-r,p.Fb-s,f,h,k,l,b)&&d.push(b);b=new z;ne(p.wc+r,p.Gc+s,p.wc-r,p.Gc-s,f,h,k,l,b)&&d.push(b);b=new z;ne(p.yb+r,p.Fb+s,p.yb-r,p.Fb-s,f,h,k,l,b)&&d.push(b);b=d.length;if(0===b)return w.va(d),!1;n=!0;s=Infinity;for(r=0;r<b;r++){var k=d[r],u=(k.x-f)*(k.x-f)+(k.y-h)*(k.y-h);u<s&&(s=u,e.x=k.x,e.y=k.y)}w.va(d)}else if(p.type===Ke)b=q.x-m,n=oe(b,q.y-m,q.x+q.width+m,q.y+q.height+m,f,h,k,l,e);else if(p.type===Se)a:if(b=q.copy().Sf(m,
m),0===b.width)n=ne(b.x,b.y,b.x,b.y+b.height,f,h,k,l,e);else if(0===b.height)n=ne(b.x,b.y,b.x+b.width,b.y,f,h,k,l,e);else{a=b.width/2;var t=b.height/2;d=b.x+a;b=b.y+t;c=9999;f!==k&&(c=(h-l)/(f-k));if(9999>Math.abs(c)){n=h-b-c*(f-d);if(0>a*a*c*c+t*t-n*n){e.x=NaN;e.y=NaN;n=!1;break a}m=Math.sqrt(a*a*c*c+t*t-n*n);k=(-(a*a*c*n)+a*t*m)/(t*t+a*a*c*c)+d;a=(-(a*a*c*n)-a*t*m)/(t*t+a*a*c*c)+d;l=c*(k-d)+n+b;b=c*(a-d)+n+b;d=Math.abs((f-k)*(f-k))+Math.abs((h-l)*(h-l));h=Math.abs((f-a)*(f-a))+Math.abs((h-b)*(h-
b));d<h?(e.x=k,e.y=l):(e.x=a,e.y=b)}else{k=t*t;l=f-d;k-=k/(a*a)*l*l;if(0>k){e.x=NaN;e.y=NaN;n=!1;break a}m=Math.sqrt(k);l=b+m;b-=m;d=Math.abs(l-h);h=Math.abs(b-h);d<h?(e.x=f,e.y=l):(e.x=f,e.y=b)}n=!0}else if(p.type===Ge){var x=0,v=0,B=u=0,q=w.K(),r=k-f,s=l-h,s=r*r+s*s;e.x=k;e.y=l;for(r=0;r<p.cc.count;r++)for(var y=p.cc.n[r],H=y.vb,x=y.ia,v=y.ga,E=x,V=v,ba=0;ba<H.count;ba++){var Q=H.n[ba],$=Q.type,u=Q.D,B=Q.F,ca=!1;switch($){case of:E=u;V=B;break;case Ue:ca=gq(x,v,u,B,f,h,k,l,q);break;case pf:var ca=
Q.rc,$=Q.Oc,R=Q.Ah,Ra=Q.Bh,ca=le(x,v,ca,$,R,Ra,u,B,f,h,k,l,.5,q);break;case qf:ca=(x+2*Q.rc)/3;$=(v+2*Q.Oc)/3;R=(2*Q.rc+u)/3;Ra=(2*Q.rc+u)/3;ca=le(x,v,ca,$,R,Ra,u,B,f,h,k,l,.5,q);break;case rf:case sf:$=Q.type===rf?tf(Q,y):uf(Q,y,x,v);R=$.length;if(0===R){ca=gq(x,v,Q.ja,Q.ra,f,h,k,l,q);break}for(B=0;B<R;B++)t=$[B],0===B&&gq(x,v,t[0],t[1],f,h,k,l,q)&&(u=hq(f,h,q,s,e),u<s&&(s=u,n=!0)),le(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],f,h,k,l,.5,q)&&(u=hq(f,h,q,s,e),u<s&&(s=u,n=!0));u=t[6];B=t[7];break;default:w.k("Unknown Segment type: "+
$)}x=u;v=B;ca&&(u=hq(f,h,q,s,e),u<s&&(s=u,n=!0));Q.tx&&(u=E,B=V,gq(x,v,u,B,f,h,k,l,q)&&(u=hq(f,h,q,s,e),u<s&&(s=u,n=!0)))}f=c-a;h=d-b;b=Math.sqrt(f*f+h*h);0!==b&&(f/=b,h/=b);e.x-=f*m;e.y-=h*m;w.v(q)}else w.k("Unknown Geometry type: "+p.type);if(!n)return!1;this.transform.nb(e);return!0};function hq(a,b,c,d,e){a=c.x-a;b=c.y-b;b=a*a+b*b;return b<d?(e.x=c.x,e.y=c.y,b):d}
function gq(a,b,c,d,e,f,h,k,l){var m=!1,n=(e-h)*(b-d)-(f-k)*(a-c);if(0===n)return!1;l.x=((e*k-f*h)*(a-c)-(e-h)*(a*d-b*c))/n;l.y=((e*k-f*h)*(b-d)-(f-k)*(a*d-b*c))/n;(a>c?a-c:c-a)<(b>d?b-d:d-b)?(e=b<d?b:d,a=b<d?d:b,(l.y>e||Xa(l.y,e))&&(l.y<a||Xa(l.y,a))&&(m=!0)):(e=a<c?a:c,a=a<c?c:a,(l.x>e||Xa(l.x,e))&&(l.x<a||Xa(l.x,a))&&(m=!0));return m}
X.prototype.containedInRect=X.prototype.on=function(a,b){if(void 0===b)return a.vk(this.Y);var c=this.gb;null===c&&(rk(this,Infinity,Infinity),c=this.gb);var c=c.jb,d=this.kb/2,e=!1,f=w.K();f.l(c.x-d,c.y-d);a.Ha(b.nb(f))&&(f.l(c.x-d,c.bottom+d),a.Ha(b.nb(f))&&(f.l(c.right+d,c.bottom+d),a.Ha(b.nb(f))&&(f.l(c.right+d,c.y-d),a.Ha(b.nb(f))&&(e=!0))));w.v(f);return e};
X.prototype.intersectsRect=X.prototype.Kg=function(a,b){if(this.on(a,b)||void 0===b&&(b=this.transform,a.vk(this.Y)))return!0;var c=w.Ef();c.set(b);c.qx();var d=a.left,e=a.right,f=a.top,h=a.bottom,k=w.K();k.l(d,f);c.nb(k);if(this.uk(k,!0))return w.v(k),!0;k.l(e,f);c.nb(k);if(this.uk(k,!0))return w.v(k),!0;k.l(d,h);c.nb(k);if(this.uk(k,!0))return w.v(k),!0;k.l(e,h);c.nb(k);if(this.uk(k,!0))return w.v(k),!0;var l=w.K(),m=w.K();c.set(b);c.yF(this.transform);c.qx();l.x=e;l.y=f;l.transform(c);k.x=d;k.y=
f;k.transform(c);var n=!1;iq(this,k,l,m)?n=!0:(k.x=e,k.y=h,k.transform(c),iq(this,k,l,m)?n=!0:(l.x=d,l.y=h,l.transform(c),iq(this,k,l,m)?n=!0:(k.x=d,k.y=f,k.transform(c),iq(this,k,l,m)&&(n=!0))));w.v(k);w.ue(c);w.v(l);w.v(m);return n};function iq(a,b,c,d){if(!a.PE(b,c,d))return!1;a=b.x;b=b.y;var e=c.x;c=c.y;var f=d.x;d=d.y;if(a===e){var h=0;a=0;b<c?(h=b,a=c):(h=c,a=b);return d>=h&&d<=a}a<e?(h=a,a=e):h=e;return f>=h&&f<=a}
X.prototype.JE=function(a,b,c){function d(a,b){for(var c=a.length,d=0;d<c;d+=2)if(b.Sp(a[d],a[d+1])>e)return!0;return!1}if(c&&null!==this.fill&&this.uk(a,!0))return!0;var e=a.uf(b);b=e;1.5<this.kb&&(e=this.kb/2+Math.sqrt(e),e*=e);var f=this.gb;if(null===f&&(rk(this,Infinity,Infinity),f=this.gb,null===f))return!1;if(!c){var h=f.jb,k=h.x,l=h.y,m=h.x+h.width,h=h.y+h.height;if(Na(a.x,a.y,k,l)<=e&&Na(a.x,a.y,m,l)<=e&&Na(a.x,a.y,k,h)<=e&&Na(a.x,a.y,m,h)<=e)return!0}k=f.wc;l=f.Gc;m=f.yb;h=f.Fb;if(f.type===
Je){if(c=Ma(a.x,a.y,k,l,m,h),f=(k-m)*(a.x-m)+(l-h)*(a.y-h),c<=(0<=(m-k)*(a.x-k)+(h-l)*(a.y-l)&&0<=f?e:b))return!0}else{if(f.type===Ke)return b=!1,c&&(b=Ma(a.x,a.y,k,l,k,h)<=e||Ma(a.x,a.y,k,l,m,l)<=e||Ma(a.x,a.y,m,l,m,h)<=e||Ma(a.x,a.y,k,h,m,h)<=e),b;if(f.type===Se){b=a.x-(k+m)/2;var f=a.y-(l+h)/2,n=Math.abs(m-k)/2,p=Math.abs(h-l)/2;if(0===n||0===p)return c=Ma(a.x,a.y,k,l,m,h),c<=e?!0:!1;if(c){if(a=Ee(n,p,b,f),a*a<=e)return!0}else return Na(b,f,-n,0)>=e||Na(b,f,0,-p)>=e||Na(b,f,0,p)>=e||Na(b,f,n,0)>=
e?!1:!0}else if(f.type===Ge){h=f.jb;k=h.x;l=h.y;m=h.x+h.width;h=h.y+h.height;if(a.x>m&&a.x<k&&a.y>h&&a.y<l&&Ma(a.x,a.y,k,l,k,h)>e&&Ma(a.x,a.y,k,l,m,l)>e&&Ma(a.x,a.y,m,h,k,h)>e&&Ma(a.x,a.y,m,h,m,l)>e)return!1;b=Math.sqrt(e);if(c){if(null===this.fill?wf(f,a.x,a.y,b):f.Ha(a,b,!0))return!0}else{c=f.cc;for(b=0;b<c.count;b++){k=c.n[b];n=k.ia;p=k.ga;if(a.Sp(n,p)>e)return!1;l=k.vb.n;m=l.length;for(h=0;h<m;h++){var q=l[h];switch(q.type){case of:case Ue:n=q.D;p=q.F;if(a.Sp(n,p)>e)return!1;break;case pf:f=w.lb();
$d(n,p,q.rc,q.Oc,q.Ah,q.Bh,q.D,q.F,.8,f);n=d(f,a);w.va(f);if(n)return!1;n=q.D;p=q.F;if(a.Sp(n,p)>e)return!1;break;case qf:f=w.lb();ke(n,p,q.rc,q.Oc,q.D,q.F,.8,f);n=d(f,a);w.va(f);if(n)return!1;n=q.D;p=q.F;if(a.Sp(n,p)>e)return!1;break;case rf:case sf:var r=q.type===rf?tf(q,k):uf(q,k,n,p),s=r.length;if(0===s){n=q.ja;p=q.ra;if(a.Sp(n,p)>e)return!1;break}q=null;f=w.lb();for(b=0;b<s;b++)if(q=r[b],f.length=0,$d(q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7],.8,f),d(f,a))return w.va(f),!1;w.va(f);null!==q&&(n=
q[6],p=q[7]);break;default:w.k("Unknown Segment type: "+q.type)}}}return!0}}}return!1};w.defineProperty(X,{vf:"geometry"},function(){return null!==this.gb?this.gb:this.Lf},function(a){var b=this.gb;if(b!==a){this.Lf=null!==a?this.gb=a.freeze():this.gb=null;var c=this.U;null!==c&&(c.bk=NaN);this.I();this.h("geometry",b,a);wo(this)&&(a=this.U,null!==a&&xo(this,a,"geometryString"))}});
w.defineProperty(X,{SH:"geometryString"},function(){return null===this.vf?"":this.vf.toString()},function(a){a=We(a);var b=a.normalize();this.vf=a;this.position=a=w.xb(-b.x,-b.y);w.v(a)});w.defineProperty(X,{fF:"isGeometryPositioned"},function(){return this.Ir},function(a){var b=this.Ir;b!==a&&(this.Ir=a,this.I(),this.h("isGeometryPositioned",b,a))});X.prototype.Ke=function(){this.gb=null};
w.defineProperty(X,{fill:"fill"},function(){return this.yd},function(a){var b=this.yd;b!==a&&(a instanceof ga&&a.freeze(),this.yd=a,this.na(),this.h("fill",b,a))});w.defineProperty(X,{stroke:"stroke"},function(){return this.pc},function(a){var b=this.pc;b!==a&&(a instanceof ga&&a.freeze(),this.pc=a,this.na(),this.h("stroke",b,a))});
w.defineProperty(X,{kb:"strokeWidth"},function(){return this.fi},function(a){var b=this.fi;if(b!==a)if(0<=a){this.fi=a;this.I();var c=this.U;null!==c&&(c.bk=NaN);this.h("strokeWidth",b,a)}else w.Ea(a,"value >= 0",X,"strokeWidth:value")});w.defineProperty(X,{HL:"strokeCap"},function(){return this.sp},function(a){var b=this.sp;b!==a&&("string"!==typeof a||"butt"!==a&&"round"!==a&&"square"!==a?w.Ea(a,'"butt", "round", or "square"',X,"strokeCap"):(this.sp=a,this.na(),this.h("strokeCap",b,a)))});
w.defineProperty(X,{JL:"strokeJoin"},function(){return this.vp},function(a){var b=this.vp;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?w.Ea(a,'"miter", "bevel", or "round"',X,"strokeJoin"):(this.vp=a,this.na(),this.h("strokeJoin",b,a)))});w.defineProperty(X,{KL:"strokeMiterLimit"},function(){return this.cn},function(a){var b=this.cn;if(b!==a)if(1<=a){this.cn=a;this.na();var c=this.U;null!==c&&(c.bk=NaN);this.h("strokeMiterLimit",b,a)}else w.Ea(a,"value >= 1",X,"strokeWidth:value")});
w.defineProperty(X,{jG:"strokeDashArray"},function(){return this.tp},function(a){var b=this.tp;if(b!==a){null===a||Array.isArray(a)||w.wd(a,"Array",X,"strokeDashArray:value");if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||w.k("strokeDashArray:value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.tp=a;this.na();this.h("strokeDashArray",b,a)}});
w.defineProperty(X,{IL:"strokeDashOffset"},function(){return this.sf},function(a){var b=this.sf;b!==a&&0<=a&&(this.sf=a,this.na(),this.h("strokeDashOffset",b,a))});w.defineProperty(X,{Cb:"figure"},function(){return this.Fo},function(a){var b=this.Fo;if(b!==a){var c=fq[a];"function"===typeof c?c=a:(c=fq[a.toLowerCase()])||w.k("Unknown Shape.figure: "+a);b!==c&&(a=this.U,null!==a&&(a.bk=NaN),this.Fo=c,this.Lf=null,this.Ke(),this.I(),this.h("figure",b,c))}});
w.defineProperty(X,{zq:"toArrow"},function(){return this.zp},function(a){var b=this.zp;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=jq(a);null===c?w.k("Unknown Shape.toArrow: "+a):b!==c&&(this.zp=c,this.Lf=null,this.Ke(),this.I(),kq(this),this.h("toArrow",b,c))}});
w.defineProperty(X,{iA:"fromArrow"},function(){return this.Ho},function(a){var b=this.Ho;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=jq(a);null===c?w.k("Unknown Shape.fromArrow: "+a):b!==c&&(this.Ho=c,this.Lf=null,this.Ke(),this.I(),kq(this),this.h("fromArrow",b,c))}});function kq(a){var b=a.g;null!==b&&b.oa.fb||(a.rq=lq,"None"!==a.zp?(a.Me=-1,a.oh=Fc):"None"!==a.Ho&&(a.Me=0,a.oh=new L(1-Fc.x,Fc.y)))}
w.defineProperty(X,{A:"spot1"},function(){return this.di},function(a){w.G(a,L,X,"spot1");var b=this.di;b.L(a)||(this.di=a=a.S(),this.I(),this.h("spot1",b,a))});w.defineProperty(X,{B:"spot2"},function(){return this.ei},function(a){w.G(a,L,X,"spot2");var b=this.ei;b.L(a)||(this.ei=a=a.S(),this.I(),this.h("spot2",b,a))});w.defineProperty(X,{Cc:"parameter1"},function(){return this.ws},function(a){var b=this.ws;b!==a&&(this.ws=a,this.Ke(),this.I(),this.h("parameter1",b,a))});
w.defineProperty(X,{vu:"parameter2"},function(){return this.xs},function(a){var b=this.xs;b!==a&&(this.xs=a,this.Ke(),this.I(),this.h("parameter2",b,a))});w.u(X,{Ia:"naturalBounds"},function(){if(null!==this.gb)return this.Sc.assign(this.gb.jb),this.Sc;var a=this.Aa;return new A(0,0,a.width,a.height)});w.defineProperty(X,{Nx:"pathPattern"},function(){return this.zs},function(a){var b=this.zs;b!==a&&(this.zs=a,this.na(),this.h("pathPattern",b,a))});
w.defineProperty(X,{xL:"pathObject"},function(){return this.Nx},function(a){this.Nx=a});w.defineProperty(X,{kA:"geometryStretch"},function(){return this.yr},function(a){var b=this.yr;b!==a&&(w.mb(a,G,X,"geometryStretch"),this.yr=a,this.h("geometryStretch",b,a))});
w.defineProperty(X,{interval:"interval"},function(){return this.pg},function(a){var b=this.pg;a=Math.floor(a);if(b!==a&&0<=a){this.pg=a;var c=this.g;null!==c&&this.O===c.Bn&&Yl(c);this.I();c=this.O;null!==c&&c.type===fp&&(c.Sj=null);this.h("interval",b,a)}});w.defineProperty(X,{TE:"graduatedStart"},function(){return this.og},function(a){var b=this.og;b!==a&&(0>a?a=0:1<a&&(a=1),this.og=a,this.I(),this.h("graduatedStart",b,a))});
w.defineProperty(X,{RE:"graduatedEnd"},function(){return this.ng},function(a){var b=this.ng;b!==a&&(0>a?a=0:1<a&&(a=1),this.ng=a,this.I(),this.h("graduatedEnd",b,a))});X.makeGeometry=function(a,b,c){var d=null;if("None"!==a.zq)d=Ud[a.zq];else if("None"!==a.iA)d=Ud[a.iA];else{var e=fq[a.Cb];"string"===typeof e&&(e=fq[e]);void 0===e&&w.k("Unknown Shape.figure: "+a.Cb);d=e(a,b,c);d.Po=b;d.No=c}null===d&&(e=fq.Rectangle,"function"===typeof e&&(d=e(a,b,c)));return d};
X.getFigureGenerators=function(){var a=new ka("string","function"),b;for(b in fq)if(b!==b.toLowerCase()){var c=fq[b];"function"===typeof c&&a.add(b,c)}a.freeze();return a};
X.defineFigureGenerator=function(a,b){w.j(a,"string",X,"defineFigureGenerator:name");"string"===typeof b?""!==b&&fq[b]||w.k("Shape.defineFigureGenerator synonym must not be empty or None or not a defined figure name: "+b):w.j(b,"function",X,"defineFigureGenerator:func");var c=a.toLowerCase();""!==a&&"none"!==c&&a!==c||w.k("Shape.defineFigureGenerator name must not be empty or None or all-lower-case: "+a);fq[a]=b;fq[c]=a};
X.getArrowheadGeometries=function(){var a=new ka("string",Fe),b;for(b in mq)if(void 0===Ud[b]){var c=We(mq[b],!1);Ud[b]=c;c=b.toLowerCase();c!==b&&(Ud[c]=b)}for(b in Ud)b!==b.toLowerCase()&&(c=Ud[b],c instanceof Fe&&a.add(b,c));a.freeze();return a};
X.defineArrowheadGeometry=function(a,b){w.j(a,"string",X,"defineArrowheadGeometry:name");var c=null;"string"===typeof b?(w.j(b,"string",X,"defineArrowheadGeometry:pathstr"),c=We(b,!1)):(w.G(b,Fe,X,"defineArrowheadGeometry:pathstr"),c=b);var d=a.toLowerCase();""!==a&&"none"!==d&&a!==d||w.k("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+a);Ud[a]=c;Ud[d]=a};
function Ch(){G.call(this);this.Dd="";this.pc="black";this.lg="13px sans-serif";this.ul="start";this.kg=Ij;this.yl=uc;this.Dm=!0;this.Xj=this.Yj=!1;this.Xi=nq;this.qk=oq;this.Wv=this.je=0;this.wm=this.jz=this.kz=null;this.Oi=new Sp;this.rr=!1;this.Te=this.Sq=this.jt=this.vl=this.kt=null;this.ci=this.bi=0;this.fh=Infinity;this.Wo=0;this.pg=1;this.og=0;this.ng=1;this.ym=null}w.La(Ch,G);w.fa("TextBlock",Ch);var pq=/[ \u200b\u00ad]/;
Ch.prototype.cloneProtected=function(a){G.prototype.cloneProtected.call(this,a);a.Dd=this.Dd;a.pc=this.pc;a.lg=this.lg;a.ul=this.ul;a.kg=this.kg;a.yl=this.yl;a.Dm=this.Dm;a.Yj=this.Yj;a.Xj=this.Xj;a.Xi=this.Xi;a.qk=this.qk;a.je=this.je;a.Wv=this.Wv;a.kz=this.kz;a.jz=this.jz;a.wm=this.wm;a.Oi.Mp(this.Oi);a.rr=this.rr;a.kt=this.kt;a.vl=this.vl;a.jt=this.jt;a.Sq=this.Sq;a.Te=this.Te;a.bi=this.bi;a.ci=this.ci;a.fh=this.fh;a.Wo=this.Wo;a.pg=this.pg;a.og=this.og;a.ng=this.ng;a.ym=this.ym};
Ch.prototype.fc=function(a){a.De===Ch?this.xG=a:G.prototype.fc.call(this,a)};Ch.prototype.toString=function(){return 22<this.Dd.length?'TextBlock("'+this.Dd.substring(0,20)+'"...)':'TextBlock("'+this.Dd+'")'};var qq=new sa,rq=0,sq=new sa,tq=0,uq="...",vq="",wq=(new Tc(null)).wk;Ch.getEllipsis=function(){return uq};Ch.setEllipsis=function(a){uq=a;sq=new sa;tq=0};var xq;Ch.None=xq=w.p(Ch,"None",0);var yq;Ch.WrapFit=yq=w.p(Ch,"WrapFit",1);var oq;Ch.WrapDesiredSize=oq=w.p(Ch,"WrapDesiredSize",2);var nq;
Ch.OverflowClip=nq=w.p(Ch,"OverflowClip",0);var zq;Ch.OverflowEllipsis=zq=w.p(Ch,"OverflowEllipsis",1);Ch.prototype.I=function(){G.prototype.I.call(this);this.jz=this.kz=null};w.defineProperty(Ch,{font:"font"},function(){return this.lg},function(a){var b=this.lg;b!==a&&(this.lg=a,this.wm=null,this.I(),this.h("font",b,a))});
Ch.isValidFont=function(a){var b=wq.font;if(a===b||"10px sans-serif"===a)return!0;wq.font="10px sans-serif";var c;wq.font=a;var d=wq.font;if("10px sans-serif"!==d)return wq.font=b,!0;wq.font="19px serif";c=wq.font;wq.font=a;d=wq.font;wq.font=b;return d!==c};w.defineProperty(Ch,{text:"text"},function(){return this.Dd},function(a){var b=this.Dd;a=null!==a&&void 0!==a?a.toString():"";b!==a&&(this.Dd=a,this.I(),this.h("text",b,a))});
w.defineProperty(Ch,{textAlign:"textAlign"},function(){return this.ul},function(a){var b=this.ul;b!==a&&("start"===a||"end"===a||"left"===a||"right"===a||"center"===a?(this.ul=a,this.na(),this.h("textAlign",b,a)):w.Ea(a,'"start", "end", "left", "right", or "center"',Ch,"textAlign"))});w.defineProperty(Ch,{Pt:"flip"},function(){return this.kg},function(a){var b=this.kg;b!==a&&(w.mb(a,G,Ch,"flip"),this.kg=a,this.na(),this.h("flip",b,a))});
w.defineProperty(Ch,{QL:"verticalAlignment"},function(){return this.yl},function(a){var b=this.yl;b.L(a)||(a.Nd()&&w.k("TextBlock.verticalAlignment for "+this+" must be a real Spot, not:"+a),this.yl=a=a.S(),Oo(this),this.h("verticalAlignment",b,a))});w.u(Ch,{Ia:"naturalBounds"},function(){if(!this.Sc.H()){var a=Aq(this,this.Dd,this.Oi,999999).width,b=Bq(this,a,this.Oi),c=this.Aa;isNaN(c.width)||(a=c.width);isNaN(c.height)||(b=c.height);Pa(this.Sc,a,b)}return this.Sc});
w.defineProperty(Ch,{yx:"isMultiline"},function(){return this.Dm},function(a){var b=this.Dm;b!==a&&(this.Dm=a,this.I(),this.h("isMultiline",b,a))});w.defineProperty(Ch,{XK:"isUnderline"},function(){return this.Yj},function(a){var b=this.Yj;b!==a&&(this.Yj=a,this.na(),this.h("isUnderline",b,a))});w.defineProperty(Ch,{WK:"isStrikethrough"},function(){return this.Xj},function(a){var b=this.Xj;b!==a&&(this.Xj=a,this.na(),this.h("isStrikethrough",b,a))});
w.defineProperty(Ch,{xG:"wrap"},function(){return this.qk},function(a){var b=this.qk;b!==a&&(this.qk=a,this.I(),this.h("wrap",b,a))});w.defineProperty(Ch,{overflow:"overflow"},function(){return this.Xi},function(a){var b=this.Xi;b!==a&&(this.Xi=a,this.I(),this.h("overflow",b,a))});w.defineProperty(Ch,{stroke:"stroke"},function(){return this.pc},function(a){var b=this.pc;b!==a&&(a instanceof ga&&a.freeze(),this.pc=a,this.na(),this.h("stroke",b,a))});w.u(Ch,{BI:"lineCount"},function(){return this.je});
w.defineProperty(Ch,{cA:"editable"},function(){return this.rr},function(a){var b=this.rr;b!==a&&(this.rr=a,this.h("editable",b,a))});w.defineProperty(Ch,{lG:"textEditor"},function(){return this.kt},function(a){var b=this.kt;b!==a&&(this.kt=a,this.h("textEditor",b,a))});w.defineProperty(Ch,{eA:"errorFunction"},function(){return this.Te},function(a){var b=this.Te;b!==a&&(null!==a&&w.j(a,"function",Ch,"errorFunction"),this.Te=a,this.h("errorFunction",b,a))});
w.defineProperty(Ch,{interval:"interval"},function(){return this.pg},function(a){var b=this.pg;a=Math.floor(a);if(b!==a&&0<=a){this.pg=a;this.I();var c=this.O;null!==c&&c.type===fp&&(c.Sj=null);this.h("interval",b,a)}});w.defineProperty(Ch,{TE:"graduatedStart"},function(){return this.og},function(a){var b=this.og;b!==a&&(0>a?a=0:1<a&&(a=1),this.og=a,this.I(),this.h("graduatedStart",b,a))});
w.defineProperty(Ch,{RE:"graduatedEnd"},function(){return this.ng},function(a){var b=this.ng;b!==a&&(0>a?a=0:1<a&&(a=1),this.ng=a,this.I(),this.h("graduatedEnd",b,a))});w.defineProperty(Ch,{SE:"graduatedFunction"},function(){return this.ym},function(a){var b=this.ym;b!==a&&(null!==a&&w.j(a,"function",Ch,"graduatedFunction"),this.ym=a,this.I(),this.h("graduatedFunction",b,a))});
Ch.prototype.xk=function(a,b){if(null!==this.pc&&0!==this.Dd.length&&null!==this.lg){var c=this.Ia.width,d=this.Ia.height,e=Cq(this),f=a.textAlign=this.ul,h=b.Lr;"start"===f&&(f=h?"right":"left");"end"===f&&(f=h?"left":"right");Ko(this,a,this.pc,!0,!1);(this.Yj||this.Xj)&&Ko(this,a,this.pc,!1,!1);var k=0,h=!1,l=w.xb(0,0);this.ph.nb(l);var m=w.xb(0,e);this.ph.nb(m);var n=l.uf(m);w.v(l);w.v(m);l=b.scale;8>n*l*l&&(h=!0);b.qf!==a&&(h=!1);!1===b.oj("textGreeking")&&(h=!1);n=this.bi;l=this.ci;switch(this.Pt){case po:a.translate(c,
0);a.scale(-1,1);break;case oo:a.translate(0,d);a.scale(1,-1);break;case qo:a.translate(c,d),a.scale(-1,-1)}var m=this.je,p=(n+e+l)*m;d>p&&(k=this.yl,k=k.y*d-k.y*p+k.offsetY);for(var p=this.Oi,q=0;q<m;q++){var r=p.pf[q],s=p.Qe[q];r>c&&(r=c);var k=k+n,u=s,s=a,t=k,x=c,v=e,B=f,y=0;h?("left"===B?y=0:"right"===B?y=x-r:"center"===B&&(y=(x-r)/2),s.fillRect(0+y,t+.25*v,r,1)):("left"===B?y=0:"right"===B?y=x:"center"===B&&(y=x/2),s.fillText(u,0+y,t+v-.25*v),u=v/20|0,0===u&&(u=1),"right"===B?y-=r:"center"===
B&&(y-=r/2),this.Yj&&(s.beginPath(),s.lineWidth=u,s.moveTo(0+y,t+v-.2*v),s.lineTo(0+y+r,t+v-.2*v),s.stroke()),this.Xj&&(s.beginPath(),s.lineWidth=u,t=t+v-v/2.2|0,0!==u%2&&(t+=.5),s.moveTo(0+y,t),s.lineTo(0+y+r,t),s.stroke()));k+=e+l}switch(this.Pt){case po:a.scale(-1,1);a.translate(-c,0);break;case oo:a.scale(1,-1);a.translate(0,-d);break;case qo:a.scale(-1,-1),a.translate(-c,-d)}}};
Ch.prototype.computeAngle=function(a,b){var c=0;switch(a){default:case dj:c=0;break;case lq:c=b;break;case Np:c=b+90;break;case Pp:c=b-90;break;case Dq:c=b+180;break;case Eq:c=Be(b);90<c&&270>c&&(c-=180);break;case Op:c=Be(b+90);90<c&&270>c&&(c-=180);break;case Qp:c=Be(b-90);90<c&&270>c&&(c-=180);break;case Rp:c=Be(b);if(45<c&&135>c||225<c&&315>c)return 0;90<c&&270>c&&(c-=180)}return Be(c)};
Ch.prototype.Ln=function(a,b,c,d){this.Wo=a;var e=this.Oi;e.reset();var f=0,h=0;if(isNaN(this.Aa.width)){f=this.Dd.replace(/\r\n/g,"\n").replace(/\r/g,"\n");if(0===f.length)f=0;else if(this.yx){for(var k=h=0,l=!1;!l;){var m=f.indexOf("\n",k);-1===m&&(m=f.length,l=!0);k=Fq(f.substr(k,m-k).replace(/^\s+|\s+$/g,""),this.lg);k>h&&(h=k);k=m+1}f=h}else h=f.indexOf("\n",0),0<=h&&(f=f.substr(0,h)),f=k=Fq(f,this.lg);f=Math.min(f,a/this.scale);f=Math.max(8,f)}else f=this.Aa.width;null!==this.O&&(f=Math.min(f,
this.O.Af.width),f=Math.max(f,this.O.zh.width));h=Bq(this,f,e);m=h=isNaN(this.Aa.height)?Math.min(h,b/this.scale):this.Aa.height;if(0!==e.ef&&1!==e.Qe.length&&this.Xi===zq&&(b=this.lg,l=this.Xi===zq?Gq(b):0,k=this.bi+this.ci,k=Math.max(0,Cq(this)+k),m=Math.min(this.JI-1,Math.max(Math.floor(m/k+.01)-1,0)),!(m+1>=e.Qe.length))){k=e.Qe[m];for(a=Math.max(1,a-l);Fq(k,b)>a&&1<k.length;)k=k.substr(0,k.length-1);k+=uq;a=Fq(k,b);e.Qe[m]=k;e.Qe=e.Qe.slice(0,m+1);e.pf[m]=a;e.pf=e.pf.slice(0,m+1);e.gj=e.Qe.length;
e.ef=Math.max(e.ef,a);this.je=e.gj}if(this.xG===yq||isNaN(this.Aa.width))f=e.ef,isNaN(this.Aa.width)&&(f=Math.max(8,f));f=Math.max(c,f);h=Math.max(d,h);Pa(this.Sc,f,h);yo(this,0,0,f,h)};Ch.prototype.hj=function(a,b,c,d){Do(this,a,b,c,d)};
function Aq(a,b,c,d){b=b.replace(/^\s+|\s+$/g,"");var e=0,f=0,h=0,k=a.lg,f=a.bi+a.ci,l=Math.max(0,Cq(a)+f),h=a.Xi===zq?Gq(k):0;if(a.je>=a.fh)return new ha(0,l);if(a.qk===xq){c.gj=1;f=Fq(b,k);if(0===h||f<=d)return c.ef=f,c.pf.push(c.ef),c.Qe.push(b),new ha(f,l);var m=Hq(b);b=b.substr(m.length);for(var n=Hq(b),f=Fq(m+n,k);0<n.length&&f<=d;)m+=n,b=b.substr(n.length),n=Hq(b),f=Fq((m+n).replace(/^\s+|\s+$/g,""),k);m+=n.replace(/^\s+|\s+$/g,"");for(d=Math.max(1,d-h);Fq(m,k)>d&&1<m.length;)m=m.substr(0,
m.length-1);m+=uq;h=Fq(m,k);c.pf.push(h);c.ef=h;c.Qe.push(m);return new ha(h,l)}var p=0;0===b.length&&(p=1,c.pf.push(0),c.Qe.push(b));for(;0<b.length;){m=Hq(b);for(b=b.substr(m.length);Fq(m,k)>d;){n=1;f=Fq(m.substr(0,n),k);for(h=0;f<=d;)n++,h=f,f=Fq(m.substr(0,n),k);1===n?(c.pf[a.je+p]=f,e=Math.max(e,f)):(c.pf[a.je+p]=h,e=Math.max(e,h));n--;1>n&&(n=1);c.Qe[a.je+p]=m.substr(0,n);p++;m=m.substr(n);if(a.je+p>a.fh)break}n=Hq(b);for(f=Fq(m+n,k);0<n.length&&f<=d;)m+=n,b=b.substr(n.length),n=Hq(b),f=Fq((m+
n).replace(/^\s+|\s+$/g,""),k);m=m.replace(/^\s+|\s+$/g,"");if(""!==m&&("\u00ad"===m[m.length-1]&&(m=m.substring(0,m.length-1)+"\u2010"),0===n.length?(c.pf.push(f),e=Math.max(e,f)):(h=Fq(m,k),c.pf.push(h),e=Math.max(e,h)),c.Qe.push(m),p++,a.je+p>a.fh))break}c.gj=Math.min(a.fh,p);c.ef=Math.max(c.ef,e);return new ha(c.ef,l*c.gj)}function Hq(a){for(var b=a.length,c=0;c<b&&!pq.test(a.charAt(c));)c++;for(;c<b&&pq.test(a.charAt(c));)c++;return c>=b?a:a.substr(0,c)}
function Fq(a,b){vq!==b&&(vq=wq.font=b);return wq.measureText(a).width}function Cq(a){if(null!==a.wm)return a.wm;var b=a.lg;vq!==b&&(vq=wq.font=b);var c=0;void 0!==qq[b]&&5E3>rq?c=qq[b]:(c=1.3*wq.measureText("M").width,qq[b]=c,rq++);return a.wm=c}function Gq(a){vq!==a&&(vq=wq.font=a);var b=0;void 0!==sq[a]&&5E3>tq?b=sq[a]:(b=wq.measureText(uq).width,sq[a]=b,tq++);return b}
function Bq(a,b,c){var d=a.Dd.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),e=a.bi+a.ci,e=Math.max(0,Cq(a)+e);if(0===d.length)return c.ef=0,a.je=1,e;if(!a.yx){var f=d.indexOf("\n",0);0<=f&&(d=d.substr(0,f))}for(var f=0,h=a.je=0,k=-1,l=!1;!l;)k=d.indexOf("\n",h),-1===k&&(k=d.length,l=!0),h<=k&&(h=d.substr(h,k-h),a.qk!==xq?(c.gj=0,h=Aq(a,h,c,b),f+=h.height,a.je+=c.gj):(Aq(a,h,c,b),f+=e,a.je++),a.je===a.fh&&(l=!0)),h=k+1;return a.Wv=f}
w.defineProperty(Ch,{lB:"textValidation"},function(){return this.vl},function(a){var b=this.vl;b!==a&&(null!==a&&w.j(a,"function",Ch,"textValidation"),this.vl=a,this.h("textValidation",b,a))});w.defineProperty(Ch,{kG:"textEdited"},function(){return this.jt},function(a){var b=this.jt;b!==a&&(null!==a&&w.j(a,"function",Ch,"textEdited"),this.jt=a,this.h("textEdited",b,a))});
w.defineProperty(Ch,{EL:"spacingAbove"},function(){return this.bi},function(a){var b=this.bi;b!==a&&(this.bi=a,this.h("spacingAbove",b,a))});w.defineProperty(Ch,{FL:"spacingBelow"},function(){return this.ci},function(a){var b=this.ci;b!==a&&(this.ci=a,this.h("spacingBelow",b,a))});w.defineProperty(Ch,{JI:"maxLines"},function(){return this.fh},function(a){var b=this.fh;b!==a&&(a=Math.floor(a),0>=a&&w.Ea(a,"> 0",Ch,"maxLines"),this.fh=a,this.h("maxLines",b,a),this.I())});w.u(Ch,{iL:"metrics"},function(){return this.Oi});
w.defineProperty(Ch,{uK:"choices"},function(){return this.Sq},function(a){var b=this.Sq;b!==a&&(null===a||Array.isArray(a)||w.wd(a,"Array",Ch,"choices:value"),this.Sq=a,this.h("choices",b,a))});function Sp(){this.ef=this.gj=0;this.pf=[];this.Qe=[]}Sp.prototype.reset=function(){this.ef=this.gj=0;this.pf=[];this.Qe=[]};Sp.prototype.Mp=function(a){this.gj=a.gj;this.ef=a.ef;this.pf=w.Hl(a.pf);this.Qe=w.Hl(a.Qe)};w.u(Sp,{qK:"arrSize"},function(){return this.pf});w.u(Sp,{rK:"arrText"},function(){return this.Qe});
w.u(Sp,{hL:"maxLineWidth"},function(){return this.ef});function tl(){G.call(this);this.Se=null;this.bt="";this.ik=Qd;this.Ko=Ie;this.gi=this.Te=null;this.Jo=Fb;this.kg=Ij;this.wp=null;this.ez=!1;this.yv=!0;this.Uv=!1;this.np=null}w.La(tl,G);w.fa("Picture",tl);tl.prototype.cloneProtected=function(a){G.prototype.cloneProtected.call(this,a);a.element=this.Se;a.bt=this.bt;a.ik=this.ik.S();a.Ko=this.Ko;a.kg=this.kg;a.Te=this.Te;a.gi=this.gi;a.Jo=this.Jo.S();a.yv=this.yv;a.np=this.np};
tl.prototype.fc=function(a){a===Ij||a===Kj||a===Lj?this.hI=a:G.prototype.fc.call(this,a)};tl.prototype.toString=function(){return"Picture("+this.source+")#"+w.Jd(this)};var Iq=new sa,Jq=0,nl=[];function Kq(){var a=nl;if(0===a.length)for(var b=window.document.getElementsByTagName("canvas"),c=b.length,d=0;d<c;d++){var e=b[d];e.parentElement&&e.parentElement.Z&&a.push(e.parentElement.Z)}return a}var Lq;
tl.clearCache=Lq=function(a){void 0===a&&(a="");w.j(a,"string",tl,"clearCache:url");""!==a?Iq[a]&&(delete Iq[a],Jq--):(Iq=new sa,Jq=0)};
w.defineProperty(tl,{element:"element"},function(){return this.Se},function(a){var b=this.Se;if(b!==a){null===a||a instanceof HTMLImageElement||a instanceof HTMLVideoElement||a instanceof HTMLCanvasElement||w.k("Picture.element must be an instance of Image, Canvas, or Video, not: "+a);this.ez=a instanceof HTMLCanvasElement;this.Se=a;if(null!==a)if(a instanceof HTMLCanvasElement||!0===a.complete)a.Io instanceof Event&&null!==this.Te&&this.Te(this,a.Io),!0===a.Lv&&null!==this.gi&&this.gi(this,a.uz),
a.Lv=!0,this.Aa.H()||(Xl(this,!1),this.I());else{var c=this;a.CC||(a.addEventListener("load",function(b){Mq(a,b);c.Aa.H()||(Xl(c,!1),c.I())}),a.addEventListener("error",function(b){Nq(a,b)}),a.CC=!0)}this.h("element",b,a);this.na()}});
w.defineProperty(tl,{source:"source"},function(){return this.bt},function(a){var b=this.bt;if(b!==a){w.j(a,"string",tl,"source");this.bt=a;var c=Iq,d=this.g;if(void 0!==c[a])var e=c[a].Fp[0].source;else{30<Jq&&(Lq(),c=Iq);var e=w.createElement("img"),f=this;e.addEventListener("load",function(a){Mq(e,a);f.Aa.H()||(Xl(f,!1),f.I())});e.addEventListener("error",function(a){Nq(e,a)});e.CC=!0;var h=this.np;null!==h&&(e.crossOrigin=h(this));e.src=a;c[a]=new Oq(e);Jq++}null!==d&&jn(d,this);this.element=e;
null!==d&&hn(d,this);this.I();this.na();this.h("source",b,a)}});function Mq(a,b){a.Lv=!0;a.Io=!1;for(var c=null,d=Kq(),e=d.length,f=0;f<e;f++){var h=d[f],k=h.gp.ka(a.src);if(null!==k)for(e=k.length,f=0;f<e;f++)c=k[f],h.qz.add(c),h.Le(),null===a.uz&&(a.uz=b,null!==c.gi&&c.gi(c,b))}}function Nq(a,b){a.Io=b;for(var c=null,d=Kq(),e=d.length,f=0;f<e;f++)if(c=d[f].gp.ka(a.src),null!==c){for(var e=c.length,h=w.lb(),f=0;f<e;f++)h.push(c[f]);for(f=0;f<e;f++)c=h[f],null!==c.Te&&c.Te(c,b);w.va(h)}}
w.defineProperty(tl,{DL:"sourceCrossOrigin"},function(){return this.np},function(a){if(this.np!==a&&(null!==a&&w.j(a,"function",tl,"sourceCrossOrigin"),this.np=a,null!==this.element)){var b=this.element.src;null===a&&"string"===typeof b?this.element.crossOrigin=null:null!==a&&(this.element.crossOrigin=a(this));this.element.src=b}});
w.defineProperty(tl,{Bj:"sourceRect"},function(){return this.ik},function(a){var b=this.ik;b.L(a)||(w.G(a,A,tl,"sourceRect"),this.ik=a=a.S(),this.na(),this.h("sourceRect",b,a))});w.defineProperty(tl,{hI:"imageStretch"},function(){return this.Ko},function(a){var b=this.Ko;b!==a&&(w.mb(a,G,tl,"imageStretch"),this.Ko=a,this.na(),this.h("imageStretch",b,a))});
w.defineProperty(tl,{Pt:"flip"},function(){return this.kg},function(a){var b=this.kg;b!==a&&(w.mb(a,G,tl,"flip"),this.kg=a,this.na(),this.h("flip",b,a))});w.defineProperty(tl,{QK:"imageAlignment"},function(){return this.Jo},function(a){w.G(a,L,tl,"imageAlignment");var b=this.Jo;b.L(a)||(this.Jo=a=a.S(),this.I(),this.h("imageAlignment",b,a))});
w.defineProperty(tl,{eA:"errorFunction"},function(){return this.Te},function(a){var b=this.Te;b!==a&&(null!==a&&w.j(a,"function",tl,"errorFunction"),this.Te=a,this.h("errorFunction",b,a))});w.defineProperty(tl,{NL:"successFunction"},function(){return this.gi},function(a){var b=this.gi;b!==a&&(null!==a&&w.j(a,"function",tl,"successFunction"),this.gi=a,this.h("successFunction",b,a))});
tl.prototype.xk=function(a,b){var c=this.Se;if(null!==c){var d=c.src;null!==d&&""!==d||w.k('Element has no source ("src") attribute: '+c);if(!(c.Io instanceof Event)&&!0===c.Lv){var d=this.Ia,e=0,f=0,h=this.ez,k=h?+c.width:c.naturalWidth,h=h?+c.height:c.naturalHeight;void 0===k&&c.videoWidth&&(k=c.videoWidth);void 0===h&&c.videoHeight&&(h=c.videoHeight);k=k||d.width;h=h||d.height;if(0!==k&&0!==h){var l=k,m=h;this.Bj.H()&&(e=this.ik.x,f=this.ik.y,k=this.ik.width,h=this.ik.height);var n=k,p=h,q=this.Ko,
r=this.Jo;switch(q){case Ij:if(this.Bj.H())break;n>=d.width&&(e=e+r.offsetX+(n*r.x-d.width*r.x));p>=d.height&&(f=f+r.offsetY+(p*r.y-d.height*r.y));k=Math.min(d.width,n);h=Math.min(d.height,p);break;case Ie:n=d.width;p=d.height;break;case Kj:case Lj:var s=0;q===Kj?(s=Math.min(d.height/p,d.width/n),n*=s,p*=s):q===Lj&&(s=Math.max(d.height/p,d.width/n),n*=s,p*=s,n>=d.width&&(e=(e+r.offsetX+(n*r.x-d.width*r.x)/n)*k),p>=d.height&&(f=(f+r.offsetY+(p*r.y-d.height*r.y)/p)*h),k*=1/(n/d.width),h*=1/(p/d.height),
n=d.width,p=d.height)}var q=this.nj()*b.scale,u=k*h/(n*q*p*q),s=Iq[this.source],q=null;if(void 0!==s&&16<u){2>s.Fp.length&&(Pq(s,4,l,m),Pq(s,16,l,m));for(var l=s.Fp,m=l.length,q=l[0],t=0;t<m;t++)if(l[t].kq*l[t].kq<u)q=l[t];else break}if(!b.Co){if(null===this.wp)if(null===this.Se)this.wp=!1;else{l=(new Tc(null)).wk;l.drawImage(this.Se,0,0);try{l.getImageData(0,0,1,1).data[3]&&(this.wp=!1),this.wp=!1}catch(x){this.wp=!0}}if(this.wp)return}l=0;n<d.width&&(l=r.offsetX+(d.width*r.x-n*r.x));m=0;p<d.height&&
(m=r.offsetY+(d.height*r.y-p*r.y));switch(this.Pt){case po:a.translate(Math.min(d.width,n),0);a.scale(-1,1);break;case oo:a.translate(0,Math.min(d.height,p));a.scale(1,-1);break;case qo:a.translate(Math.min(d.width,n),Math.min(d.height,p)),a.scale(-1,-1)}if(b.oj("pictureRatioOptimization")&&!b.fz&&void 0!==s&&null!==q&&1!==q.kq){a.save();s=q.kq;try{a.drawImage(q.source,e/s,f/s,Math.min(q.source.width,k/s),Math.min(q.source.height,h/s),l,m,Math.min(d.width,n),Math.min(d.height,p))}catch(v){this.yv=
!1}a.restore()}else try{a.drawImage(c,e,f,k,h,l,m,Math.min(d.width,n),Math.min(d.height,p))}catch(B){this.yv=!1}switch(this.Pt){case po:a.scale(-1,1);a.translate(-Math.min(d.width,n),0);break;case oo:a.scale(1,-1);a.translate(0,-Math.min(d.height,p));break;case qo:a.scale(-1,-1),a.translate(-Math.min(d.width,n),-Math.min(d.height,p))}}}}};w.u(tl,{Ia:"naturalBounds"},function(){return this.Sc});
tl.prototype.Ln=function(a,b,c,d){var e=this.Aa,f=Bo(this,!0),h=this.Se,k=this.ez;if(k||!this.Uv&&h&&h.complete)this.Uv=!0;null===h&&(isFinite(a)||(a=0),isFinite(b)||(b=0));isFinite(e.width)||f===Ie||f===no?(isFinite(a)||(a=this.Bj.H()?this.Bj.width:k?+h.width:h.naturalWidth),c=0):null!==h&&!1!==this.Uv&&(a=this.Bj.H()?this.Bj.width:k?+h.width:h.naturalWidth);isFinite(e.height)||f===Ie||f===mo?(isFinite(b)||(b=this.Bj.H()?this.Bj.height:k?+h.height:h.naturalHeight),d=0):null!==h&&!1!==this.Uv&&(b=
this.Bj.H()?this.Bj.height:k?+h.height:h.naturalHeight);isFinite(e.width)&&(a=e.width);isFinite(e.height)&&(b=e.height);e=this.Af;f=this.zh;c=Math.max(c,f.width);d=Math.max(d,f.height);a=Math.min(e.width,a);b=Math.min(e.height,b);a=Math.max(c,a);b=Math.max(d,b);null===h||h.complete||(isFinite(a)||(a=0),isFinite(b)||(b=0));Pa(this.Sc,a,b);yo(this,0,0,a,b)};tl.prototype.hj=function(a,b,c,d){Do(this,a,b,c,d)};function Oq(a){this.Fp=[new Qq(a,1)]}
function Pq(a,b,c,d){var e=new Tc(null),f=e.wk,h=1/b;e.width=c/b;e.height=d/b;b=new Qq(e.Gd,b);c=a.Fp[a.Fp.length-1];f.setTransform(h*c.kq,0,0,h*c.kq,0,0);f.drawImage(c.source,0,0);a.Fp.push(b)}function Qq(a,b){this.source=a;this.kq=b}function ja(){this.o=new Fe;this.Ub=null}g=ja.prototype;g.reset=function(){this.o=new Fe;this.Ub=null};
function M(a,b,c,d,e,f){null===a.o&&w.k("StreamGeometryContext has been closed");void 0!==e&&!0===e?(null===a.Ub&&w.k("Need to call beginFigure first"),d=new yf(of),d.D=b,d.F=c,a.Ub.vb.add(d)):(a.Ub=new He,a.Ub.ia=b,a.Ub.ga=c,a.Ub.bu=d,a.o.cc.add(a.Ub));void 0!==f&&(a.Ub.Qo=f)}function O(a){null===a.o&&w.k("StreamGeometryContext has been closed");null===a.Ub&&w.k("Need to call beginFigure first");var b=a.Ub.vb.length;0<b&&a.Ub.vb.da(b-1).close()}
function Ze(a){null===a.o&&w.k("StreamGeometryContext has been closed");null===a.Ub&&w.k("Need to call beginFigure first");0<a.Ub.vb.length&&(a.Ub.bu=!0)}g.$a=function(a){null===this.o&&w.k("StreamGeometryContext has been closed");null===this.Ub&&w.k("Need to call beginFigure first");this.Ub.Zl=a};g.moveTo=function(a,b,c){void 0===c&&(c=!1);null===this.o&&w.k("StreamGeometryContext has been closed");null===this.Ub&&w.k("Need to call beginFigure first");var d=new yf(of);d.D=a;d.F=b;c&&d.close();this.Ub.vb.add(d)};
g.lineTo=function(a,b,c){void 0===c&&(c=!1);null===this.o&&w.k("StreamGeometryContext has been closed");null===this.Ub&&w.k("Need to call beginFigure first");var d=new yf(Ue);d.D=a;d.F=b;c&&d.close();this.Ub.vb.add(d)};function N(a,b,c,d,e,f,h,k){void 0===k&&(k=!1);null===a.o&&w.k("StreamGeometryContext has been closed");null===a.Ub&&w.k("Need to call beginFigure first");var l=new yf(pf);l.rc=b;l.Oc=c;l.Ah=d;l.Bh=e;l.D=f;l.F=h;k&&l.close();a.Ub.vb.add(l)}
function Xe(a,b,c,d,e){var f;void 0===f&&(f=!1);null===a.o&&w.k("StreamGeometryContext has been closed");null===a.Ub&&w.k("Need to call beginFigure first");var h=new yf(qf);h.rc=b;h.Oc=c;h.D=d;h.F=e;f&&h.close();a.Ub.vb.add(h)}g.arcTo=function(a,b,c,d,e,f,h){void 0===f&&(f=0);void 0===h&&(h=!1);null===this.o&&w.k("StreamGeometryContext has been closed");null===this.Ub&&w.k("Need to call beginFigure first");var k=new yf(rf);k.ye=a;k.of=b;k.ja=c;k.ra=d;k.radiusX=e;k.radiusY=0!==f?f:e;h&&k.close();this.Ub.vb.add(k)};
function Ye(a,b,c,d,e,f,h,k){var l;void 0===l&&(l=!1);null===a.o&&w.k("StreamGeometryContext has been closed");null===a.Ub&&w.k("Need to call beginFigure first");b=new yf(sf,h,k,b,c,d,e,f);l&&b.close();a.Ub.vb.add(b)}function Rq(a){a=Sq(a);var b=w.lb();b[0]=a[0];for(var c=1,d=1;d<a.length;)b[c]=a[d],b[c+1]=a[d],b[c+2]=a[d+1],d+=2,c+=3;w.va(a);return b}
function Sq(a){var b=Tq(a),c=w.lb(),d=Math.floor(b.length/2),e=b.length-1;a=0===a%2?2:1;for(var f=0;f<e;f++){var h=b[f],k=b[f+1],l=b[(d+f-1)%e],m=b[(d+f+a)%e];c[2*f]=h;c[2*f+1]=pe(h.x,h.y,l.x,l.y,k.x,k.y,m.x,m.y,new z)}c[c.length]=c[0];w.va(b);return c}function Tq(a){for(var b=w.lb(),c=1.5*Math.PI,d=0,e=0;e<a;e++)d=2*Math.PI/a*e+c,b[e]=new z(.5+.5*Math.cos(d),.5+.5*Math.sin(d));b.push(b[0]);return b}
var fq={None:"Rectangle",Rectangle:function(a,b,c){a=new Fe;a.type=Ke;a.ia=0;a.ga=0;a.D=b;a.F=c;return a},Square:function(a,b,c){a=new Fe;a.Zd=Kj;a.type=Ke;a.ia=0;a.ga=0;a.D=Math.min(b,c);a.F=Math.min(b,c);return a},Ellipse:function(a,b,c){a=new Fe;a.type=Se;a.ia=0;a.ga=0;a.D=b;a.F=c;a.A=Rd;a.B=Sd;return a},Circle:function(a,b,c){a=new Fe;a.Zd=Kj;a.type=Se;a.ia=0;a.ga=0;a.D=Math.min(b,c);a.F=Math.min(b,c);a.A=Rd;a.B=Sd;return a},Connector:"Ellipse",TriangleRight:function(a,b,c){a=new Fe;var d=new He,
e=new yf;e.D=b;e.F=.5*c;d.vb.add(e);b=new yf;b.D=0;b.F=c;d.vb.add(b.close());a.cc.add(d);a.A=new L(0,.25);a.B=new L(.5,.75);return a},TriangleDown:function(a,b,c){a=new Fe;var d=new He,e=new yf;e.D=b;e.F=0;d.vb.add(e);e=new yf;e.D=.5*b;e.F=c;d.vb.add(e.close());a.cc.add(d);a.A=new L(.25,0);a.B=new L(.75,.5);return a},TriangleLeft:function(a,b,c){a=new Fe;var d=new He;d.ia=b;d.ga=c;var e=new yf;e.D=0;e.F=.5*c;d.vb.add(e);c=new yf;c.D=b;c.F=0;d.vb.add(c.close());a.cc.add(d);a.A=new L(.5,.25);a.B=new L(1,
.75);return a},TriangleUp:function(a,b,c){a=new Fe;var d=new He;d.ia=b;d.ga=c;var e=new yf;e.D=0;e.F=c;d.vb.add(e);c=new yf;c.D=.5*b;c.F=0;d.vb.add(c.close());a.cc.add(d);a.A=new L(.25,.5);a.B=new L(.75,1);return a},Line1:function(a,b,c){a=new Fe;a.type=Je;a.ia=0;a.ga=0;a.D=b;a.F=c;return a},Line2:function(a,b,c){a=new Fe;a.type=Je;a.ia=b;a.ga=0;a.D=0;a.F=c;return a},MinusLine:"LineH",LineH:function(a,b,c){a=new Fe;a.type=Je;a.ia=0;a.ga=c/2;a.D=b;a.F=c/2;return a},LineV:function(a,b,c){a=new Fe;a.type=
Je;a.ia=b/2;a.ga=0;a.D=b/2;a.F=c;return a},BarH:"Rectangle",BarV:"Rectangle",Curve1:function(a,b,c){a=w.s();M(a,0,0,!1);N(a,ad*b,0,1*b,(1-ad)*c,b,c);b=a.o;w.q(a);return b},Curve2:function(a,b,c){a=w.s();M(a,0,0,!1);N(a,0,ad*c,(1-ad)*b,c,b,c);b=a.o;w.q(a);return b},Curve3:function(a,b,c){a=w.s();M(a,1*b,0,!1);N(a,1*b,ad*c,ad*b,1*c,0,1*c);b=a.o;w.q(a);return b},Curve4:function(a,b,c){a=w.s();M(a,1*b,0,!1);N(a,(1-ad)*b,0,0,(1-ad)*c,0,1*c);b=a.o;w.q(a);return b},Alternative:"Triangle",Merge:"Triangle",
Triangle:function(a,b,c){a=w.s();M(a,.5*b,0*c,!0);a.lineTo(0*b,1*c);a.lineTo(1*b,1*c,!0);b=a.o;b.A=new L(.25,.5);b.B=new L(.75,1);w.q(a);return b},Decision:"Diamond",Diamond:function(a,b,c){a=w.s();M(a,.5*b,0,!0);a.lineTo(0,.5*c);a.lineTo(.5*b,1*c);a.lineTo(1*b,.5*c,!0);b=a.o;b.A=new L(.25,.25);b.B=new L(.75,.75);w.q(a);return b},Pentagon:function(a,b,c){var d=Tq(5);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);for(var e=1;5>e;e++)a.lineTo(d[e].x*b,d[e].y*c);w.va(d);O(a);b=a.o;b.A=new L(.2,.22);b.B=new L(.8,
.9);w.q(a);return b},DataTransmission:"Hexagon",Hexagon:function(a,b,c){var d=Tq(6);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);for(var e=1;6>e;e++)a.lineTo(d[e].x*b,d[e].y*c);w.va(d);O(a);b=a.o;b.A=new L(.07,.25);b.B=new L(.93,.75);w.q(a);return b},Heptagon:function(a,b,c){var d=Tq(7);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);for(var e=1;7>e;e++)a.lineTo(d[e].x*b,d[e].y*c);w.va(d);O(a);b=a.o;b.A=new L(.2,.15);b.B=new L(.8,.85);w.q(a);return b},Octagon:function(a,b,c){var d=Tq(8);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);
for(var e=1;8>e;e++)a.lineTo(d[e].x*b,d[e].y*c);w.va(d);O(a);b=a.o;b.A=new L(.15,.15);b.B=new L(.85,.85);w.q(a);return b},Nonagon:function(a,b,c){var d=Tq(9);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);for(var e=1;9>e;e++)a.lineTo(d[e].x*b,d[e].y*c);w.va(d);O(a);b=a.o;b.A=new L(.17,.13);b.B=new L(.82,.82);w.q(a);return b},Decagon:function(a,b,c){var d=Tq(10);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);for(var e=1;10>e;e++)a.lineTo(d[e].x*b,d[e].y*c);w.va(d);O(a);b=a.o;b.A=new L(.16,.16);b.B=new L(.84,.84);w.q(a);return b},
Dodecagon:function(a,b,c){var d=Tq(12);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);for(var e=1;12>e;e++)a.lineTo(d[e].x*b,d[e].y*c);w.va(d);O(a);b=a.o;b.A=new L(.16,.16);b.B=new L(.84,.84);w.q(a);return b},FivePointedStar:function(a,b,c){var d=Sq(5);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);for(var e=1;10>e;e++)a.lineTo(d[e].x*b,d[e].y*c);w.va(d);O(a);b=a.o;b.A=new L(.312,.383);b.B=new L(.693,.765);w.q(a);return b},SixPointedStar:function(a,b,c){var d=Sq(6);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);for(var e=1;12>e;e++)a.lineTo(d[e].x*
b,d[e].y*c);w.va(d);O(a);b=a.o;b.A=new L(.17,.251);b.B=new L(.833,.755);w.q(a);return b},SevenPointedStar:function(a,b,c){var d=Sq(7);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);for(var e=1;14>e;e++)a.lineTo(d[e].x*b,d[e].y*c);w.va(d);O(a);b=a.o;b.A=new L(.363,.361);b.B=new L(.641,.709);w.q(a);return b},EightPointedStar:function(a,b,c){var d=Sq(8);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);for(var e=1;16>e;e++)a.lineTo(d[e].x*b,d[e].y*c);w.va(d);O(a);b=a.o;b.A=new L(.252,.255);b.B=new L(.75,.75);w.q(a);return b},NinePointedStar:function(a,
b,c){var d=Sq(9);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);for(var e=1;18>e;e++)a.lineTo(d[e].x*b,d[e].y*c);w.va(d);O(a);b=a.o;b.A=new L(.355,.361);b.B=new L(.645,.651);w.q(a);return b},TenPointedStar:function(a,b,c){var d=Sq(10);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);for(var e=1;20>e;e++)a.lineTo(d[e].x*b,d[e].y*c);w.va(d);O(a);b=a.o;b.A=new L(.281,.261);b.B=new L(.723,.748);w.q(a);return b},FivePointedBurst:function(a,b,c){var d=Rq(5);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);for(var e=1;e<d.length;e+=3)N(a,d[e].x*
b,d[e].y*c,d[e+1].x*b,d[e+1].y*c,d[e+2].x*b,d[e+2].y*c);w.va(d);O(a);b=a.o;b.A=new L(.312,.383);b.B=new L(.693,.765);w.q(a);return b},SixPointedBurst:function(a,b,c){var d=Rq(6);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);for(var e=1;e<d.length;e+=3)N(a,d[e].x*b,d[e].y*c,d[e+1].x*b,d[e+1].y*c,d[e+2].x*b,d[e+2].y*c);w.va(d);O(a);b=a.o;b.A=new L(.17,.251);b.B=new L(.833,.755);w.q(a);return b},SevenPointedBurst:function(a,b,c){var d=Rq(7);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);for(var e=1;e<d.length;e+=3)N(a,d[e].x*
b,d[e].y*c,d[e+1].x*b,d[e+1].y*c,d[e+2].x*b,d[e+2].y*c);w.va(d);O(a);b=a.o;b.A=new L(.363,.361);b.B=new L(.641,.709);w.q(a);return b},EightPointedBurst:function(a,b,c){var d=Rq(8);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);for(var e=1;e<d.length;e+=3)N(a,d[e].x*b,d[e].y*c,d[e+1].x*b,d[e+1].y*c,d[e+2].x*b,d[e+2].y*c);w.va(d);O(a);b=a.o;b.A=new L(.252,.255);b.B=new L(.75,.75);w.q(a);return b},NinePointedBurst:function(a,b,c){var d=Rq(9);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);for(var e=1;e<d.length;e+=3)N(a,d[e].x*
b,d[e].y*c,d[e+1].x*b,d[e+1].y*c,d[e+2].x*b,d[e+2].y*c);w.va(d);O(a);b=a.o;b.A=new L(.355,.361);b.B=new L(.645,.651);w.q(a);return b},TenPointedBurst:function(a,b,c){var d=Rq(10);a=w.s();M(a,d[0].x*b,d[0].y*c,!0);for(var e=1;e<d.length;e+=3)N(a,d[e].x*b,d[e].y*c,d[e+1].x*b,d[e+1].y*c,d[e+2].x*b,d[e+2].y*c);w.va(d);O(a);b=a.o;b.A=new L(.281,.261);b.B=new L(.723,.748);w.q(a);return b},Cloud:function(a,b,c){a=w.s();M(a,.08034461*b,.1944299*c,!0);N(a,-.09239631*b,.07836421*c,.1406031*b,-.0542823*c,.2008615*
b,.05349299*c);N(a,.2450511*b,-.00697547*c,.3776197*b,-.01112067*c,.4338609*b,.074219*c);N(a,.4539471*b,0,.6066018*b,-.02526587*c,.6558228*b,.07004196*c);N(a,.6914277*b,-.01904177*c,.8921095*b,-.01220843*c,.8921095*b,.08370865*c);N(a,1.036446*b,.04105738*c,1.020377*b,.3022052*c,.9147671*b,.3194596*c);N(a,1.04448*b,.360238*c,.992256*b,.5219009*c,.9082935*b,.562044*c);N(a,1.032337*b,.5771781*c,1.018411*b,.8120651*c,.9212406*b,.8217117*c);N(a,1.028411*b,.9571472*c,.8556702*b,1.052487*c,.7592566*b,.9156953*
c);N(a,.7431877*b,1.009325*c,.5624123*b,1.021761*c,.5101666*b,.9310455*c);N(a,.4820677*b,1.031761*c,.3030112*b,1.002796*c,.2609328*b,.9344623*c);N(a,.2329994*b,1.01518*c,.03213784*b,1.01518*c,.08034461*b,.870098*c);N(a,-.02812061*b,.9032597*c,-.01205169*b,.6835638*c,.06829292*b,.6545475*c);N(a,-.01812061*b,.6089503*c,-.00606892*b,.4555777*c,.06427569*b,.4265613*c);N(a,-.01606892*b,.3892545*c,-.01205169*b,.1944299*c,.08034461*b,.1944299*c);O(a);b=a.o;b.A=new L(.1,.1);b.B=new L(.9,.9);w.q(a);return b},
Gate:"Crescent",Crescent:function(a,b,c){a=w.s();M(a,0,0,!0);N(a,1*b,0,1*b,1*c,0,1*c);N(a,.5*b,.75*c,.5*b,.25*c,0,0);O(a);b=a.o;b.A=new L(.511,.19);b.B=new L(.776,.76);w.q(a);return b},FramedRectangle:function(a,b,c){var d=w.s(),e=a?a.Cc:NaN;a=a?a.vu:NaN;isNaN(e)&&(e=.1);isNaN(a)&&(a=.1);M(d,0,0,!0);d.lineTo(1*b,0);d.lineTo(1*b,1*c);d.lineTo(0,1*c,!0);M(d,e*b,a*c,!1,!0);d.lineTo(e*b,(1-a)*c);d.lineTo((1-e)*b,(1-a)*c);d.lineTo((1-e)*b,a*c,!0);b=d.o;b.A=new L(e,a);b.B=new L(1-e,1-a);w.q(d);return b},
Delay:"HalfEllipse",HalfEllipse:function(a,b,c){a=w.s();M(a,0,0,!0);N(a,ad*b,0,1*b,(.5-ad/2)*c,1*b,.5*c);N(a,1*b,(.5+ad/2)*c,ad*b,1*c,0,1*c);O(a);b=a.o;b.A=new L(0,.2);b.B=new L(.75,.8);w.q(a);return b},Heart:function(a,b,c){a=w.s();M(a,.5*b,1*c,!0);N(a,.1*b,.8*c,0,.5*c,0*b,.3*c);N(a,0*b,0,.45*b,0,.5*b,.3*c);N(a,.55*b,0,1*b,0,1*b,.3*c);N(a,b,.5*c,.9*b,.8*c,.5*b,1*c);O(a);b=a.o;b.A=new L(.15,.29);b.B=new L(.86,.68);w.q(a);return b},Spade:function(a,b,c){a=w.s();M(a,.5*b,0,!0);a.lineTo(.51*b,.01*c);
N(a,.6*b,.2*c,b,.25*c,b,.5*c);N(a,b,.8*c,.6*b,.8*c,.55*b,.7*c);N(a,.5*b,.75*c,.55*b,.95*c,.75*b,c);a.lineTo(.25*b,c);N(a,.45*b,.95*c,.5*b,.75*c,.45*b,.7*c);N(a,.4*b,.8*c,0,.8*c,0,.5*c);N(a,0,.25*c,.4*b,.2*c,.49*b,.01*c);O(a);b=a.o;b.A=new L(.19,.26);b.B=new L(.8,.68);w.q(a);return b},Club:function(a,b,c){a=w.s();M(a,.4*b,.6*c,!0);N(a,.5*b,.75*c,.45*b,.95*c,.15*b,1*c);a.lineTo(.85*b,c);N(a,.55*b,.95*c,.5*b,.75*c,.6*b,.6*c);var d=.2,e=.3,f=0,h=4*(Math.SQRT2-1)/3*d;N(a,(.5-d+e)*b,(.5+h+f)*c,(.5-h+e)*
b,(.5+d+f)*c,(.5+e)*b,(.5+d+f)*c);N(a,(.5+h+e)*b,(.5+d+f)*c,(.5+d+e)*b,(.5+h+f)*c,(.5+d+e)*b,(.5+f)*c);N(a,(.5+d+e)*b,(.5-h+f)*c,(.5+h+e)*b,(.5-d+f)*c,(.5+e)*b,(.5-d+f)*c);N(a,(.5-h+e)*b,(.5-d+f)*c,(.5-d+e+.05)*b,(.5-h+f-.02)*c,.65*b,.36771243*c);d=.2;e=0;f=-.3;h=4*(Math.SQRT2-1)/3*d;N(a,(.5+h+e)*b,(.5+d+f)*c,(.5+d+e)*b,(.5+h+f)*c,(.5+d+e)*b,(.5+f)*c);N(a,(.5+d+e)*b,(.5-h+f)*c,(.5+h+e)*b,(.5-d+f)*c,(.5+e)*b,(.5-d+f)*c);N(a,(.5-h+e)*b,(.5-d+f)*c,(.5-d+e)*b,(.5-h+f)*c,(.5-d+e)*b,(.5+f)*c);N(a,(.5-d+
e)*b,(.5+h+f)*c,(.5-h+e)*b,(.5+d+f)*c,.35*b,.36771243*c);d=.2;e=-.3;f=0;h=4*(Math.SQRT2-1)/3*d;N(a,(.5+d+e-.05)*b,(.5-h+f-.02)*c,(.5+h+e)*b,(.5-d+f)*c,(.5+e)*b,(.5-d+f)*c);N(a,(.5-h+e)*b,(.5-d+f)*c,(.5-d+e)*b,(.5-h+f)*c,(.5-d+e)*b,(.5+f)*c);N(a,(.5-d+e)*b,(.5+h+f)*c,(.5-h+e)*b,(.5+d+f)*c,(.5+e)*b,(.5+d+f)*c);N(a,(.5+h+e)*b,(.5+d+f)*c,(.5+d+e)*b,(.5+h+f)*c,.4*b,.6*c);O(a);b=a.o;b.A=new L(.06,.39);b.B=new L(.93,.58);w.q(a);return b},Ring:function(a,b,c){a=w.s();var d=4*(Math.SQRT2-1)/3*.5;M(a,b,.5*
c,!0);N(a,b,(.5-d)*c,(.5+d)*b,0,.5*b,0);N(a,(.5-d)*b,0,0,(.5-d)*c,0,.5*c);N(a,0,(.5+d)*c,(.5-d)*b,c,.5*b,c);N(a,(.5+d)*b,c,b,(.5+d)*c,b,.5*c);d=4*(Math.SQRT2-1)/3*.4;M(a,.5*b,.1*c,!0,!0);N(a,(.5+d)*b,.1*c,.9*b,(.5-d)*c,.9*b,.5*c);N(a,.9*b,(.5+d)*c,(.5+d)*b,.9*c,.5*b,.9*c);N(a,(.5-d)*b,.9*c,.1*b,(.5+d)*c,.1*b,.5*c);N(a,.1*b,(.5-d)*c,(.5-d)*b,.1*c,.5*b,.1*c);b=a.o;b.A=new L(.146,.146);b.B=new L(.853,.853);b.Zd=Kj;w.q(a);return b},YinYang:function(a,b,c){var d=.5;a=w.s();d=.5;M(a,.5*b,0,!0);a.arcTo(270,
180,.5*b,.5*b,.5*b);N(a,1*b,d*c,0,d*c,d*b,0,!0);var d=.1,e=.25;M(a,(.5+d)*b,e*c,!0,!0);a.arcTo(0,-360,.5*b,c*e,d*b);O(a);M(a,.5*b,0,!1);a.arcTo(270,-180,.5*b,.5*b,.5*b);a.$a(!1);e=.75;M(a,(.5+d)*b,e*c,!0);a.arcTo(0,360,.5*b,c*e,d*b);O(a);b=a.o;b.Zd=Kj;w.q(a);return b},Peace:function(a,b,c){a=w.s();var d=4*(Math.SQRT2-1)/3*.5;M(a,b,.5*c,!0);N(a,b,(.5-d)*c,(.5+d)*b,0,.5*b,0);N(a,(.5-d)*b,0,0,(.5-d)*c,0,.5*c);N(a,0,(.5+d)*c,(.5-d)*b,c,.5*b,c);N(a,(.5+d)*b,c,b,(.5+d)*c,b,.5*c);d=4*(Math.SQRT2-1)/3*.4;
M(a,.5*b,.1*c,!0,!0);N(a,(.5+d)*b,.1*c,.9*b,(.5-d)*c,.9*b,.5*c);N(a,.9*b,(.5+d)*c,(.5+d)*b,.9*c,.5*b,.9*c);N(a,(.5-d)*b,.9*c,.1*b,(.5+d)*c,.1*b,.5*c);N(a,.1*b,(.5-d)*c,(.5-d)*b,.1*c,.5*b,.1*c);var d=.07,e=0,f=-.707*.11,h=4*(Math.SQRT2-1)/3*d;M(a,(.5+d+e)*b,(.5+f)*c,!0);N(a,(.5+d+e)*b,(.5-h+f)*c,(.5+h+e)*b,(.5-d+f)*c,(.5+e)*b,(.5-d+f)*c);N(a,(.5-h+e)*b,(.5-d+f)*c,(.5-d+e)*b,(.5-h+f)*c,(.5-d+e)*b,(.5+f)*c);N(a,(.5-d+e)*b,(.5+h+f)*c,(.5-h+e)*b,(.5+d+f)*c,(.5+e)*b,(.5+d+f)*c);N(a,(.5+h+e)*b,(.5+d+f)*
c,(.5+d+e)*b,(.5+h+f)*c,(.5+d+e)*b,(.5+f)*c);d=.07;e=-.707*.11;f=.707*.11;h=4*(Math.SQRT2-1)/3*d;M(a,(.5+d+e)*b,(.5+f)*c,!0);N(a,(.5+d+e)*b,(.5-h+f)*c,(.5+h+e)*b,(.5-d+f)*c,(.5+e)*b,(.5-d+f)*c);N(a,(.5-h+e)*b,(.5-d+f)*c,(.5-d+e)*b,(.5-h+f)*c,(.5-d+e)*b,(.5+f)*c);N(a,(.5-d+e)*b,(.5+h+f)*c,(.5-h+e)*b,(.5+d+f)*c,(.5+e)*b,(.5+d+f)*c);N(a,(.5+h+e)*b,(.5+d+f)*c,(.5+d+e)*b,(.5+h+f)*c,(.5+d+e)*b,(.5+f)*c);d=.07;e=.707*.11;f=.707*.11;h=4*(Math.SQRT2-1)/3*d;M(a,(.5+d+e)*b,(.5+f)*c,!0);N(a,(.5+d+e)*b,(.5-h+
f)*c,(.5+h+e)*b,(.5-d+f)*c,(.5+e)*b,(.5-d+f)*c);N(a,(.5-h+e)*b,(.5-d+f)*c,(.5-d+e)*b,(.5-h+f)*c,(.5-d+e)*b,(.5+f)*c);N(a,(.5-d+e)*b,(.5+h+f)*c,(.5-h+e)*b,(.5+d+f)*c,(.5+e)*b,(.5+d+f)*c);N(a,(.5+h+e)*b,(.5+d+f)*c,(.5+d+e)*b,(.5+h+f)*c,(.5+d+e)*b,(.5+f)*c);b=a.o;b.A=new L(.146,.146);b.B=new L(.853,.853);b.Zd=Kj;w.q(a);return b},NotAllowed:function(a,b,c){var d=.5*ad,e=.5;a=w.s();M(a,.5*b,(.5-e)*c,!0);N(a,(.5-d)*b,(.5-e)*c,(.5-e)*b,(.5-d)*c,(.5-e)*b,.5*c);N(a,(.5-e)*b,(.5+d)*c,(.5-d)*b,(.5+e)*c,.5*b,
(.5+e)*c);N(a,(.5+d)*b,(.5+e)*c,(.5+e)*b,(.5+d)*c,(.5+e)*b,.5*c);N(a,(.5+e)*b,(.5-d)*c,(.5+d)*b,(.5-e)*c,.5*b,(.5-e)*c);var e=.4,d=.4*ad,f=w.K(),h=w.K(),k=w.K(),l=w.K();he(.5,.5-e,.5+d,.5-e,.5+e,.5-d,.5+e,.5,.42,f,h,k,l,l);var m=w.K(),n=w.K(),p=w.K();he(.5,.5-e,.5+d,.5-e,.5+e,.5-d,.5+e,.5,.58,l,l,p,m,n);var q=w.K(),r=w.K(),s=w.K();he(.5,.5+e,.5-d,.5+e,.5-e,.5+d,.5-e,.5,.42,q,r,s,l,l);var u=w.K(),t=w.K(),x=w.K();he(.5,.5+e,.5-d,.5+e,.5-e,.5+d,.5-e,.5,.58,l,l,x,u,t);M(a,x.x*b,x.y*c,!0,!0);N(a,u.x*b,
u.y*c,t.x*b,t.y*c,(.5-e)*b,.5*c);N(a,(.5-e)*b,(.5-d)*c,(.5-d)*b,(.5-e)*c,.5*b,(.5-e)*c);N(a,f.x*b,f.y*c,h.x*b,h.y*c,k.x*b,k.y*c);a.lineTo(x.x*b,x.y*c);O(a);M(a,s.x*b,s.y*c,!0,!0);a.lineTo(p.x*b,p.y*c);N(a,m.x*b,m.y*c,n.x*b,n.y*c,(.5+e)*b,.5*c);N(a,(.5+e)*b,(.5+d)*c,(.5+d)*b,(.5+e)*c,.5*b,(.5+e)*c);N(a,q.x*b,q.y*c,r.x*b,r.y*c,s.x*b,s.y*c);O(a);w.v(f);w.v(h);w.v(k);w.v(l);w.v(m);w.v(n);w.v(p);w.v(q);w.v(r);w.v(s);w.v(u);w.v(t);w.v(x);b=a.o;w.q(a);b.Zd=Kj;return b},Fragile:function(a,b,c){a=w.s();M(a,
0,0,!0);a.lineTo(.25*b,0);a.lineTo(.2*b,.15*c);a.lineTo(.3*b,.25*c);a.lineTo(.29*b,.33*c);a.lineTo(.35*b,.25*c);a.lineTo(.3*b,.15*c);a.lineTo(.4*b,0);a.lineTo(1*b,0);N(a,1*b,.25*c,.75*b,.5*c,.55*b,.5*c);a.lineTo(.55*b,.9*c);a.lineTo(.7*b,.9*c);a.lineTo(.7*b,1*c);a.lineTo(.3*b,1*c);a.lineTo(.3*b,.9*c);a.lineTo(.45*b,.9*c);a.lineTo(.45*b,.5*c);N(a,.25*b,.5*c,0,.25*c,0,0);O(a);b=a.o;b.A=new L(.25,0);b.B=new L(.75,.4);w.q(a);return b},HourGlass:function(a,b,c){a=w.s();M(a,.65*b,.5*c,!0);a.lineTo(1*b,
1*c);a.lineTo(0,1*c);a.lineTo(.35*b,.5*c);a.lineTo(0,0);a.lineTo(1*b,0);O(a);b=a.o;w.q(a);return b},Lightning:function(a,b,c){a=w.s();M(a,0*b,.55*c,!0);a.lineTo(.75*b,0);a.lineTo(.25*b,.45*c);a.lineTo(.9*b,.48*c);a.lineTo(.4*b,1*c);a.lineTo(.65*b,.55*c);O(a);b=a.o;w.q(a);return b},Parallelogram1:function(a,b,c){a=a?a.Cc:NaN;isNaN(a)&&(a=.1);var d=w.s();M(d,a*b,0,!0);d.lineTo(1*b,0);d.lineTo((1-a)*b,1*c);d.lineTo(0,1*c);O(d);b=d.o;b.A=new L(a,0);b.B=new L(1-a,1);w.q(d);return b},Input:"Output",Output:function(a,
b,c){a=w.s();M(a,0,1*c,!0);a.lineTo(.1*b,0);a.lineTo(1*b,0);a.lineTo(.9*b,1*c);O(a);b=a.o;b.A=new L(.1,0);b.B=new L(.9,1);w.q(a);return b},Parallelogram2:function(a,b,c){a=a?a.Cc:NaN;isNaN(a)&&(a=.25);var d=w.s();M(d,a*b,0,!0);d.lineTo(1*b,0);d.lineTo((1-a)*b,1*c);d.lineTo(0,1*c);O(d);b=d.o;b.A=new L(a,0);b.B=new L(1-a,1);w.q(d);return b},ThickCross:function(a,b,c){a=a?a.Cc:NaN;isNaN(a)&&(a=.25);var d=w.s();M(d,(.5-a/2)*b,0,!0);d.lineTo((.5+a/2)*b,0);d.lineTo((.5+a/2)*b,(.5-a/2)*c);d.lineTo(1*b,(.5-
a/2)*c);d.lineTo(1*b,(.5+a/2)*c);d.lineTo((.5+a/2)*b,(.5+a/2)*c);d.lineTo((.5+a/2)*b,1*c);d.lineTo((.5-a/2)*b,1*c);d.lineTo((.5-a/2)*b,(.5+a/2)*c);d.lineTo(0,(.5+a/2)*c);d.lineTo(0,(.5-a/2)*c);d.lineTo((.5-a/2)*b,(.5-a/2)*c);O(d);b=d.o;b.A=new L(.5-a/2,.5-a/2);b.B=new L(.5+a/2,.5+a/2);w.q(d);return b},ThickX:function(a,b,c){a=.25/Math.SQRT2;var d=w.s();M(d,.3*b,0,!0);d.lineTo(.5*b,.2*c);d.lineTo(.7*b,0);d.lineTo(1*b,.3*c);d.lineTo(.8*b,.5*c);d.lineTo(1*b,.7*c);d.lineTo(.7*b,1*c);d.lineTo(.5*b,.8*
c);d.lineTo(.3*b,1*c);d.lineTo(0,.7*c);d.lineTo(.2*b,.5*c);d.lineTo(0,.3*c);O(d);b=d.o;b.A=new L(.5-a,.5-a);b.B=new L(.5+a,.5+a);w.q(d);return b},ThinCross:function(a,b,c){var d=a?a.Cc:NaN;isNaN(d)&&(d=.1);a=w.s();M(a,(.5-d/2)*b,0,!0);a.lineTo((.5+d/2)*b,0);a.lineTo((.5+d/2)*b,(.5-d/2)*c);a.lineTo(1*b,(.5-d/2)*c);a.lineTo(1*b,(.5+d/2)*c);a.lineTo((.5+d/2)*b,(.5+d/2)*c);a.lineTo((.5+d/2)*b,1*c);a.lineTo((.5-d/2)*b,1*c);a.lineTo((.5-d/2)*b,(.5+d/2)*c);a.lineTo(0,(.5+d/2)*c);a.lineTo(0,(.5-d/2)*c);a.lineTo((.5-
d/2)*b,(.5-d/2)*c);O(a);b=a.o;w.q(a);return b},ThinX:function(a,b,c){a=w.s();M(a,.1*b,0,!0);a.lineTo(.5*b,.4*c);a.lineTo(.9*b,0);a.lineTo(1*b,.1*c);a.lineTo(.6*b,.5*c);a.lineTo(1*b,.9*c);a.lineTo(.9*b,1*c);a.lineTo(.5*b,.6*c);a.lineTo(.1*b,1*c);a.lineTo(0,.9*c);a.lineTo(.4*b,.5*c);a.lineTo(0,.1*c);O(a);b=a.o;w.q(a);return b},RightTriangle:function(a,b,c){a=w.s();M(a,0,0,!0);a.lineTo(1*b,1*c);a.lineTo(0,1*c);O(a);b=a.o;b.A=new L(0,.5);b.B=new L(.5,1);w.q(a);return b},RoundedIBeam:function(a,b,c){a=
w.s();M(a,0,0,!0);a.lineTo(1*b,0);N(a,.5*b,.25*c,.5*b,.75*c,1*b,1*c);a.lineTo(0,1*c);N(a,.5*b,.75*c,.5*b,.25*c,0,0);O(a);b=a.o;w.q(a);return b},RoundedRectangle:function(a,b,c){var d=a?a.Cc:NaN;isNaN(d)&&(d=5);d=Math.min(d,b/3);d=Math.min(d,c/3);a=d*ad;var e=w.s();M(e,d,0,!0);e.lineTo(b-d,0);N(e,b-a,0,b,a,b,d);e.lineTo(b,c-d);N(e,b,c-a,b-a,c,b-d,c);e.lineTo(d,c);N(e,a,c,0,c-a,0,c-d);e.lineTo(0,d);N(e,0,a,a,0,d,0);O(e);b=e.o;1<a?(b.A=new L(0,0,a,a),b.B=new L(1,1,-a,-a)):(b.A=vb,b.B=Kb);w.q(e);return b},
Border:function(a,b,c){var d=a?a.Cc:NaN;isNaN(d)&&(d=5);d=Math.min(d,b/3);d=Math.min(d,c/3);a=w.s();M(a,d,0,!0);a.lineTo(b-d,0);N(a,b-0,0,b,0,b,d);a.lineTo(b,c-d);N(a,b,c-0,b-0,c,b-d,c);a.lineTo(d,c);N(a,0,c,0,c-0,0,c-d);a.lineTo(0,d);N(a,0,0,0,0,d,0);O(a);b=a.o;b.A=vb;b.B=Kb;w.q(a);return b},SquareIBeam:function(a,b,c){var d=a?a.Cc:NaN;isNaN(d)&&(d=.2);a=w.s();M(a,0,0,!0);a.lineTo(1*b,0);a.lineTo(1*b,d*c);a.lineTo((.5+d/2)*b,d*c);a.lineTo((.5+d/2)*b,(1-d)*c);a.lineTo(1*b,(1-d)*c);a.lineTo(1*b,1*
c);a.lineTo(0,1*c);a.lineTo(0,(1-d)*c);a.lineTo((.5-d/2)*b,(1-d)*c);a.lineTo((.5-d/2)*b,d*c);a.lineTo(0,d*c);O(a);b=a.o;w.q(a);return b},Trapezoid:function(a,b,c){a=a?a.Cc:NaN;isNaN(a)&&(a=.2);var d=w.s();M(d,a*b,0,!0);d.lineTo((1-a)*b,0);d.lineTo(1*b,1*c);d.lineTo(0,1*c);O(d);b=d.o;b.A=new L(a,0);b.B=new L(1-a,1);w.q(d);return b},ManualLoop:"ManualOperation",ManualOperation:function(a,b,c){var d=a?a.Cc:NaN;isNaN(d)&&(d=0);a=w.s();M(a,d,0,!0);a.lineTo(0,0);a.lineTo(1*b,0);a.lineTo(.9*b,1*c);a.lineTo(.1*
b,1*c);O(a);b=a.o;b.A=new L(.1,0);b.B=new L(.9,1);w.q(a);return b},GenderMale:function(a,b,c){a=w.s();var d=.4*ad,e=.4,f=w.K(),h=w.K(),k=w.K(),l=w.K();M(a,(.5-e)*b,.5*c,!0);N(a,(.5-e)*b,(.5-d)*c,(.5-d)*b,(.5-e)*c,.5*b,(.5-e)*c);he(.5,.5-e,.5+d,.5-e,.5+e,.5-d,.5+e,.5,.44,k,l,h,f,f);N(a,k.x*b,k.y*c,l.x*b,l.y*c,h.x*b,h.y*c);var m=w.xb(h.x,h.y);he(.5,.5-e,.5+d,.5-e,.5+e,.5-d,.5+e,.5,.56,f,f,h,k,l);var n=w.xb(h.x,h.y);a.lineTo((.1*m.x+.855)*b,.1*m.y*c);a.lineTo(.85*b,.1*m.y*c);a.lineTo(.85*b,0);a.lineTo(1*
b,0);a.lineTo(1*b,.15*c);a.lineTo((.1*n.x+.9)*b,.15*c);a.lineTo((.1*n.x+.9)*b,(.1*n.y+.05*.9)*c);a.lineTo(n.x*b,n.y*c);N(a,k.x*b,k.y*c,l.x*b,l.y*c,(.5+e)*b,.5*c);N(a,(.5+e)*b,(.5+d)*c,(.5+d)*b,(.5+e)*c,.5*b,(.5+e)*c);N(a,(.5-d)*b,(.5+e)*c,(.5-e)*b,(.5+d)*c,(.5-e)*b,.5*c);e=.35;d=.35*ad;M(a,.5*b,(.5-e)*c,!0,!0);N(a,(.5-d)*b,(.5-e)*c,(.5-e)*b,(.5-d)*c,(.5-e)*b,.5*c);N(a,(.5-e)*b,(.5+d)*c,(.5-d)*b,(.5+e)*c,.5*b,(.5+e)*c);N(a,(.5+d)*b,(.5+e)*c,(.5+e)*b,(.5+d)*c,(.5+e)*b,.5*c);N(a,(.5+e)*b,(.5-d)*c,(.5+
d)*b,(.5-e)*c,.5*b,(.5-e)*c);M(a,(.5-e)*b,.5*c,!0);w.v(f);w.v(h);w.v(k);w.v(l);w.v(m);w.v(n);b=a.o;b.A=new L(.202,.257);b.B=new L(.692,.839);b.Zd=Kj;w.q(a);return b},GenderFemale:function(a,b,c){a=w.s();var d=.375,e=0,f=-.125,h=4*(Math.SQRT2-1)/3*d;M(a,(.525+e)*b,(.5+d+f)*c,!0);N(a,(.5+h+e)*b,(.5+d+f)*c,(.5+d+e)*b,(.5+h+f)*c,(.5+d+e)*b,(.5+f)*c);N(a,(.5+d+e)*b,(.5-h+f)*c,(.5+h+e)*b,(.5-d+f)*c,(.5+e)*b,(.5-d+f)*c);N(a,(.5-h+e)*b,(.5-d+f)*c,(.5-d+e)*b,(.5-h+f)*c,(.5-d+e)*b,(.5+f)*c);N(a,(.5-d+e)*b,
(.5+h+f)*c,(.5-h+e)*b,(.5+d+f)*c,(.475+e)*b,(.5+d+f)*c);a.lineTo(.475*b,.85*c);a.lineTo(.425*b,.85*c);a.lineTo(.425*b,.9*c);a.lineTo(.475*b,.9*c);a.lineTo(.475*b,1*c);a.lineTo(.525*b,1*c);a.lineTo(.525*b,.9*c);a.lineTo(.575*b,.9*c);a.lineTo(.575*b,.85*c);a.lineTo(.525*b,.85*c);O(a);d=.325;e=0;f=-.125;h=4*(Math.SQRT2-1)/3*d;M(a,(.5+d+e)*b,(.5+f)*c,!0,!0);N(a,(.5+d+e)*b,(.5+h+f)*c,(.5+h+e)*b,(.5+d+f)*c,(.5+e)*b,(.5+d+f)*c);N(a,(.5-h+e)*b,(.5+d+f)*c,(.5-d+e)*b,(.5+h+f)*c,(.5-d+e)*b,(.5+f)*c);N(a,(.5-
d+e)*b,(.5-h+f)*c,(.5-h+e)*b,(.5-d+f)*c,(.5+e)*b,(.5-d+f)*c);N(a,(.5+h+e)*b,(.5-d+f)*c,(.5+d+e)*b,(.5-h+f)*c,(.5+d+e)*b,(.5+f)*c);M(a,(.525+e)*b,(.5+d+f)*c,!0);b=a.o;b.A=new L(.232,.136);b.B=new L(.782,.611);b.Zd=Kj;w.q(a);return b},PlusLine:function(a,b,c){a=w.s();M(a,0,.5*c,!1);a.lineTo(1*b,.5*c);a.moveTo(.5*b,0);a.lineTo(.5*b,1*c);b=a.o;w.q(a);return b},XLine:function(a,b,c){a=w.s();M(a,0,1*c,!1);a.lineTo(1*b,0);a.moveTo(0,0);a.lineTo(1*b,1*c);b=a.o;w.q(a);return b},AsteriskLine:function(a,b,c){a=
w.s();var d=.2/Math.SQRT2;M(a,d*b,(1-d)*c,!1);a.lineTo((1-d)*b,d*c);a.moveTo(d*b,d*c);a.lineTo((1-d)*b,(1-d)*c);a.moveTo(0*b,.5*c);a.lineTo(1*b,.5*c);a.moveTo(.5*b,0*c);a.lineTo(.5*b,1*c);b=a.o;w.q(a);return b},CircleLine:function(a,b,c){var d=.5*ad;a=w.s();M(a,1*b,.5*c,!1);N(a,1*b,(.5+d)*c,(.5+d)*b,1*c,.5*b,1*c);N(a,(.5-d)*b,1*c,0,(.5+d)*c,0,.5*c);N(a,0,(.5-d)*c,(.5-d)*b,0,.5*b,0);N(a,(.5+d)*b,0,1*b,(.5-d)*c,1*b,.5*c);b=a.o;b.A=new L(.146,.146);b.B=new L(.853,.853);b.Zd=Kj;w.q(a);return b},Pie:function(a,
b,c){a=w.s();var d=4*(Math.SQRT2-1)/3*.5;M(a,(.5*Math.SQRT2/2+.5)*b,(.5-.5*Math.SQRT2/2)*c,!0);N(a,.7*b,0*c,.5*b,0*c,.5*b,0*c);N(a,(.5-d+0)*b,0*c,0*b,(.5-d+0)*c,0*b,.5*c);N(a,0*b,(.5+d+0)*c,(.5-d+0)*b,1*c,.5*b,1*c);N(a,(.5+d+0)*b,1*c,1*b,(.5+d+0)*c,1*b,.5*c);a.lineTo(.5*b,.5*c);O(a);b=a.o;w.q(a);return b},PiePiece:function(a,b,c){var d=ad/Math.SQRT2*.5,e=Math.SQRT2/2,f=1-Math.SQRT2/2;a=w.s();M(a,b,c,!0);N(a,b,(1-d)*c,(e+d)*b,(f+d)*c,e*b,f*c);a.lineTo(0,c);O(a);b=a.o;w.q(a);return b},StopSign:function(a,
b,c){a=1/(Math.SQRT2+2);var d=w.s();M(d,a*b,0,!0);d.lineTo((1-a)*b,0);d.lineTo(1*b,a*c);d.lineTo(1*b,(1-a)*c);d.lineTo((1-a)*b,1*c);d.lineTo(a*b,1*c);d.lineTo(0,(1-a)*c);d.lineTo(0,a*c);O(d);b=d.o;b.A=new L(a/2,a/2);b.B=new L(1-a/2,1-a/2);w.q(d);return b},LogicImplies:function(a,b,c){var d=a?a.Cc:NaN;isNaN(d)&&(d=.2);a=w.s();M(a,(1-d)*b,0*c,!1);a.lineTo(1*b,.5*c);a.lineTo((1-d)*b,c);a.moveTo(0,.5*c);a.lineTo(b,.5*c);b=a.o;b.A=vb;b.B=new L(.8,.5);w.q(a);return b},LogicIff:function(a,b,c){var d=a?a.Cc:
NaN;isNaN(d)&&(d=.2);a=w.s();M(a,(1-d)*b,0*c,!1);a.lineTo(1*b,.5*c);a.lineTo((1-d)*b,c);a.moveTo(0,.5*c);a.lineTo(b,.5*c);a.moveTo(d*b,0);a.lineTo(0,.5*c);a.lineTo(d*b,c);b=a.o;b.A=new L(.2,0);b.B=new L(.8,.5);w.q(a);return b},LogicNot:function(a,b,c){a=w.s();M(a,0,0,!1);a.lineTo(1*b,0);a.lineTo(1*b,1*c);b=a.o;w.q(a);return b},LogicAnd:function(a,b,c){a=w.s();M(a,0,1*c,!1);a.lineTo(.5*b,0);a.lineTo(1*b,1*c);b=a.o;b.A=new L(.25,.5);b.B=new L(.75,1);w.q(a);return b},LogicOr:function(a,b,c){a=w.s();
M(a,0,0,!1);a.lineTo(.5*b,1*c);a.lineTo(1*b,0);b=a.o;b.A=new L(.219,0);b.B=new L(.78,.409);w.q(a);return b},LogicXor:function(a,b,c){a=w.s();M(a,.5*b,0,!1);a.lineTo(.5*b,1*c);a.moveTo(0,.5*c);a.lineTo(1*b,.5*c);var d=.5*ad;N(a,1*b,(.5+d)*c,(.5+d)*b,1*c,.5*b,1*c);N(a,(.5-d)*b,1*c,0,(.5+d)*c,0,.5*c);N(a,0,(.5-d)*c,(.5-d)*b,0,.5*b,0);N(a,(.5+d)*b,0,1*b,(.5-d)*c,1*b,.5*c);b=a.o;b.Zd=Kj;w.q(a);return b},LogicTruth:function(a,b,c){a=w.s();M(a,0,0,!1);a.lineTo(1*b,0);a.moveTo(.5*b,0);a.lineTo(.5*b,1*c);
b=a.o;w.q(a);return b},LogicFalsity:function(a,b,c){a=w.s();M(a,0,1*c,!1);a.lineTo(1*b,1*c);a.moveTo(.5*b,1*c);a.lineTo(.5*b,0);b=a.o;w.q(a);return b},LogicThereExists:function(a,b,c){a=w.s();M(a,0,0,!1);a.lineTo(1*b,0);a.lineTo(1*b,.5*c);a.lineTo(0,.5*c);a.moveTo(1*b,.5*c);a.lineTo(1*b,1*c);a.lineTo(0,1*c);b=a.o;w.q(a);return b},LogicForAll:function(a,b,c){a=w.s();M(a,0,0,!1);a.lineTo(.5*b,1*c);a.lineTo(1*b,0);a.moveTo(.25*b,.5*c);a.lineTo(.75*b,.5*c);b=a.o;b.A=new L(.25,0);b.B=new L(.75,.5);w.q(a);
return b},LogicIsDefinedAs:function(a,b,c){a=w.s();M(a,0,0,!1);a.lineTo(b,0);a.moveTo(0,.5*c);a.lineTo(b,.5*c);a.moveTo(0,c);a.lineTo(b,c);b=a.o;b.A=new L(.01,.01);b.B=new L(.99,.49);w.q(a);return b},LogicIntersect:function(a,b,c){var d=.5*ad;a=w.s();M(a,0,1*c,!1);a.lineTo(0,.5*c);N(a,0,(.5-d)*c,(.5-d)*b,0,.5*b,0);N(a,(.5+d)*b,0,1*b,(.5-d)*c,1*b,.5*c);a.lineTo(1*b,1*c);b=a.o;b.A=new L(0,.5);b.B=Kb;w.q(a);return b},LogicUnion:function(a,b,c){var d=.5*ad;a=w.s();M(a,1*b,0,!1);a.lineTo(1*b,.5*c);N(a,
1*b,(.5+d)*c,(.5+d)*b,1*c,.5*b,1*c);N(a,(.5-d)*b,1*c,0,(.5+d)*c,0,.5*c);a.lineTo(0,0);b=a.o;b.A=vb;b.B=new L(1,.5);w.q(a);return b},Arrow:function(a,b,c){var d=a?a.Cc:NaN,e=a?a.vu:NaN;isNaN(d)&&(d=.3);isNaN(e)&&(e=.3);a=w.s();M(a,0,(.5-e/2)*c,!0);a.lineTo((1-d)*b,(.5-e/2)*c);a.lineTo((1-d)*b,0);a.lineTo(1*b,.5*c);a.lineTo((1-d)*b,1*c);a.lineTo((1-d)*b,(.5+e/2)*c);a.lineTo(0,(.5+e/2)*c);O(a);b=a.o;b.A=new L(0,.5-e/2);d=pe(0,.5+e/2,1,.5+e/2,1-d,1,1,.5,w.K());b.B=new L(d.x,d.y);w.v(d);w.q(a);return b},
ISOProcess:"Chevron",Chevron:function(a,b,c){a=w.s();M(a,0,0,!0);a.lineTo(.5*b,0);a.lineTo(1*b,.5*c);a.lineTo(.5*b,1*c);a.lineTo(0,1*c);a.lineTo(.5*b,.5*c);O(a);b=a.o;w.q(a);return b},DoubleArrow:function(a,b,c){a=w.s();M(a,0,0,!0);a.lineTo(.3*b,.214*c);a.lineTo(.3*b,0);a.lineTo(1*b,.5*c);a.lineTo(.3*b,1*c);a.lineTo(.3*b,.786*c);a.lineTo(0,1*c);O(a);M(a,.3*b,.214*c,!1);a.lineTo(.3*b,.786*c);a.$a(!1);b=a.o;w.q(a);return b},DoubleEndArrow:function(a,b,c){a=w.s();M(a,1*b,.5*c,!0);a.lineTo(.7*b,1*c);
a.lineTo(.7*b,.7*c);a.lineTo(.3*b,.7*c);a.lineTo(.3*b,1*c);a.lineTo(0,.5*c);a.lineTo(.3*b,0);a.lineTo(.3*b,.3*c);a.lineTo(.7*b,.3*c);a.lineTo(.7*b,0);O(a);b=a.o;c=pe(0,.5,.3,0,0,.3,.3,.3,w.K());b.A=new L(c.x,c.y);c=pe(.7,1,1,.5,.7,.7,1,.7,c);b.B=new L(c.x,c.y);w.v(c);w.q(a);return b},IBeamArrow:function(a,b,c){a=w.s();M(a,1*b,.5*c,!0);a.lineTo(.7*b,1*c);a.lineTo(.7*b,.7*c);a.lineTo(.2*b,.7*c);a.lineTo(.2*b,1*c);a.lineTo(0,1*c);a.lineTo(0,0);a.lineTo(.2*b,0);a.lineTo(.2*b,.3*c);a.lineTo(.7*b,.3*c);
a.lineTo(.7*b,0);O(a);b=a.o;b.A=new L(0,.3);c=pe(.7,1,1,.5,.7,.7,1,.7,w.K());b.B=new L(c.x,c.y);w.v(c);w.q(a);return b},Pointer:function(a,b,c){a=w.s();M(a,1*b,.5*c,!0);a.lineTo(0,1*c);a.lineTo(.2*b,.5*c);a.lineTo(0,0);O(a);b=a.o;b.A=new L(.2,.35);c=pe(.2,.65,1,.65,0,1,1,.5,w.K());b.B=new L(c.x,c.y);w.v(c);w.q(a);return b},RoundedPointer:function(a,b,c){a=w.s();M(a,1*b,.5*c,!0);a.lineTo(0,1*c);N(a,.5*b,.75*c,.5*b,.25*c,0,0);O(a);b=a.o;b.A=new L(.4,.35);c=pe(.2,.65,1,.65,0,1,1,.5,w.K());b.B=new L(c.x,
c.y);w.v(c);w.q(a);return b},SplitEndArrow:function(a,b,c){a=w.s();M(a,1*b,.5*c,!0);a.lineTo(.7*b,1*c);a.lineTo(.7*b,.7*c);a.lineTo(0,.7*c);a.lineTo(.2*b,.5*c);a.lineTo(0,.3*c);a.lineTo(.7*b,.3*c);a.lineTo(.7*b,0);O(a);b=a.o;b.A=new L(.2,.3);c=pe(.7,1,1,.5,.7,.7,1,.7,w.K());b.B=new L(c.x,c.y);w.v(c);w.q(a);return b},MessageToUser:"SquareArrow",SquareArrow:function(a,b,c){a=w.s();M(a,1*b,.5*c,!0);a.lineTo(.7*b,1*c);a.lineTo(0,1*c);a.lineTo(0,0);a.lineTo(.7*b,0);O(a);b=a.o;b.A=vb;b.B=new L(.7,1);w.q(a);
return b},Cone1:function(a,b,c){var d=.5*ad,e=.1*ad;a=w.s();M(a,0,.9*c,!0);a.lineTo(.5*b,0);a.lineTo(1*b,.9*c);N(a,1*b,(.9+e)*c,(.5+d)*b,1*c,.5*b,1*c);N(a,(.5-d)*b,1*c,0,(.9+e)*c,0,.9*c);O(a);b=a.o;b.A=new L(.25,.5);b.B=new L(.75,.97);w.q(a);return b},Cone2:function(a,b,c){a=w.s();M(a,0,.9*c,!0);N(a,(1-.85/.9)*b,1*c,.85/.9*b,1*c,1*b,.9*c);a.lineTo(.5*b,0);a.lineTo(0,.9*c);O(a);M(a,0,.9*c,!1);N(a,(1-.85/.9)*b,.8*c,.85/.9*b,.8*c,1*b,.9*c);a.$a(!1);b=a.o;b.A=new L(.25,.5);b.B=new L(.75,.82);w.q(a);return b},
Cube1:function(a,b,c){a=w.s();M(a,.5*b,1*c,!0);a.lineTo(1*b,.85*c);a.lineTo(1*b,.15*c);a.lineTo(.5*b,0*c);a.lineTo(0*b,.15*c);a.lineTo(0*b,.85*c);O(a);M(a,.5*b,1*c,!1);a.lineTo(.5*b,.3*c);a.lineTo(0,.15*c);a.moveTo(.5*b,.3*c);a.lineTo(1*b,.15*c);a.$a(!1);b=a.o;b.A=new L(0,.3);b.B=new L(.5,.85);w.q(a);return b},Cube2:function(a,b,c){a=w.s();M(a,0,.3*c,!0);a.lineTo(0*b,1*c);a.lineTo(.7*b,c);a.lineTo(1*b,.7*c);a.lineTo(1*b,0*c);a.lineTo(.3*b,0*c);O(a);M(a,0,.3*c,!1);a.lineTo(.7*b,.3*c);a.lineTo(1*b,
0*c);a.moveTo(.7*b,.3*c);a.lineTo(.7*b,1*c);a.$a(!1);b=a.o;b.A=new L(0,.3);b.B=new L(.7,1);w.q(a);return b},MagneticData:"Cylinder1",Cylinder1:function(a,b,c){var d=.5*ad,e=.1*ad;a=w.s();M(a,0,.1*c,!0);N(a,0,(.1-e)*c,(.5-d)*b,0,.5*b,0);N(a,(.5+d)*b,0,1*b,(.1-e)*c,1*b,.1*c);a.lineTo(b,.9*c);N(a,1*b,(.9+e)*c,(.5+d)*b,1*c,.5*b,1*c);N(a,(.5-d)*b,1*c,0,(.9+e)*c,0,.9*c);a.lineTo(0,.1*c);M(a,0,.1*c,!1);N(a,0,(.1+e)*c,(.5-d)*b,.2*c,.5*b,.2*c);N(a,(.5+d)*b,.2*c,1*b,(.1+e)*c,1*b,.1*c);a.$a(!1);b=a.o;b.A=new L(0,
.2);b.B=new L(1,.9);w.q(a);return b},Cylinder2:function(a,b,c){var d=.5*ad,e=.1*ad;a=w.s();M(a,0,.9*c,!0);a.lineTo(0,.1*c);N(a,0,(.1-e)*c,(.5-d)*b,0,.5*b,0);N(a,(.5+d)*b,0,1*b,(.1-e)*c,1*b,.1*c);a.lineTo(1*b,.9*c);N(a,1*b,(.9+e)*c,(.5+d)*b,1*c,.5*b,1*c);N(a,(.5-d)*b,1*c,0,(.9+e)*c,0,.9*c);M(a,0,.9*c,!1);N(a,0,(.9-e)*c,(.5-d)*b,.8*c,.5*b,.8*c);N(a,(.5+d)*b,.8*c,1*b,(.9-e)*c,1*b,.9*c);a.$a(!1);b=a.o;b.A=new L(0,.1);b.B=new L(1,.8);w.q(a);return b},Cylinder3:function(a,b,c){var d=.1*ad,e=.5*ad;a=w.s();
M(a,.1*b,0,!0);a.lineTo(.9*b,0);N(a,(.9+d)*b,0,1*b,(.5-e)*c,1*b,.5*c);N(a,1*b,(.5+e)*c,(.9+d)*b,1*c,.9*b,1*c);a.lineTo(.1*b,1*c);N(a,(.1-d)*b,1*c,0,(.5+e)*c,0,.5*c);N(a,0,(.5-e)*c,(.1-d)*b,0,.1*b,0);M(a,.1*b,0,!1);N(a,(.1+d)*b,0,.2*b,(.5-e)*c,.2*b,.5*c);N(a,.2*b,(.5+e)*c,(.1+d)*b,1*c,.1*b,1*c);a.$a(!1);b=a.o;b.A=new L(.2,0);b.B=new L(.9,1);w.q(a);return b},DirectData:"Cylinder4",Cylinder4:function(a,b,c){var d=.1*ad,e=.5*ad;a=w.s();M(a,.9*b,0,!0);N(a,(.9+d)*b,0,1*b,(.5-e)*c,1*b,.5*c);N(a,1*b,(.5+
e)*c,(.9+d)*b,1*c,.9*b,1*c);a.lineTo(.1*b,1*c);N(a,(.1-d)*b,1*c,0,(.5+e)*c,0,.5*c);N(a,0,(.5-e)*c,(.1-d)*b,0,.1*b,0);a.lineTo(.9*b,0);M(a,.9*b,0,!1);N(a,(.9-d)*b,0,.8*b,(.5-e)*c,.8*b,.5*c);N(a,.8*b,(.5+e)*c,(.9-d)*b,1*c,.9*b,1*c);a.$a(!1);b=a.o;b.A=new L(.1,0);b.B=new L(.8,1);w.q(a);return b},Prism1:function(a,b,c){a=w.s();M(a,.25*b,.25*c,!0);a.lineTo(.75*b,0);a.lineTo(b,.5*c);a.lineTo(.5*b,c);a.lineTo(0,c);O(a);M(a,.25*b,.25*c,!1);a.lineTo(.5*b,c);a.$a(!1);b=a.o;b.A=new L(.408,.172);b.B=new L(.833,
.662);w.q(a);return b},Prism2:function(a,b,c){a=w.s();M(a,0,.25*c,!0);a.lineTo(.75*b,0);a.lineTo(1*b,.25*c);a.lineTo(.75*b,.75*c);a.lineTo(0,1*c);O(a);M(a,0,c,!1);a.lineTo(.25*b,.5*c);a.lineTo(b,.25*c);a.moveTo(0,.25*c);a.lineTo(.25*b,.5*c);a.$a(!1);b=a.o;b.A=new L(.25,.5);b.B=new L(.75,.75);w.q(a);return b},Pyramid1:function(a,b,c){a=w.s();M(a,.5*b,0,!0);a.lineTo(b,.75*c);a.lineTo(.5*b,1*c);a.lineTo(0,.75*c);O(a);M(a,.5*b,0,!1);a.lineTo(.5*b,1*c);a.$a(!1);b=a.o;b.A=new L(.25,.367);b.B=new L(.75,
.875);w.q(a);return b},Pyramid2:function(a,b,c){a=w.s();M(a,.5*b,0,!0);a.lineTo(b,.85*c);a.lineTo(.5*b,1*c);a.lineTo(0,.85*c);O(a);M(a,.5*b,0,!1);a.lineTo(.5*b,.7*c);a.lineTo(0,.85*c);a.moveTo(.5*b,.7*c);a.lineTo(1*b,.85*c);a.$a(!1);b=a.o;b.A=new L(.25,.367);b.B=new L(.75,.875);w.q(a);return b},Actor:function(a,b,c){var d=.2*ad,e=.1*ad,f=.5,h=.1;a=w.s();M(a,f*b,(h+.1)*c,!0);N(a,(f-d)*b,(h+.1)*c,(f-.2)*b,(h+e)*c,(f-.2)*b,h*c);N(a,(f-.2)*b,(h-e)*c,(f-d)*b,(h-.1)*c,f*b,(h-.1)*c);N(a,(f+d)*b,(h-.1)*c,
(f+.2)*b,(h-e)*c,(f+.2)*b,h*c);N(a,(f+.2)*b,(h+e)*c,(f+d)*b,(h+.1)*c,f*b,(h+.1)*c);d=.05;e=ad*d;M(a,.5*b,.2*c,!0);a.lineTo(.95*b,.2*c);f=.95;h=.25;N(a,(f+e)*b,(h-d)*c,(f+d)*b,(h-e)*c,(f+d)*b,h*c);a.lineTo(1*b,.6*c);a.lineTo(.85*b,.6*c);a.lineTo(.85*b,.35*c);d=.025;e=ad*d;f=.825;h=.35;N(a,(f+d)*b,(h-e)*c,(f+e)*b,(h-d)*c,f*b,(h-d)*c);N(a,(f-e)*b,(h-d)*c,(f-d)*b,(h-e)*c,(f-d)*b,h*c);a.lineTo(.8*b,1*c);a.lineTo(.55*b,1*c);a.lineTo(.55*b,.7*c);d=.05;e=ad*d;f=.5;h=.7;N(a,(f+d)*b,(h-e)*c,(f+e)*b,(h-d)*c,
f*b,(h-d)*c);N(a,(f-e)*b,(h-d)*c,(f-d)*b,(h-e)*c,(f-d)*b,h*c);a.lineTo(.45*b,1*c);a.lineTo(.2*b,1*c);a.lineTo(.2*b,.35*c);d=.025;e=ad*d;f=.175;h=.35;N(a,(f+d)*b,(h-e)*c,(f+e)*b,(h-d)*c,f*b,(h-d)*c);N(a,(f-e)*b,(h-d)*c,(f-d)*b,(h-e)*c,(f-d)*b,h*c);a.lineTo(.15*b,.6*c);a.lineTo(0*b,.6*c);a.lineTo(0*b,.25*c);d=.05;e=ad*d;f=.05;h=.25;N(a,(f-d)*b,(h-e)*c,(f-e)*b,(h-d)*c,f*b,(h-d)*c);a.lineTo(.5*b,.2*c);b=a.o;b.A=new L(.2,.2);b.B=new L(.8,.65);w.q(a);return b},Card:function(a,b,c){a=w.s();M(a,1*b,0*c,!0);
a.lineTo(1*b,1*c);a.lineTo(0*b,1*c);a.lineTo(0*b,.2*c);a.lineTo(.2*b,0*c);O(a);b=a.o;b.A=new L(0,.2);b.B=Kb;w.q(a);return b},Collate:function(a,b,c){a=w.s();M(a,.5*b,.5*c,!0);a.lineTo(0,0);a.lineTo(1*b,0);a.lineTo(.5*b,.5*c);M(a,.5*b,.5*c,!0);a.lineTo(1*b,1*c);a.lineTo(0,1*c);a.lineTo(.5*b,.5*c);b=a.o;b.A=new L(.25,0);b.B=new L(.75,.25);w.q(a);return b},CreateRequest:function(a,b,c){a=a?a.Cc:NaN;isNaN(a)&&(a=.1);var d=w.s();M(d,0,0,!0);d.lineTo(1*b,0);d.lineTo(1*b,1*c);d.lineTo(0,1*c);O(d);M(d,0,
a*c,!1);d.lineTo(1*b,a*c);d.moveTo(0,(1-a)*c);d.lineTo(1*b,(1-a)*c);d.$a(!1);b=d.o;b.A=new L(0,a);b.B=new L(1,1-a);w.q(d);return b},Database:function(a,b,c){a=w.s();var d=.5*ad,e=.1*ad;M(a,1*b,.1*c,!0);a.lineTo(1*b,.9*c);N(a,1*b,(.9+e)*c,(.5+d)*b,1*c,.5*b,1*c);N(a,(.5-d)*b,1*c,0,(.9+e)*c,0,.9*c);a.lineTo(0,.1*c);N(a,0,(.1-e)*c,(.5-d)*b,0,.5*b,0);N(a,(.5+d)*b,0,1*b,(.1-e)*c,1*b,.1*c);M(a,1*b,.1*c,!1);N(a,1*b,(.1+e)*c,(.5+d)*b,.2*c,.5*b,.2*c);N(a,(.5-d)*b,.2*c,0,(.1+e)*c,0,.1*c);a.moveTo(1*b,.2*c);
N(a,1*b,(.2+e)*c,(.5+d)*b,.3*c,.5*b,.3*c);N(a,(.5-d)*b,.3*c,0,(.2+e)*c,0,.2*c);a.moveTo(1*b,.3*c);N(a,1*b,(.3+e)*c,(.5+d)*b,.4*c,.5*b,.4*c);N(a,(.5-d)*b,.4*c,0,(.3+e)*c,0,.3*c);a.$a(!1);b=a.o;b.A=new L(0,.4);b.B=new L(1,.9);w.q(a);return b},StoredData:"DataStorage",DataStorage:function(a,b,c){a=w.s();M(a,0,0,!0);a.lineTo(.75*b,0);N(a,1*b,0,1*b,1*c,.75*b,1*c);a.lineTo(0,1*c);N(a,.25*b,.9*c,.25*b,.1*c,0,0);O(a);b=a.o;b.A=new L(.226,0);b.B=new L(.81,1);w.q(a);return b},DiskStorage:function(a,b,c){a=
w.s();var d=.5*ad,e=.1*ad;M(a,1*b,.1*c,!0);a.lineTo(1*b,.9*c);N(a,1*b,(.9+e)*c,(.5+d)*b,1*c,.5*b,1*c);N(a,(.5-d)*b,1*c,0,(.9+e)*c,0,.9*c);a.lineTo(0,.1*c);N(a,0,(.1-e)*c,(.5-d)*b,0,.5*b,0);N(a,(.5+d)*b,0,1*b,(.1-e)*c,1*b,.1*c);M(a,1*b,.1*c,!1);N(a,1*b,(.1+e)*c,(.5+d)*b,.2*c,.5*b,.2*c);N(a,(.5-d)*b,.2*c,0,(.1+e)*c,0,.1*c);a.moveTo(1*b,.2*c);N(a,1*b,(.2+e)*c,(.5+d)*b,.3*c,.5*b,.3*c);N(a,(.5-d)*b,.3*c,0,(.2+e)*c,0,.2*c);a.$a(!1);b=a.o;b.A=new L(0,.3);b.B=new L(1,.9);w.q(a);return b},Display:function(a,
b,c){a=w.s();M(a,.25*b,0,!0);a.lineTo(.75*b,0);N(a,1*b,0,1*b,1*c,.75*b,1*c);a.lineTo(.25*b,1*c);a.lineTo(0,.5*c);O(a);b=a.o;b.A=new L(.25,0);b.B=new L(.75,1);w.q(a);return b},DividedEvent:function(a,b,c){a=a?a.Cc:NaN;isNaN(a)?a=.2:.15>a&&(a=.15);var d=w.s(),e=.2*ad;M(d,0,.2*c,!0);N(d,0,(.2-e)*c,(.2-e)*b,0,.2*b,0);d.lineTo(.8*b,0);N(d,(.8+e)*b,0,1*b,(.2-e)*c,1*b,.2*c);d.lineTo(1*b,.8*c);N(d,1*b,(.8+e)*c,(.8+e)*b,1*c,.8*b,1*c);d.lineTo(.2*b,1*c);N(d,(.2-e)*b,1*c,0,(.8+e)*c,0,.8*c);d.lineTo(0,.2*c);
M(d,0,a*c,!1);d.lineTo(1*b,a*c);d.$a(!1);b=d.o;b.A=new L(0,a);b.B=new L(1,1-a);w.q(d);return b},DividedProcess:function(a,b,c){a=a?a.Cc:NaN;if(isNaN(a)||.1>a)a=.1;var d=w.s();M(d,0,0,!0);d.lineTo(1*b,0);d.lineTo(1*b,1*c);d.lineTo(0,1*c);O(d);M(d,0,a*c,!1);d.lineTo(1*b,a*c);d.$a(!1);b=d.o;b.A=new L(0,a);b.B=Kb;w.q(d);return b},Document:function(a,b,c){c/=.8;a=w.s();M(a,0,.7*c,!0);a.lineTo(0,0);a.lineTo(1*b,0);a.lineTo(1*b,.7*c);N(a,.5*b,.4*c,.5*b,1*c,0,.7*c);O(a);b=a.o;b.A=vb;b.B=new L(1,.6);w.q(a);
return b},ExternalOrganization:function(a,b,c){a=a?a.Cc:NaN;if(isNaN(a)||.2>a)a=.2;var d=w.s();M(d,0,0,!0);d.lineTo(1*b,0);d.lineTo(1*b,1*c);d.lineTo(0,1*c);O(d);M(d,a*b,0,!1);d.lineTo(0,a*c);d.moveTo(1*b,a*c);d.lineTo((1-a)*b,0);d.moveTo(0,(1-a)*c);d.lineTo(a*b,1*c);d.moveTo((1-a)*b,1*c);d.lineTo(1*b,(1-a)*c);d.$a(!1);b=d.o;b.A=new L(a/2,a/2);b.B=new L(1-a/2,1-a/2);w.q(d);return b},ExternalProcess:function(a,b,c){a=w.s();M(a,.5*b,0,!0);a.lineTo(1*b,.5*c);a.lineTo(.5*b,1*c);a.lineTo(0,.5*c);O(a);
M(a,.1*b,.4*c,!1);a.lineTo(.1*b,.6*c);a.moveTo(.9*b,.6*c);a.lineTo(.9*b,.4*c);a.moveTo(.6*b,.1*c);a.lineTo(.4*b,.1*c);a.moveTo(.4*b,.9*c);a.lineTo(.6*b,.9*c);a.$a(!1);b=a.o;b.A=new L(.25,.25);b.B=new L(.75,.75);w.q(a);return b},File:function(a,b,c){a=w.s();M(a,0,0,!0);a.lineTo(.75*b,0);a.lineTo(1*b,.25*c);a.lineTo(1*b,1*c);a.lineTo(0,1*c);O(a);M(a,.75*b,0,!1);a.lineTo(.75*b,.25*c);a.lineTo(1*b,.25*c);a.$a(!1);b=a.o;b.A=new L(0,.25);b.B=Kb;w.q(a);return b},Interrupt:function(a,b,c){a=w.s();M(a,1*b,
.5*c,!0);a.lineTo(0,1*c);a.lineTo(0,0);a.lineTo(1*b,.5*c);M(a,1*b,.5*c,!1);a.lineTo(1*b,1*c);M(a,1*b,.5*c,!1);a.lineTo(1*b,0);b=a.o;b.A=new L(0,.25);b.B=new L(.5,.75);w.q(a);return b},InternalStorage:function(a,b,c){var d=a?a.Cc:NaN;a=a?a.vu:NaN;isNaN(d)&&(d=.1);isNaN(a)&&(a=.1);var e=w.s();M(e,0,0,!0);e.lineTo(1*b,0);e.lineTo(1*b,1*c);e.lineTo(0,1*c);O(e);M(e,d*b,0,!1);e.lineTo(d*b,1*c);e.moveTo(0,a*c);e.lineTo(1*b,a*c);e.$a(!1);b=e.o;b.A=new L(d,a);b.B=Kb;w.q(e);return b},Junction:function(a,b,
c){a=w.s();var d=1/Math.SQRT2,e=(1-1/Math.SQRT2)/2,f=.5*ad;M(a,1*b,.5*c,!0);N(a,1*b,(.5+f)*c,(.5+f)*b,1*c,.5*b,1*c);N(a,(.5-f)*b,1*c,0,(.5+f)*c,0,.5*c);N(a,0,(.5-f)*c,(.5-f)*b,0,.5*b,0);N(a,(.5+f)*b,0,1*b,(.5-f)*c,1*b,.5*c);M(a,(e+d)*b,(e+d)*c,!1);a.lineTo(e*b,e*c);a.moveTo(e*b,(e+d)*c);a.lineTo((e+d)*b,e*c);a.$a(!1);b=a.o;b.Zd=Kj;w.q(a);return b},LinedDocument:function(a,b,c){c/=.8;a=w.s();M(a,0,.7*c,!0);a.lineTo(0,0);a.lineTo(1*b,0);a.lineTo(1*b,.7*c);N(a,.5*b,.4*c,.5*b,1*c,0,.7*c);O(a);M(a,.1*
b,0,!1);a.lineTo(.1*b,.75*c);a.$a(!1);b=a.o;b.A=new L(.1,0);b.B=new L(1,.6);w.q(a);return b},LoopLimit:function(a,b,c){a=w.s();M(a,0,1*c,!0);a.lineTo(0,.25*c);a.lineTo(.25*b,0);a.lineTo(.75*b,0);a.lineTo(1*b,.25*c);a.lineTo(1*b,1*c);O(a);b=a.o;b.A=new L(0,.25);b.B=Kb;w.q(a);return b},SequentialData:"MagneticTape",MagneticTape:function(a,b,c){a=w.s();var d=.5*ad;M(a,.5*b,1*c,!0);N(a,(.5-d)*b,1*c,0,(.5+d)*c,0,.5*c);N(a,0,(.5-d)*c,(.5-d)*b,0,.5*b,0);N(a,(.5+d)*b,0,1*b,(.5-d)*c,1*b,.5*c);N(a,1*b,(.5+
d)*c,(.5+d)*b,.9*c,.6*b,.9*c);a.lineTo(1*b,.9*c);a.lineTo(1*b,1*c);a.lineTo(.5*b,1*c);b=a.o;b.A=new L(.15,.15);b.B=new L(.85,.8);w.q(a);return b},ManualInput:function(a,b,c){a=w.s();M(a,1*b,0,!0);a.lineTo(1*b,1*c);a.lineTo(0,1*c);a.lineTo(0,.25*c);O(a);b=a.o;b.A=new L(0,.25);b.B=Kb;w.q(a);return b},MessageFromUser:function(a,b,c){a=a?a.Cc:NaN;isNaN(a)&&(a=.7);var d=w.s();M(d,0,0,!0);d.lineTo(1*b,0);d.lineTo(a*b,.5*c);d.lineTo(1*b,1*c);d.lineTo(0,1*c);O(d);b=d.o;b.A=vb;b.B=new L(a,1);w.q(d);return b},
MicroformProcessing:function(a,b,c){a=a?a.Cc:NaN;isNaN(a)&&(a=.25);var d=w.s();M(d,0,0,!0);d.lineTo(.5*b,a*c);d.lineTo(1*b,0);d.lineTo(1*b,1*c);d.lineTo(.5*b,(1-a)*c);d.lineTo(0,1*c);O(d);b=d.o;b.A=new L(0,a);b.B=new L(1,1-a);w.q(d);return b},MicroformRecording:function(a,b,c){a=w.s();M(a,0,0,!0);a.lineTo(.75*b,.25*c);a.lineTo(1*b,.15*c);a.lineTo(1*b,.85*c);a.lineTo(.75*b,.75*c);a.lineTo(0,1*c);O(a);b=a.o;b.A=new L(0,.25);b.B=new L(1,.75);w.q(a);return b},MultiDocument:function(a,b,c){c/=.8;a=w.s();
M(a,b,0,!0);a.lineTo(b,.5*c);N(a,.96*b,.47*c,.93*b,.45*c,.9*b,.44*c);a.lineTo(.9*b,.6*c);N(a,.86*b,.57*c,.83*b,.55*c,.8*b,.54*c);a.lineTo(.8*b,.7*c);N(a,.4*b,.4*c,.4*b,1*c,0,.7*c);a.lineTo(0,.2*c);a.lineTo(.1*b,.2*c);a.lineTo(.1*b,.1*c);a.lineTo(.2*b,.1*c);a.lineTo(.2*b,0);O(a);M(a,.1*b,.2*c,!1);a.lineTo(.8*b,.2*c);a.lineTo(.8*b,.54*c);a.moveTo(.2*b,.1*c);a.lineTo(.9*b,.1*c);a.lineTo(.9*b,.44*c);a.$a(!1);b=a.o;b.A=new L(0,.25);b.B=new L(.8,.77);w.q(a);return b},MultiProcess:function(a,b,c){a=w.s();
M(a,.1*b,.1*c,!0);a.lineTo(.2*b,.1*c);a.lineTo(.2*b,0);a.lineTo(1*b,0);a.lineTo(1*b,.8*c);a.lineTo(.9*b,.8*c);a.lineTo(.9*b,.9*c);a.lineTo(.8*b,.9*c);a.lineTo(.8*b,1*c);a.lineTo(0,1*c);a.lineTo(0,.2*c);a.lineTo(.1*b,.2*c);O(a);M(a,.2*b,.1*c,!1);a.lineTo(.9*b,.1*c);a.lineTo(.9*b,.8*c);a.moveTo(.1*b,.2*c);a.lineTo(.8*b,.2*c);a.lineTo(.8*b,.9*c);a.$a(!1);b=a.o;b.A=new L(0,.2);b.B=new L(.8,1);w.q(a);return b},OfflineStorage:function(a,b,c){a=a?a.Cc:NaN;isNaN(a)&&(a=.1);var d=1-a,e=w.s();M(e,0,0,!0);e.lineTo(1*
b,0);e.lineTo(.5*b,1*c);O(e);M(e,.5*a*b,a*c,!1);e.lineTo((1-.5*a)*b,a*c);e.$a(!1);b=e.o;b.A=new L(d/4+.5*a,a);b.B=new L(3*d/4+.5*a,a+.5*d);w.q(e);return b},OffPageConnector:function(a,b,c){a=w.s();M(a,0,0,!0);a.lineTo(.75*b,0);a.lineTo(1*b,.5*c);a.lineTo(.75*b,1*c);a.lineTo(0,1*c);O(a);b=a.o;b.A=vb;b.B=new L(.75,1);w.q(a);return b},Or:function(a,b,c){a=w.s();var d=.5*ad;M(a,1*b,.5*c,!0);N(a,1*b,(.5+d)*c,(.5+d)*b,1*c,.5*b,1*c);N(a,(.5-d)*b,1*c,0,(.5+d)*c,0,.5*c);N(a,0,(.5-d)*c,(.5-d)*b,0,.5*b,0);N(a,
(.5+d)*b,0,1*b,(.5-d)*c,1*b,.5*c);M(a,1*b,.5*c,!1);a.lineTo(0,.5*c);a.moveTo(.5*b,1*c);a.lineTo(.5*b,0);a.$a(!1);b=a.o;b.Zd=Kj;w.q(a);return b},PaperTape:function(a,b,c){c/=.8;a=w.s();M(a,0,.7*c,!0);a.lineTo(0,.3*c);N(a,.5*b,.6*c,.5*b,0,1*b,.3*c);a.lineTo(1*b,.7*c);N(a,.5*b,.4*c,.5*b,1*c,0,.7*c);O(a);b=a.o;b.A=new L(0,.49);b.B=new L(1,.75);w.q(a);return b},PrimitiveFromCall:function(a,b,c){var d=a?a.Cc:NaN;a=a?a.vu:NaN;isNaN(d)&&(d=.1);isNaN(a)&&(a=.3);var e=w.s();M(e,0,0,!0);e.lineTo(1*b,0);e.lineTo((1-
a)*b,.5*c);e.lineTo(1*b,1*c);e.lineTo(0,1*c);O(e);b=e.o;b.A=new L(d,0);b.B=new L(1-a,1);w.q(e);return b},PrimitiveToCall:function(a,b,c){var d=a?a.Cc:NaN;a=a?a.vu:NaN;isNaN(d)&&(d=.1);isNaN(a)&&(a=.3);var e=w.s();M(e,0,0,!0);e.lineTo((1-a)*b,0);e.lineTo(1*b,.5*c);e.lineTo((1-a)*b,1*c);e.lineTo(0,1*c);O(e);b=e.o;b.A=new L(d,0);b.B=new L(1-a,1);w.q(e);return b},Subroutine:"Procedure",Procedure:function(a,b,c){a=a?a.Cc:NaN;isNaN(a)&&(a=.1);var d=w.s();M(d,0,0,!0);d.lineTo(1*b,0);d.lineTo(1*b,1*c);d.lineTo(0,
1*c);O(d);M(d,(1-a)*b,0,!1);d.lineTo((1-a)*b,1*c);d.moveTo(a*b,0);d.lineTo(a*b,1*c);d.$a(!1);b=d.o;b.A=new L(a,0);b.B=new L(1-a,1);w.q(d);return b},Process:function(a,b,c){a=a?a.Cc:NaN;isNaN(a)&&(a=.1);var d=w.s();M(d,0,0,!0);d.lineTo(1*b,0);d.lineTo(1*b,1*c);d.lineTo(0,1*c);O(d);M(d,a*b,0,!1);d.lineTo(a*b,1*c);d.$a(!1);b=d.o;b.A=new L(a,0);b.B=Kb;w.q(d);return b},Sort:function(a,b,c){a=w.s();M(a,.5*b,0,!0);a.lineTo(1*b,.5*c);a.lineTo(.5*b,1*c);a.lineTo(0,.5*c);O(a);M(a,0,.5*c,!1);a.lineTo(1*b,.5*
c);a.$a(!1);b=a.o;b.A=new L(.25,.25);b.B=new L(.75,.5);w.q(a);return b},Start:function(a,b,c){a=w.s();M(a,.25*b,0,!0);M(a,.25*b,0,!0);a.arcTo(270,180,.75*b,.5*c,.25*b,.5*c);a.arcTo(90,180,.25*b,.5*c,.25*b,.5*c);M(a,.25*b,0,!1);a.lineTo(.25*b,1*c);a.moveTo(.75*b,0);a.lineTo(.75*b,1*c);a.$a(!1);b=a.o;b.A=new L(.25,0);b.B=new L(.75,1);w.q(a);return b},Terminator:function(a,b,c){a=w.s();M(a,.25*b,0,!0);a.arcTo(270,180,.75*b,.5*c,.25*b,.5*c);a.arcTo(90,180,.25*b,.5*c,.25*b,.5*c);b=a.o;b.A=new L(.23,0);
b.B=new L(.77,1);w.q(a);return b},TransmittalTape:function(a,b,c){a=a?a.Cc:NaN;isNaN(a)&&(a=.1);var d=w.s();M(d,0,0,!0);d.lineTo(1*b,0);d.lineTo(1*b,1*c);d.lineTo(.75*b,(1-a)*c);d.lineTo(0,(1-a)*c);O(d);b=d.o;b.A=vb;b.B=new L(1,1-a);w.q(d);return b},AndGate:function(a,b,c){a=w.s();var d=.5*ad;M(a,0,0,!0);a.lineTo(.5*b,0);N(a,(.5+d)*b,0,1*b,(.5-d)*c,1*b,.5*c);N(a,1*b,(.5+d)*c,(.5+d)*b,1*c,.5*b,1*c);a.lineTo(0,1*c);O(a);b=a.o;b.A=vb;b.B=new L(.55,1);w.q(a);return b},Buffer:function(a,b,c){a=w.s();M(a,
0,0,!0);a.lineTo(1*b,.5*c);a.lineTo(0,1*c);O(a);b=a.o;b.A=new L(0,.25);b.B=new L(.5,.75);w.q(a);return b},Clock:function(a,b,c){a=w.s();var d=.5*ad;M(a,1*b,.5*c,!0);N(a,1*b,(.5+d)*c,(.5+d)*b,1*c,.5*b,1*c);N(a,(.5-d)*b,1*c,0,(.5+d)*c,0,.5*c);N(a,0,(.5-d)*c,(.5-d)*b,0,.5*b,0);N(a,(.5+d)*b,0,1*b,(.5-d)*c,1*b,.5*c);M(a,1*b,.5*c,!1);a.lineTo(1*b,.5*c);M(a,.8*b,.75*c,!1);a.lineTo(.8*b,.25*c);a.lineTo(.6*b,.25*c);a.lineTo(.6*b,.75*c);a.lineTo(.4*b,.75*c);a.lineTo(.4*b,.25*c);a.lineTo(.2*b,.25*c);a.lineTo(.2*
b,.75*c);a.$a(!1);b=a.o;b.Zd=Kj;w.q(a);return b},Ground:function(a,b,c){a=w.s();M(a,.5*b,0,!1);a.lineTo(.5*b,.4*c);a.moveTo(.2*b,.6*c);a.lineTo(.8*b,.6*c);a.moveTo(.3*b,.8*c);a.lineTo(.7*b,.8*c);a.moveTo(.4*b,1*c);a.lineTo(.6*b,1*c);b=a.o;w.q(a);return b},Inverter:function(a,b,c){a=w.s();var d=.1*ad;M(a,.8*b,.5*c,!0);a.lineTo(0,1*c);a.lineTo(0,0);a.lineTo(.8*b,.5*c);M(a,1*b,.5*c,!0);N(a,1*b,(.5+d)*c,(.9+d)*b,.6*c,.9*b,.6*c);N(a,(.9-d)*b,.6*c,.8*b,(.5+d)*c,.8*b,.5*c);N(a,.8*b,(.5-d)*c,(.9-d)*b,.4*
c,.9*b,.4*c);N(a,(.9+d)*b,.4*c,1*b,(.5-d)*c,1*b,.5*c);b=a.o;b.A=new L(0,.25);b.B=new L(.4,.75);w.q(a);return b},NandGate:function(a,b,c){a=w.s();var d=.5*ad,e=.4*ad,f=.1*ad;M(a,.8*b,.5*c,!0);N(a,.8*b,(.5+e)*c,(.4+d)*b,1*c,.4*b,1*c);a.lineTo(0,1*c);a.lineTo(0,0);a.lineTo(.4*b,0);N(a,(.4+d)*b,0,.8*b,(.5-e)*c,.8*b,.5*c);M(a,1*b,.5*c,!0);N(a,1*b,(.5+f)*c,(.9+f)*b,.6*c,.9*b,.6*c);N(a,(.9-f)*b,.6*c,.8*b,(.5+f)*c,.8*b,.5*c);N(a,.8*b,(.5-f)*c,(.9-f)*b,.4*c,.9*b,.4*c);N(a,(.9+f)*b,.4*c,1*b,(.5-f)*c,1*b,.5*
c);b=a.o;b.A=new L(0,.05);b.B=new L(.55,.95);w.q(a);return b},NorGate:function(a,b,c){a=w.s();var d=.5,e=ad*d,f=0,h=.5;M(a,.8*b,.5*c,!0);N(a,.7*b,(h+e)*c,(f+e)*b,(h+d)*c,0,1*c);N(a,.25*b,.75*c,.25*b,.25*c,0,0);N(a,(f+e)*b,(h-d)*c,.7*b,(h-e)*c,.8*b,.5*c);d=.1;e=.1*ad;f=.9;h=.5;M(a,(f-d)*b,h*c,!0);N(a,(f-d)*b,(h-e)*c,(f-e)*b,(h-d)*c,f*b,(h-d)*c);N(a,(f+e)*b,(h-d)*c,(f+d)*b,(h-e)*c,(f+d)*b,h*c);N(a,(f+d)*b,(h+e)*c,(f+e)*b,(h+d)*c,f*b,(h+d)*c);N(a,(f-e)*b,(h+d)*c,(f-d)*b,(h+e)*c,(f-d)*b,h*c);b=a.o;b.A=
new L(.2,.25);b.B=new L(.6,.75);w.q(a);return b},OrGate:function(a,b,c){a=w.s();var d=.5*ad;M(a,0,0,!0);N(a,(0+d+d)*b,0*c,.8*b,(.5-d)*c,1*b,.5*c);N(a,.8*b,(.5+d)*c,(0+d+d)*b,1*c,0,1*c);N(a,.25*b,.75*c,.25*b,.25*c,0,0);O(a);b=a.o;b.A=new L(.2,.25);b.B=new L(.75,.75);w.q(a);return b},XnorGate:function(a,b,c){a=w.s();var d=.5,e=ad*d,f=.2,h=.5;M(a,.1*b,0,!1);N(a,.35*b,.25*c,.35*b,.75*c,.1*b,1*c);M(a,.8*b,.5*c,!0);N(a,.7*b,(h+e)*c,(f+e)*b,(h+d)*c,.2*b,1*c);N(a,.45*b,.75*c,.45*b,.25*c,.2*b,0);N(a,(f+e)*
b,(h-d)*c,.7*b,(h-e)*c,.8*b,.5*c);d=.1;e=.1*ad;f=.9;h=.5;M(a,(f-d)*b,h*c,!0);N(a,(f-d)*b,(h-e)*c,(f-e)*b,(h-d)*c,f*b,(h-d)*c);N(a,(f+e)*b,(h-d)*c,(f+d)*b,(h-e)*c,(f+d)*b,h*c);N(a,(f+d)*b,(h+e)*c,(f+e)*b,(h+d)*c,f*b,(h+d)*c);N(a,(f-e)*b,(h+d)*c,(f-d)*b,(h+e)*c,(f-d)*b,h*c);b=a.o;b.A=new L(.4,.25);b.B=new L(.65,.75);w.q(a);return b},XorGate:function(a,b,c){a=w.s();var d=.5*ad;M(a,.1*b,0,!1);N(a,.35*b,.25*c,.35*b,.75*c,.1*b,1*c);M(a,.2*b,0,!0);N(a,(.2+d)*b,0*c,.9*b,(.5-d)*c,1*b,.5*c);N(a,.9*b,(.5+d)*
c,(.2+d)*b,1*c,.2*b,1*c);N(a,.45*b,.75*c,.45*b,.25*c,.2*b,0);O(a);b=a.o;b.A=new L(.4,.25);b.B=new L(.8,.75);w.q(a);return b},Capacitor:function(a,b,c){a=w.s();M(a,0,0,!1);a.lineTo(0,1*c);a.moveTo(1*b,0);a.lineTo(1*b,1*c);b=a.o;w.q(a);return b},Resistor:function(a,b,c){a=w.s();M(a,0,.5*c,!1);a.lineTo(.1*b,0);a.lineTo(.2*b,1*c);a.lineTo(.3*b,0);a.lineTo(.4*b,1*c);a.lineTo(.5*b,0);a.lineTo(.6*b,1*c);a.lineTo(.7*b,.5*c);b=a.o;w.q(a);return b},Inductor:function(a,b,c){a=w.s();var d=.1*ad,e=.1;M(a,(e-.5*
d)*b,c,!1);N(a,(e-d)*b,c,(e-.1)*b,0,(e+.1)*b,0);e=.3;N(a,(e+.1)*b,0,(e+d)*b,c,e*b,c);N(a,(e-d)*b,c,(e-.1)*b,0,(e+.1)*b,0);e=.5;N(a,(e+.1)*b,0,(e+d)*b,c,e*b,c);N(a,(e-d)*b,c,(e-.1)*b,0,(e+.1)*b,0);e=.7;N(a,(e+.1)*b,0,(e+d)*b,c,e*b,c);N(a,(e-d)*b,c,(e-.1)*b,0,(e+.1)*b,0);e=.9;N(a,(e+.1)*b,0,(e+d)*b,c,(e+.5*d)*b,c);b=a.o;w.q(a);return b},ACvoltageSource:function(a,b,c){a=w.s();var d=.5*ad;M(a,0*b,.5*c,!1);N(a,0*b,(.5-d)*c,(.5-d)*b,0*c,.5*b,0*c);N(a,(.5+d)*b,0*c,1*b,(.5-d)*c,1*b,.5*c);N(a,1*b,(.5+d)*
c,(.5+d)*b,1*c,.5*b,1*c);N(a,(.5-d)*b,1*c,0*b,(.5+d)*c,0*b,.5*c);a.moveTo(.1*b,.5*c);N(a,.5*b,0*c,.5*b,1*c,.9*b,.5*c);b=a.o;b.Zd=Kj;w.q(a);return b},DCvoltageSource:function(a,b,c){a=w.s();M(a,0,.75*c,!1);a.lineTo(0,.25*c);a.moveTo(1*b,0);a.lineTo(1*b,1*c);b=a.o;w.q(a);return b},Diode:function(a,b,c){a=w.s();M(a,1*b,0,!1);a.lineTo(1*b,.5*c);a.lineTo(0,1*c);a.lineTo(0,0);a.lineTo(1*b,.5*c);a.lineTo(1*b,1*c);b=a.o;b.A=new L(0,.25);b.B=new L(.5,.75);w.q(a);return b},Wifi:function(a,b,c){var d=b,e=c;
b*=.38;c*=.6;a=w.s();var f=.8*ad,h=.8,k=0,l=.5,d=(d-b)/2,e=(e-c)/2;M(a,k*b+d,(l+h)*c+e,!0);N(a,(k-f)*b+d,(l+h)*c+e,(k-h)*b+d,(l+f)*c+e,(k-h)*b+d,l*c+e);N(a,(k-h)*b+d,(l-f)*c+e,(k-f)*b+d,(l-h)*c+e,k*b+d,(l-h)*c+e);N(a,k*b+d,(l-h)*c+e,(k-h+.5*f)*b+d,(l-f)*c+e,(k-h+.5*f)*b+d,l*c+e);N(a,(k-h+.5*f)*b+d,(l+f)*c+e,k*b+d,(l+h)*c+e,k*b+d,(l+h)*c+e);O(a);f=.4*ad;h=.4;k=.2;l=.5;M(a,k*b+d,(l+h)*c+e,!0);N(a,(k-f)*b+d,(l+h)*c+e,(k-h)*b+d,(l+f)*c+e,(k-h)*b+d,l*c+e);N(a,(k-h)*b+d,(l-f)*c+e,(k-f)*b+d,(l-h)*c+e,k*
b+d,(l-h)*c+e);N(a,k*b+d,(l-h)*c+e,(k-h+.5*f)*b+d,(l-f)*c+e,(k-h+.5*f)*b+d,l*c+e);N(a,(k-h+.5*f)*b+d,(l+f)*c+e,k*b+d,(l+h)*c+e,k*b+d,(l+h)*c+e);O(a);f=.2*ad;h=.2;l=k=.5;M(a,(k-h)*b+d,l*c+e,!0);N(a,(k-h)*b+d,(l-f)*c+e,(k-f)*b+d,(l-h)*c+e,k*b+d,(l-h)*c+e);N(a,(k+f)*b+d,(l-h)*c+e,(k+h)*b+d,(l-f)*c+e,(k+h)*b+d,l*c+e);N(a,(k+h)*b+d,(l+f)*c+e,(k+f)*b+d,(l+h)*c+e,k*b+d,(l+h)*c+e);N(a,(k-f)*b+d,(l+h)*c+e,(k-h)*b+d,(l+f)*c+e,(k-h)*b+d,l*c+e);f=.4*ad;h=.4;k=.8;l=.5;M(a,k*b+d,(l-h)*c+e,!0);N(a,(k+f)*b+d,(l-
h)*c+e,(k+h)*b+d,(l-f)*c+e,(k+h)*b+d,l*c+e);N(a,(k+h)*b+d,(l+f)*c+e,(k+f)*b+d,(l+h)*c+e,k*b+d,(l+h)*c+e);N(a,k*b+d,(l+h)*c+e,(k+h-.5*f)*b+d,(l+f)*c+e,(k+h-.5*f)*b+d,l*c+e);N(a,(k+h-.5*f)*b+d,(l-f)*c+e,k*b+d,(l-h)*c+e,k*b+d,(l-h)*c+e);O(a);f=.8*ad;h=.8;k=1;l=.5;M(a,k*b+d,(l-h)*c+e,!0);N(a,(k+f)*b+d,(l-h)*c+e,(k+h)*b+d,(l-f)*c+e,(k+h)*b+d,l*c+e);N(a,(k+h)*b+d,(l+f)*c+e,(k+f)*b+d,(l+h)*c+e,k*b+d,(l+h)*c+e);N(a,k*b+d,(l+h)*c+e,(k+h-.5*f)*b+d,(l+f)*c+e,(k+h-.5*f)*b+d,l*c+e);N(a,(k+h-.5*f)*b+d,(l-f)*c+
e,k*b+d,(l-h)*c+e,k*b+d,(l-h)*c+e);O(a);b=a.o;w.q(a);return b},Email:function(a,b,c){a=w.s();M(a,0,0,!0);a.lineTo(1*b,0);a.lineTo(1*b,1*c);a.lineTo(0,1*c);a.lineTo(0,0);O(a);M(a,0,0,!1);a.lineTo(.5*b,.6*c);a.lineTo(1*b,0);a.moveTo(0,1*c);a.lineTo(.45*b,.54*c);a.moveTo(1*b,1*c);a.lineTo(.55*b,.54*c);a.$a(!1);b=a.o;w.q(a);return b},Ethernet:function(a,b,c){a=w.s();M(a,.35*b,0,!0);a.lineTo(.65*b,0);a.lineTo(.65*b,.4*c);a.lineTo(.35*b,.4*c);a.lineTo(.35*b,0);O(a);M(a,.1*b,1*c,!0,!0);a.lineTo(.4*b,1*c);
a.lineTo(.4*b,.6*c);a.lineTo(.1*b,.6*c);a.lineTo(.1*b,1*c);O(a);M(a,.6*b,1*c,!0,!0);a.lineTo(.9*b,1*c);a.lineTo(.9*b,.6*c);a.lineTo(.6*b,.6*c);a.lineTo(.6*b,1*c);O(a);M(a,0,.5*c,!1);a.lineTo(1*b,.5*c);a.moveTo(.5*b,.5*c);a.lineTo(.5*b,.4*c);a.moveTo(.75*b,.5*c);a.lineTo(.75*b,.6*c);a.moveTo(.25*b,.5*c);a.lineTo(.25*b,.6*c);a.$a(!1);b=a.o;w.q(a);return b},Power:function(a,b,c){a=w.s();var d=.4*ad,e=.4,f=w.K(),h=w.K(),k=w.K(),l=w.K();he(.5,.5-e,.5+d,.5-e,.5+e,.5-d,.5+e,.5,.5,f,f,h,k,l);var m=w.xb(h.x,
h.y);M(a,h.x*b,h.y*c,!0);N(a,k.x*b,k.y*c,l.x*b,l.y*c,(.5+e)*b,.5*c);N(a,(.5+e)*b,(.5+d)*c,(.5+d)*b,(.5+e)*c,.5*b,(.5+e)*c);N(a,(.5-d)*b,(.5+e)*c,(.5-e)*b,(.5+d)*c,(.5-e)*b,.5*c);he(.5-e,.5,.5-e,.5-d,.5-d,.5-e,.5,.5-e,.5,k,l,h,f,f);N(a,k.x*b,k.y*c,l.x*b,l.y*c,h.x*b,h.y*c);d=.3*ad;e=.3;he(.5-e,.5,.5-e,.5-d,.5-d,.5-e,.5,.5-e,.5,k,l,h,f,f);a.lineTo(h.x*b,h.y*c);N(a,l.x*b,l.y*c,k.x*b,k.y*c,(.5-e)*b,.5*c);N(a,(.5-e)*b,(.5+d)*c,(.5-d)*b,(.5+e)*c,.5*b,(.5+e)*c);N(a,(.5+d)*b,(.5+e)*c,(.5+e)*b,(.5+d)*c,(.5+
e)*b,.5*c);he(.5,.5-e,.5+d,.5-e,.5+e,.5-d,.5+e,.5,.5,f,f,h,k,l);N(a,l.x*b,l.y*c,k.x*b,k.y*c,h.x*b,h.y*c);O(a);M(a,.45*b,0,!0);a.lineTo(.45*b,.5*c);a.lineTo(.55*b,.5*c);a.lineTo(.55*b,0);O(a);w.v(f);w.v(h);w.v(k);w.v(l);w.v(m);b=a.o;b.A=new L(.25,.55);b.B=new L(.75,.8);w.q(a);return b},Fallout:function(a,b,c){a=w.s();var d=.5*ad;M(a,0*b,.5*c,!0);N(a,0*b,(.5-d)*c,(.5-d)*b,0*c,.5*b,0*c);N(a,(.5+d)*b,0*c,1*b,(.5-d)*c,1*b,.5*c);N(a,1*b,(.5+d)*c,(.5+d)*b,1*c,.5*b,1*c);N(a,(.5-d)*b,1*c,0*b,(.5+d)*c,0*b,
.5*c);var e=d=0;M(a,(.3+d)*b,(.8+e)*c,!0,!0);a.lineTo((.5+d)*b,(.5+e)*c);a.lineTo((.1+d)*b,(.5+e)*c);a.lineTo((.3+d)*b,(.8+e)*c);d=.4;e=0;O(a);M(a,(.3+d)*b,(.8+e)*c,!0,!0);a.lineTo((.5+d)*b,(.5+e)*c);a.lineTo((.1+d)*b,(.5+e)*c);a.lineTo((.3+d)*b,(.8+e)*c);d=.2;e=-.3;O(a);M(a,(.3+d)*b,(.8+e)*c,!0,!0);a.lineTo((.5+d)*b,(.5+e)*c);a.lineTo((.1+d)*b,(.5+e)*c);a.lineTo((.3+d)*b,(.8+e)*c);O(a);b=a.o;b.Zd=Kj;w.q(a);return b},IrritationHazard:function(a,b,c){a=w.s();M(a,.2*b,0*c,!0);a.lineTo(.5*b,.3*c);a.lineTo(.8*
b,0*c);a.lineTo(1*b,.2*c);a.lineTo(.7*b,.5*c);a.lineTo(1*b,.8*c);a.lineTo(.8*b,1*c);a.lineTo(.5*b,.7*c);a.lineTo(.2*b,1*c);a.lineTo(0*b,.8*c);a.lineTo(.3*b,.5*c);a.lineTo(0*b,.2*c);O(a);b=a.o;b.A=new L(.3,.3);b.B=new L(.7,.7);w.q(a);return b},ElectricalHazard:function(a,b,c){a=w.s();M(a,.37*b,0*c,!0);a.lineTo(.5*b,.11*c);a.lineTo(.77*b,.04*c);a.lineTo(.33*b,.49*c);a.lineTo(1*b,.37*c);a.lineTo(.63*b,.86*c);a.lineTo(.77*b,.91*c);a.lineTo(.34*b,1*c);a.lineTo(.34*b,.78*c);a.lineTo(.44*b,.8*c);a.lineTo(.65*
b,.56*c);a.lineTo(0*b,.68*c);O(a);b=a.o;w.q(a);return b},FireHazard:function(a,b,c){a=w.s();M(a,.1*b,1*c,!0);N(a,-.25*b,.63*c,.45*b,.44*c,.29*b,0*c);N(a,.48*b,.17*c,.54*b,.35*c,.51*b,.42*c);N(a,.59*b,.29*c,.58*b,.28*c,.59*b,.18*c);N(a,.8*b,.34*c,.88*b,.43*c,.75*b,.6*c);N(a,.87*b,.48*c,.88*b,.43*c,.88*b,.31*c);N(a,1.17*b,.76*c,.82*b,.8*c,.9*b,1*c);O(a);b=a.o;b.A=new L(.05,.645);b.B=new L(.884,.908);w.q(a);return b},BpmnActivityLoop:function(a,b,c){a=w.s();var d=4*(Math.SQRT2-1)/3*.5;M(a,.65*b,1*c,
!1);N(a,(1-d+0)*b,1*c,1*b,(.5+d+0)*c,1*b,.5*c);N(a,1*b,(.5-d+0)*c,(.5+d+0)*b,0*c,.5*b,0*c);N(a,(.5-d+0)*b,0*c,0*b,(.5-d+0)*c,0*b,.5*c);N(a,0*b,(.5+d+0)*c,(.5-d+0)*b,1*c,.35*b,.98*c);a.moveTo(.25*b,.8*c);a.lineTo(.35*b,1*c);a.lineTo(.1*b,1*c);b=a.o;w.q(a);return b},BpmnActivityParallel:function(a,b,c){a=w.s();M(a,0,0,!1);a.lineTo(0,1*c);a.moveTo(.5*b,0);a.lineTo(.5*b,1*c);a.moveTo(1*b,0);a.lineTo(1*b,1*c);b=a.o;w.q(a);return b},BpmnActivitySequential:function(a,b,c){a=w.s();M(a,0,0,!1);a.lineTo(1*
b,0);a.moveTo(0,.5*c);a.lineTo(1*b,.5*c);a.moveTo(0,1*c);a.lineTo(1*b,1*c);b=a.o;w.q(a);return b},BpmnActivityAdHoc:function(a,b,c){a=w.s();M(a,0,0,!1);M(a,1*b,1*c,!1);M(a,0,.5*c,!1);N(a,.2*b,.35*c,.3*b,.35*c,.5*b,.5*c);N(a,.7*b,.65*c,.8*b,.65*c,1*b,.5*c);b=a.o;w.q(a);return b},BpmnActivityCompensation:function(a,b,c){a=w.s();M(a,0,.5*c,!0);a.lineTo(.5*b,0);a.lineTo(.5*b,.5*c);a.lineTo(1*b,1*c);a.lineTo(1*b,0);a.lineTo(.5*b,.5*c);a.lineTo(.5*b,1*c);O(a);b=a.o;w.q(a);return b},BpmnTaskMessage:function(a,
b,c){a=w.s();M(a,0,.2*c,!0);a.lineTo(1*b,.2*c);a.lineTo(1*b,.8*c);a.lineTo(0,.8*c);a.lineTo(0,.8*c);O(a);M(a,0,.2*c,!1);a.lineTo(.5*b,.5*c);a.lineTo(1*b,.2*c);a.$a(!1);b=a.o;w.q(a);return b},BpmnTaskScript:function(a,b,c){a=w.s();M(a,.7*b,1*c,!0);a.lineTo(.3*b,1*c);N(a,.6*b,.5*c,0,.5*c,.3*b,0);a.lineTo(.7*b,0);N(a,.4*b,.5*c,1*b,.5*c,.7*b,1*c);O(a);M(a,.45*b,.73*c,!1);a.lineTo(.7*b,.73*c);a.moveTo(.38*b,.5*c);a.lineTo(.63*b,.5*c);a.moveTo(.31*b,.27*c);a.lineTo(.56*b,.27*c);a.$a(!1);b=a.o;w.q(a);return b},
BpmnTaskUser:function(a,b,c){a=w.s();M(a,0,0,!1);M(a,.335*b,(1-.555)*c,!0);a.lineTo(.335*b,.595*c);a.lineTo(.665*b,.595*c);a.lineTo(.665*b,(1-.555)*c);N(a,.88*b,.46*c,.98*b,.54*c,1*b,.68*c);a.lineTo(1*b,1*c);a.lineTo(0,1*c);a.lineTo(0,.68*c);N(a,.02*b,.54*c,.12*b,.46*c,.335*b,(1-.555)*c);a.lineTo(.365*b,.405*c);var d=.5-.285,e=Math.PI/4,f=4*(1-Math.cos(e))/(3*Math.sin(e)),e=f*d,f=f*d;N(a,(.5-(e+d)/2)*b,(d+(d+f)/2)*c,(.5-d)*b,(d+f)*c,(.5-d)*b,d*c);N(a,(.5-d)*b,(d-f)*c,(.5-e)*b,(d-d)*c,.5*b,(d-d)*c);
N(a,(.5+e)*b,(d-d)*c,(.5+d)*b,(d-f)*c,(.5+d)*b,d*c);N(a,(.5+d)*b,(d+f)*c,(.5+(e+d)/2)*b,(d+(d+f)/2)*c,.635*b,.405*c);a.lineTo(.635*b,.405*c);a.lineTo(.665*b,(1-.555)*c);a.lineTo(.665*b,.595*c);a.lineTo(.335*b,.595*c);M(a,.2*b,1*c,!1);a.lineTo(.2*b,.8*c);M(a,.8*b,1*c,!1);a.lineTo(.8*b,.8*c);b=a.o;w.q(a);return b},BpmnEventConditional:function(a,b,c){a=w.s();M(a,.1*b,0,!0);a.lineTo(.9*b,0);a.lineTo(.9*b,1*c);a.lineTo(.1*b,1*c);O(a);M(a,.2*b,.2*c,!1);a.lineTo(.8*b,.2*c);a.moveTo(.2*b,.4*c);a.lineTo(.8*
b,.4*c);a.moveTo(.2*b,.6*c);a.lineTo(.8*b,.6*c);a.moveTo(.2*b,.8*c);a.lineTo(.8*b,.8*c);a.$a(!1);b=a.o;w.q(a);return b},BpmnEventError:function(a,b,c){a=w.s();M(a,0,1*c,!0);a.lineTo(.33*b,0);a.lineTo(.66*b,.5*c);a.lineTo(1*b,0);a.lineTo(.66*b,1*c);a.lineTo(.33*b,.5*c);O(a);b=a.o;w.q(a);return b},BpmnEventEscalation:function(a,b,c){a=w.s();M(a,0,0,!1);M(a,1*b,1*c,!1);M(a,.1*b,1*c,!0);a.lineTo(.5*b,0);a.lineTo(.9*b,1*c);a.lineTo(.5*b,.5*c);O(a);b=a.o;w.q(a);return b},BpmnEventTimer:function(a,b,c){a=
w.s();var d=.5*ad;M(a,1*b,.5*c,!0);N(a,1*b,(.5+d)*c,(.5+d)*b,1*c,.5*b,1*c);N(a,(.5-d)*b,1*c,0,(.5+d)*c,0,.5*c);N(a,0,(.5-d)*c,(.5-d)*b,0,.5*b,0);N(a,(.5+d)*b,0,1*b,(.5-d)*c,1*b,.5*c);M(a,.5*b,0,!1);a.lineTo(.5*b,.15*c);a.moveTo(.5*b,1*c);a.lineTo(.5*b,.85*c);a.moveTo(0,.5*c);a.lineTo(.15*b,.5*c);a.moveTo(1*b,.5*c);a.lineTo(.85*b,.5*c);a.moveTo(.5*b,.5*c);a.lineTo(.58*b,.1*c);a.moveTo(.5*b,.5*c);a.lineTo(.78*b,.54*c);a.$a(!1);b=a.o;b.Zd=Kj;w.q(a);return b}},Uq;for(Uq in fq)fq[Uq.toLowerCase()]=Uq;
var mq={"":"",Standard:"F1 m 0,0 l 8,4 -8,4 2,-4 z",Backward:"F1 m 8,0 l -2,4 2,4 -8,-4 z",Triangle:"F1 m 0,0 l 8,4.62 -8,4.62 z",BackwardTriangle:"F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z",Boomerang:"F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z",BackwardBoomerang:"F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z",SidewaysV:"m 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z",BackwardV:"m 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z",OpenTriangle:"m 0,0 l 8,4 -8,4",BackwardOpenTriangle:"m 8,0 l -8,4 8,4",OpenTriangleLine:"m 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8",
BackwardOpenTriangleLine:"m 8,0 l  -8,4 8,4 m -8.5,0 l 0,-8",OpenTriangleTop:"m 0,0 l 8,4 m 0,4",BackwardOpenTriangleTop:"m 8,0 l -8,4 m 0,4",OpenTriangleBottom:"m 0,8 l 8,-4",BackwardOpenTriangleBottom:"m 0,4 l 8,4",HalfTriangleTop:"F1 m 0,0 l 0,4 8,0 z m 0,8",BackwardHalfTriangleTop:"F1 m 8,0 l 0,4 -8,0 z m 0,8",HalfTriangleBottom:"F1 m 0,4 l 0,4 8,-4 z",BackwardHalfTriangleBottom:"F1 m 8,4 l 0,4 -8,-4 z",ForwardSemiCircle:"m 4,0 b 270 180 0 4 4",BackwardSemiCircle:"m 4,8 b 90 180 0 -4 4",Feather:"m 0,0 l 3,4 -3,4",
BackwardFeather:"m 3,0 l -3,4 3,4",DoubleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardDoubleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4",TripleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardTripleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4",ForwardSlash:"m 0,8 l 5,-8",BackSlash:"m 0,0 l 5,8",DoubleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8",DoubleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8",TripleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8",
TripleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8",Fork:"m 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4",LineFork:"m 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardLineFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8",CircleFork:"F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3",CircleLineFork:"F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",
BackwardCircleLineFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3",Circle:"F1 m 8,4 b 0 360 -4 0 4 z",Block:"F1 m 0,0 l 0,8 8,0 0,-8 z",StretchedDiamond:"F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z",Diamond:"F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z",Chevron:"F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z",StretchedChevron:"F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z",NormalArrow:"F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z",X:"m 0,0 l 8,8 m 0,-8 l -8,8",TailedNormalArrow:"F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z",
DoubleTriangle:"F1 m 0,0 l 4,4 -4,4 0,-8 z  m 4,0 l 4,4 -4,4 0,-8 z",BigEndArrow:"F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z",ConcaveTailArrow:"F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z",RoundedTriangle:"F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z",SimpleArrow:"F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z",AccelerationArrow:"F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z",BoxArrow:"F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z",
TriangleLine:"F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8",CircleEndedArrow:"F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z",DynamicWidthArrow:"F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z",EquilibriumArrow:"m 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3",FastForward:"F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z",Kite:"F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z",HalfArrowTop:"F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8",HalfArrowBottom:"F1 m 0,8 l 4,-4 4,0 -8,4 z",
OpposingDirectionDoubleArrow:"F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z",PartialDoubleTriangle:"F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z",LineCircle:"F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z",DoubleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",TripleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",CircleLine:"F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8",DiamondCircle:"F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z",PlusCircle:"F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8",
OpenRightTriangleTop:"m 8,0 l 0,4 -8,0 m 0,4",OpenRightTriangleBottom:"m 8,8 l 0,-4 -8,0",Line:"m 0,0 l 0,8",DoubleLine:"m 0,0 l 0,8 m 2,0 l 0,-8",TripleLine:"m 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8",PentagonArrow:"F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z"};
function jq(a){var b=Ud[a];if(void 0===b){var c=a.toLowerCase();if("none"===c)return"None";b=Ud[c];if(void 0===b){var d=null,e;for(e in mq)if(e.toLowerCase()===c){d=e;break}if(null!==d)return a=We(mq[d],!1),Ud[d]=a,c!==d&&(Ud[c]=d),d}}return"string"===typeof b?b:b instanceof Fe?a:null}
function S(a){C.call(this,a);this.N=2408959;this.kl=this.ui="";this.Js=this.Gs=this.Ss=this.Tr=null;this.Us="";this.si=this.Gr=this.Ts=this.Zm=null;this.Is="";this.ip=null;this.Hs=Dd;this.Ks="";this.kp=null;this.Dd="";this.Rv=this.Vq=this.Xk=null;this.Ri=(new z(NaN,NaN)).freeze();this.Yr="";this.nl=null;this.Zr=vb;this.gs=ld;this.$r=md;this.or=null;this.Ur=Vq;this.an=kd;this.$m="gray";this.zg=4;this.VC=-1;this.tt=NaN;this.DG=new A;this.Nm=null;this.bk=NaN}w.La(S,C);w.fa("Part",S);
S.prototype.cloneProtected=function(a){C.prototype.cloneProtected.call(this,a);a.N=this.N&-4097|49152;a.ui=this.ui;a.kl=this.kl;a.Tr=this.Tr;a.Ss=this.Ss;a.Gs=this.Gs;a.Js=this.Js;a.Us=this.Us;a.Ts=this.Ts;a.Gr=this.Gr;a.si=null;a.Is=this.Is;a.Hs=this.Hs.S();a.Ks=this.Ks;a.Dd=this.Dd;a.Vq=this.Vq;a.Ri.assign(this.Ri);a.Yr=this.Yr;a.Zr=this.Zr.S();a.gs=this.gs.S();a.$r=this.$r.S();a.or=this.or;a.Ur=this.Ur;a.an=this.an.S();a.$m=this.$m;a.zg=this.zg;a.tt=this.tt};
S.prototype.ki=function(a){C.prototype.ki.call(this,a);a.Vl();a.Zm=null;a.ip=null;a.kp=null;a.nl=null;a.Nm=null};S.prototype.toString=function(){var a=w.hf(Object.getPrototypeOf(this))+"#"+w.Jd(this);null!==this.data&&(a+="("+Qf(this.data)+")");return a};S.LayoutNone=0;var Hm;S.LayoutAdded=Hm=1;var Qm;S.LayoutRemoved=Qm=2;S.LayoutShown=4;S.LayoutHidden=8;S.LayoutNodeSized=16;var wn;S.LayoutGroupLayout=wn=32;S.LayoutNodeReplaced=64;var Vq;S.LayoutStandard=Vq=Hm|Qm|28|wn|64;S.LayoutAll=16777215;
S.prototype.Tn=function(a,b,c,d,e,f,h){var k=this.g;null!==k&&(a===Of&&"elements"===b?e instanceof C?Im(e,function(a){Km(k,a);Jm(k,a)}):e instanceof tl&&hn(k,e):a===Pf&&"elements"===b&&(e instanceof C?Im(e,function(a){Om(k,a);Nm(k,a)}):e instanceof tl&&jn(k,e)),k.Wc(a,b,c,d,e,f,h))};S.prototype.updateTargetBindings=S.prototype.Hb=function(a){C.prototype.Hb.call(this,a);if(null!==this.data){a=this.wa.n;for(var b=a.length,c=0;c<b;c++){var d=a[c];d instanceof C&&Im(d,function(a){null!==a.data&&a.Hb()})}}};
S.prototype.updateRelationshipsFromData=function(){var a=this.data;if(null!==a){var b=this.g;if(null!==b){var c=b.ba;c instanceof P&&(a=c.yn(a),b=b.OH(a),null===b||b instanceof U)&&(this.Ka=b)}}};w.u(S,{Kw:"adornments"},function(){return null===this.si?va:this.si.qF});S.prototype.findAdornment=S.prototype.Tp=function(a){var b=this.si;return null===b?null:b.ka(a)};
S.prototype.addAdornment=S.prototype.zl=function(a,b){if(null!==b){var c=null,d=this.si;null!==d&&(c=d.ka(a));if(c!==b){if(null!==c){var e=c.g;null!==e&&e.remove(c)}null===d&&(this.si=d=new ka("string",dh));b.ui!==a&&(b.rd=a);d.add(a,b);c=this.g;null!==c&&(c.add(b),b.data=this.data)}}};S.prototype.removeAdornment=S.prototype.Aj=function(a){var b=this.si;if(null!==b){var c=b.ka(a);if(null!==c){var d=c.g;null!==d&&d.remove(c)}b.remove(a);0===b.count&&(this.si=null)}};
S.prototype.clearAdornments=S.prototype.Ct=function(){var a=this.si;if(null!==a){for(var b=w.lb(),a=a.i;a.next();)b.push(a.key);for(var a=b.length,c=0;c<a;c++)this.Aj(b[c]);w.va(b)}};
S.prototype.updateAdornments=function(){var a=this.g;if(null!==a){a:{if(this.eb&&this.tJ){var b=this.Eu;if(!(null!==b&&this.Y.H()&&this.isVisible()&&b.vj()&&b.Y.H()))break a;var c=this.Tp("Selection");if(null===c){c=this.uJ;null===c&&(c=this instanceof W?a.FI:this instanceof U?a.bI:a.YI);if(!(c instanceof dh))break a;fh(c);c=c.copy();null!==c&&(c.qb=b)}if(null!==c){var d=c.placeholder;if(null!==d){var e=b.nj(),f=0;b instanceof X&&(f=b.kb);var h=w.im();h.l((b.Ia.width+f)*e,(b.Ia.height+f)*e);d.Aa=
h;w.zk(h)}c.angle=b.xn();c.type!==aj&&(d=w.K(),c.location=b.Wa(vb,d),w.v(d));this.zl("Selection",c);break a}}this.Aj("Selection")}Wq(this,a);for(a=this.Kw;a.next();)b=a.value,b.Hb(),b.I()}};function Wq(a,b){b.ab.af.each(function(b){b.isEnabled&&b.updateAdornments(a)});b.ab.updateAdornments(a)}w.u(S,{layer:"layer"},function(){return this.Rv});w.u(S,{g:"diagram"},function(){var a=this.Rv;return null!==a?a.g:null});
w.defineProperty(S,{Wf:"layerName"},function(){return this.kl},function(a){var b=this.kl;if(b!==a){w.j(a,"string",S,"layerName");var c=this.g;if(null===c||null!==c.Lt(a)&&!c.Fq)if(this.kl=a,null!==c&&c.qc(),this.h("layerName",b,a),b=this.layer,null!==b&&b.name!==a&&(c=b.g,null!==c&&(a=c.Lt(a),null!==a&&a!==b))){var d=b.jf(-1,this,!0);0<=d&&c.Wc(Pf,"parts",b,this,null,d,!0);b.visible!==a.visible&&this.td(a.visible);d=a.$p(99999999,this,!0);0<=d&&c.Wc(Of,"parts",a,null,this,!0,d);d=this.Dx;if(null!==
d){var e=c.Ua;c.Ua=!0;d(this,b,a);c.Ua=e}}}});w.defineProperty(S,{Dx:"layerChanged"},function(){return this.Tr},function(a){var b=this.Tr;b!==a&&(null!==a&&w.j(a,"function",S,"layerChanged"),this.Tr=a,this.h("layerChanged",b,a))});w.defineProperty(S,{eo:"zOrder"},function(){return this.tt},function(a){var b=this.tt;if(b!==a){w.j(a,"number",S,"zOrder");this.tt=a;var c=this.layer;null!==c&&kl(c,-1,this);this.h("zOrder",b,a);a=this.g;null!==a&&a.na()}});
S.prototype.invalidateAdornments=S.prototype.ce=function(){var a=this.g;null!==a&&(Il(a),0!==(this.N&16384)!==!0&&(this.N|=16384,a.Le()))};function gl(a){0!==(a.N&16384)!==!1&&(a.updateAdornments(),a.N&=-16385)}function Xq(a){if(!1===Am(a)){var b=a.g;null!==b&&(b.qg.add(a),b.Le());Yq(a,!0);a.Ii()}}function Zq(a){a.N|=2097152;if(!1!==Am(a)){var b=a.position,c=a.location;c.H()&&b.H()||$q(a,b,c);var c=a.mc,d=c.copy();c.Ra();c.x=b.x;c.y=b.y;c.freeze();a.Lx(d,c);Yq(a,!1)}}
w.u(S,{Xf:"locationObject"},function(){if(null===this.nl){var a=this.AA;""!==a?(a=this.sd(a),this.nl=null!==a?a:this):this.nl=this instanceof dh?this.type!==aj&&null!==this.placeholder?this.placeholder:this:this}return this.nl.visible?this.nl:this});w.defineProperty(S,{RI:"minLocation"},function(){return this.gs},function(a){var b=this.gs;b.L(a)||(this.gs=a=a.S(),this.h("minLocation",b,a))});
w.defineProperty(S,{KI:"maxLocation"},function(){return this.$r},function(a){var b=this.$r;b.L(a)||(this.$r=a=a.S(),this.h("maxLocation",b,a))});w.defineProperty(S,{AA:"locationObjectName"},function(){return this.Yr},function(a){var b=this.Yr;b!==a&&(this.Yr=a,this.nl=null,Oo(this),this.h("locationObjectName",b,a))});w.defineProperty(S,{zf:"locationSpot"},function(){return this.Zr},function(a){var b=this.Zr;b.L(a)||(this.Zr=a=a.S(),Oo(this),this.h("locationSpot",b,a))});
S.prototype.move=function(a){this.position=a};S.prototype.moveTo=S.prototype.moveTo=function(a,b){var c=w.xb(a,b);this.move(c);w.v(c)};S.prototype.isVisible=function(){if(!this.visible)return!1;var a=this.layer;if(null!==a&&!a.visible)return!1;a=this.g;if(null!==a&&(a=a.Pa,a.kf&&(a=a.Pm.ka(this),null!==a&&a.Ux)))return!0;a=this.Ka;return null===a||a.we&&a.isVisible()?!0:!1};
S.prototype.td=function(a){var b=this.g;a?(this.J(4),this.ce(),null!==b&&b.qg.add(this)):(this.J(8),this.Ct());this.Vl();null!==b&&(b.qc(),b.na())};
S.prototype.findObject=S.prototype.sd=function(a){if(this.name===a)return this;var b=this.Nm;null===b&&(this.Nm=b=new sa);if(void 0!==b[a])return b[a];for(var c=this.wa.n,d=c.length,e=0;e<d;e++){var f=c[e];if(f.name===a)return b[a]=f;if(f instanceof C)if(null===f.Zj&&null===f.sg){if(f=f.sd(a),null!==f)return b[a]=f}else if(fn(f)&&(f=f.wa.first(),null!==f&&f.name===a))return b[a]=f}return b[a]=null};
function ar(a,b,c,d){void 0===d&&(d=new z);c=c.Nd()?Fb:c;var e=b.Ia;d.l(e.width*c.x+c.offsetX,e.height*c.y+c.offsetY);if(null===b||b===a)return d;b.transform.nb(d);for(b=b.O;null!==b&&b!==a;)b.transform.nb(d),b=b.O;a.Qi.nb(d);d.offset(-a.od.x,-a.od.y);return d}S.prototype.ensureBounds=S.prototype.Ze=function(){rk(this,Infinity,Infinity);this.gc()};
function jl(a,b){var c=a.DG,d;isNaN(a.bk)&&(a.bk=Wp(a));d=a.bk;var e=2*d;if(!a.Zl)return c.l(b.x-1-d,b.y-1-d,b.width+2+e,b.height+2+e),c;d=b.x;var e=b.y,f=b.width,h=b.height,k=a.shadowBlur,l=a.yJ,f=f+k,h=h+k;d-=k/2;e-=k/2;0<l.x?f+=l.x:(d+=l.x,f-=l.x);0<l.y?h+=l.y:(e+=l.y,h-=l.y);c.l(d-1,e-1,f+2,h+2);return c}
S.prototype.gc=function(){this.Ii();if(!1===zm(this))Zq(this);else{var a=this.mc,b=w.Df();b.assign(a);a.Ra();var c=fl(this);this.hj(0,0,this.od.width,this.od.height);var d=this.position;$q(this,d,this.location);a.x=d.x;a.y=d.y;a.freeze();this.Lx(b,a);Co(this,!1);b.L(a)?this.Bf(c):!this.de()||K(b.width,a.width)&&K(b.height,a.height)||0<=this.VC&&this.J(16);w.Gb(b);Yq(this,!1)}};
S.prototype.Lx=function(a,b){var c=this.g;if(null!==c){var d=!1;if(!1===c.Uj&&a.H()){var e=c.qe,f=c.padding,h=e.x+f.left,k=e.y+f.top,l=e.width-2*f.right,e=e.height-2*f.bottom;a.x>h&&a.y>k&&a.right<l&&a.bottom<e&&b.x>h&&b.y>k&&b.right<l&&b.bottom<e&&(d=!0)}0!==(this.N&65536)!==!0&&a.L(b)||Lm(this,d,c);c.na();Qa(a,b)||(this instanceof T&&!c.oa.fb&&this.Tf(),this.Vl())}};
w.defineProperty(S,{location:"location"},function(){return this.Ri},function(a){var b=a.x,c=a.y,d=this.Ri,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(a=a.S(),b=a,this instanceof W?b=!1:(this.Ri=b,this.N|=2097152,!1===zm(this)&&(Xq(this),c=this.hb,c.H()&&(e=c.copy(),c.l(c.x+(b.x-d.x),c.y+(b.y-d.y)),br(this,this.g,c,e),this.h("position",e,c))),b=!0),b&&this.h("location",d,a))});g=S.prototype;
g.dB=function(a,b){if(this instanceof W||!a.H())return!1;var c=this.g;if(null!==c&&(br(this,c,a,b),!0===c.oa.fb))return!0;this.hb=a;this.N&=-2097153;c=this.Ri;if(c.H()){var d=c.copy();c.l(c.x+(a.x-b.x),c.y+(a.y-b.y));this.h("location",d,c)}!1===Am(this)&&!1===zm(this)&&(Xq(this),Zq(this));return!0};function br(a,b,c,d){null===b||a instanceof dh||(b=b.Pa,b.oc&&Ck(b,a,"position",d.copy(),c.copy(),!1))}
g.hy=function(a,b){var c=this.Ri,d=this.hb;Am(this)||zm(this)?c.l(NaN,NaN):c.l(c.x+a-d.x,c.y+b-d.y);d.l(a,b);Xq(this)};g.eB=function(){this.N&=-2097153;Xq(this)};
function $q(a,b,c){var d=w.K(),e=a.zf,f=a.Xf;e.Nd()&&w.k("determineOffset: Part's locationSpot must be real: "+e.toString());var h=f.Ia,k=f instanceof X?f.kb:0;d.Hu(0,0,h.width+k,h.height+k,e);if(f!==a)for(d.offset(-k/2,-k/2),f.transform.nb(d),e=f.O;null!==e&&e!==a;)e.transform.nb(d),e=e.O;a.Qi.nb(d);d.offset(-a.od.x,-a.od.y);e=a.g;f=c.H();h=b.H();f&&h?0!==(a.N&2097152)?cr(a,b,c,e,d):dr(a,b,c,e,d):f?cr(a,b,c,e,d):h&&dr(a,b,c,e,d);a.N|=2097152;w.v(d);a.Ii()}
function cr(a,b,c,d,e){var f=b.x,h=b.y;b.l(c.x-e.x,c.y-e.y);null!==d&&(c=d.Pa,(e=c.Vj)||!c.oc||a instanceof dh||Ck(c,a,"position",new z(f,h),b,!1),e||b.x===f&&b.y===h||(c=d.wb,d.wb=!0,a.h("position",new z(f,h),b),d.wb=c))}function dr(a,b,c,d,e){var f=c.copy();c.l(b.x+e.x,b.y+e.y);c.L(f)||null===d||(b=d.wb,d.wb=!0,a.h("location",f,c),d.wb=b)}
function Lm(a,b,c){Eo(a,!1);a instanceof T&&En(c,a);a.layer.Jc||b||c.qc();b=a.mc;var d=c.sb;d.H()?(fl(a)?ab(b,d)||a.Bf(!1):b.Kg(d)&&a.Bf(!0),a.updateAdornments()):c.fl=!0}g.Yl=function(){return!0};
function hl(a,b){var c=a.mc;if(0!==c.width&&0!==c.height&&!isNaN(c.x)&&!isNaN(c.y)&&a.isVisible()){var d=a.transform;null!==a.Zb&&(Ko(a,b,a.Zb,!0,!0),b.fillRect(c.x,c.y,c.width,c.height));null===a.Zb&&null===a.Db&&(Ko(a,b,"rgba(0,0,0,0.4)",!0,!1),b.fillRect(c.x,c.y,c.width,c.height));null!==a.Db&&(d.cu()||b.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy),c=a.Ia,Ko(a,b,a.Db,!0,!1),b.fillRect(0,0,c.width,c.height),d.cu()||(c=1/(d.m11*d.m22-d.m12*d.m21),b.transform(d.m22*c,-d.m12*c,-d.m21*c,d.m11*c,c*(d.m21*
d.dy-d.m22*d.dx),c*(d.m12*d.dx-d.m11*d.dy))))}}g.de=function(){return!0};g.rj=function(){return!0};
w.defineProperty(S,{rd:"category"},function(){return this.ui},function(a){var b=this.ui;if(b!==a){w.j(a,"string",S,"category");var c=this.g,d=this.data,e=null;if(null!==c&&null!==d&&!(this instanceof dh)){var f=c.ba.oa;f.isEnabled&&!f.fb&&(e=this.clone(),e.wa.Hc(this.wa))}this.ui=a;this.h("category",b,a);null===c||null===d||this instanceof dh?(e=this.Nf,null!==e&&(a=e.si,null!==a&&a.remove(b),e.zl(this.rd,this))):(f=c.ba,f.oa.fb||(this instanceof W?(f instanceof P?f.bG(d,a):f instanceof Zf&&f.wJ(d,
a),c=qn(c,a),null!==c&&(fh(c),c=c.copy(),null!==c&&er(this,c,b,a))):(null!==f&&f.by(d,a),c=nn(c,d,a),null!==c&&(fh(c),c=c.copy(),null===c||c instanceof W||(c.location=this.location,er(this,c,b,a)))),null!==e&&(b=this.clone(),b.wa.Hc(this.wa),this.h("self",e,b))))}});w.defineProperty(S,{self:"self"},function(){return this},function(a){er(this,a,this.rd,a.rd)});var fr=!1;
function er(a,b,c,d){b.constructor===a.constructor||fr||(fr=!0,w.trace('Should not change the class of the Part when changing category from "'+c+'" to "'+d+'"'),w.trace("  Old class: "+w.hf(a)+", new class: "+w.hf(b)+", part: "+a.toString()));a.Ct();var e=a.data;c=a.Wf;var f=a.eb,h=a.Lg,k=!0,l=!0,m=!1;if(a instanceof T)var n=a,k=n.uj,l=n.gd,m=n.Ou;b.ki(a);b.cloneProtected(a);a.ui=d;a.I();a.na();b=a.g;d=!0;null!==b&&(d=b.wb,b.wb=!0);a.Vd=e;null!==e&&a.Hb();null!==b&&(b.wb=d);e=a.Wf;e!==c&&(a.kl=c,
a.Wf=e);a instanceof T&&(n=a,n.uj=k,n.gd=l,n.Ou=m,n.de()&&n.J(64));a.eb=f;a.Lg=h}S.prototype.canCopy=function(){if(!this.zH)return!1;var a=this.layer;if(null===a)return!0;if(!a.sk)return!1;a=a.g;return null===a?!0:a.sk?!0:!1};S.prototype.canDelete=function(){if(!this.EH)return!1;var a=this.layer;if(null===a)return!0;if(!a.gn)return!1;a=a.g;return null===a?!0:a.gn?!0:!1};
S.prototype.canEdit=function(){if(!this.FJ)return!1;var a=this.layer;if(null===a)return!0;if(!a.Ow)return!1;a=a.g;return null===a?!0:a.Ow?!0:!1};S.prototype.canGroup=function(){if(!this.cI)return!1;var a=this.layer;if(null===a)return!0;if(!a.Lw)return!1;a=a.g;return null===a?!0:a.Lw?!0:!1};S.prototype.canMove=function(){if(!this.WI)return!1;var a=this.layer;if(null===a)return!0;if(!a.Dl)return!1;a=a.g;return null===a?!0:a.Dl?!0:!1};
S.prototype.canReshape=function(){if(!this.iJ)return!1;var a=this.layer;if(null===a)return!0;if(!a.Mw)return!1;a=a.g;return null===a?!0:a.Mw?!0:!1};S.prototype.canResize=function(){if(!this.jJ)return!1;var a=this.layer;if(null===a)return!0;if(!a.Bt)return!1;a=a.g;return null===a?!0:a.Bt?!0:!1};S.prototype.canRotate=function(){if(!this.mJ)return!1;var a=this.layer;if(null===a)return!0;if(!a.Nw)return!1;a=a.g;return null===a?!0:a.Nw?!0:!1};
S.prototype.canSelect=function(){if(!this.dm)return!1;var a=this.layer;if(null===a)return!0;if(!a.tf)return!1;a=a.g;return null===a?!0:a.tf?!0:!1};w.defineProperty(S,{zH:"copyable"},function(){return 0!==(this.N&1)},function(a){var b=0!==(this.N&1);b!==a&&(this.N^=1,this.h("copyable",b,a))});w.defineProperty(S,{EH:"deletable"},function(){return 0!==(this.N&2)},function(a){var b=0!==(this.N&2);b!==a&&(this.N^=2,this.h("deletable",b,a))});
w.defineProperty(S,{FJ:"textEditable"},function(){return 0!==(this.N&4)},function(a){var b=0!==(this.N&4);b!==a&&(this.N^=4,this.h("textEditable",b,a),this.ce())});w.defineProperty(S,{cI:"groupable"},function(){return 0!==(this.N&8)},function(a){var b=0!==(this.N&8);b!==a&&(this.N^=8,this.h("groupable",b,a))});w.defineProperty(S,{WI:"movable"},function(){return 0!==(this.N&16)},function(a){var b=0!==(this.N&16);b!==a&&(this.N^=16,this.h("movable",b,a))});
w.defineProperty(S,{tJ:"selectionAdorned"},function(){return 0!==(this.N&32)},function(a){var b=0!==(this.N&32);b!==a&&(this.N^=32,this.h("selectionAdorned",b,a),this.ce())});w.defineProperty(S,{xA:"isInDocumentBounds"},function(){return 0!==(this.N&64)},function(a){var b=0!==(this.N&64);if(b!==a){this.N^=64;var c=this.g;null!==c&&c.qc();this.h("isInDocumentBounds",b,a)}});
w.defineProperty(S,{lF:"isLayoutPositioned"},function(){return 0!==(this.N&128)},function(a){var b=0!==(this.N&128);b!==a&&(this.N^=128,this.h("isLayoutPositioned",b,a),this.J(a?4:8))});w.defineProperty(S,{dm:"selectable"},function(){return 0!==(this.N&256)},function(a){var b=0!==(this.N&256);b!==a&&(this.N^=256,this.h("selectable",b,a),this.ce())});
w.defineProperty(S,{iJ:"reshapable"},function(){return 0!==(this.N&512)},function(a){var b=0!==(this.N&512);b!==a&&(this.N^=512,this.h("reshapable",b,a),this.ce())});w.defineProperty(S,{jJ:"resizable"},function(){return 0!==(this.N&1024)},function(a){var b=0!==(this.N&1024);b!==a&&(this.N^=1024,this.h("resizable",b,a),this.ce())});w.defineProperty(S,{mJ:"rotatable"},function(){return 0!==(this.N&2048)},function(a){var b=0!==(this.N&2048);b!==a&&(this.N^=2048,this.h("rotatable",b,a),this.ce())});
w.defineProperty(S,{eb:"isSelected"},function(){return 0!==(this.N&4096)},function(a){var b=0!==(this.N&4096);if(b!==a){var c=this.g;if(!a||this.canSelect()&&!(null!==c&&c.selection.count>=c.LI)){this.N^=4096;var d=!1;if(null!==c){d=c.wb;c.wb=!0;var e=c.selection;e.Ra();a?e.add(this):e.remove(this);e.freeze()}this.h("isSelected",b,a);this.ce();a=this.vJ;null!==a&&a(this);null!==c&&(c.Le(),c.wb=d)}}});
w.defineProperty(S,{Lg:"isHighlighted"},function(){return 0!==(this.N&524288)},function(a){var b=0!==(this.N&524288);if(b!==a){this.N^=524288;var c=this.g;null!==c&&(c=c.Ul,c.Ra(),a?c.add(this):c.remove(this),c.freeze());this.h("isHighlighted",b,a);this.na();a=this.fI;null!==a&&a(this)}});w.defineProperty(S,{Zl:"isShadowed"},function(){return 0!==(this.N&8192)},function(a){var b=0!==(this.N&8192);b!==a&&(this.N^=8192,this.h("isShadowed",b,a),this.na())});function Am(a){return 0!==(a.N&32768)}
function Yq(a,b){a.N=b?a.N|32768:a.N&-32769}function Eo(a,b){a.N=b?a.N|65536:a.N&-65537}function fl(a){return 0!==(a.N&131072)}S.prototype.Bf=function(a){this.N=a?this.N|131072:this.N&-131073};function gr(a,b){a.N=b?a.N|1048576:a.N&-1048577}w.defineProperty(S,{cF:"isAnimated"},function(){return 0!==(this.N&262144)},function(a){var b=0!==(this.N&262144);b!==a&&(this.N^=262144,this.h("isAnimated",b,a))});
w.defineProperty(S,{fI:"highlightedChanged"},function(){return this.Gr},function(a){var b=this.Gr;b!==a&&(null!==a&&w.j(a,"function",S,"highlightedChanged"),this.Gr=a,this.h("highlightedChanged",b,a))});w.defineProperty(S,{ZA:"selectionObjectName"},function(){return this.Us},function(a){var b=this.Us;b!==a&&(this.Us=a,this.Zm=null,this.h("selectionObjectName",b,a))});
w.defineProperty(S,{uJ:"selectionAdornmentTemplate"},function(){return this.Ss},function(a){var b=this.Ss;b!==a&&(this instanceof W&&(a.type=aj),this.Ss=a,this.h("selectionAdornmentTemplate",b,a))});w.u(S,{Eu:"selectionObject"},function(){if(null===this.Zm){var a=this.ZA;null!==a&&""!==a?(a=this.sd(a),this.Zm=null!==a?a:this):this instanceof W?(a=this.path,this.Zm=null!==a?a:this):this.Zm=this}return this.Zm});
w.defineProperty(S,{vJ:"selectionChanged"},function(){return this.Ts},function(a){var b=this.Ts;b!==a&&(null!==a&&w.j(a,"function",S,"selectionChanged"),this.Ts=a,this.h("selectionChanged",b,a))});w.defineProperty(S,{RF:"resizeAdornmentTemplate"},function(){return this.Gs},function(a){var b=this.Gs;b!==a&&(this.Gs=a,this.h("resizeAdornmentTemplate",b,a))});
w.defineProperty(S,{TF:"resizeObjectName"},function(){return this.Is},function(a){var b=this.Is;b!==a&&(this.Is=a,this.ip=null,this.h("resizeObjectName",b,a))});w.u(S,{SF:"resizeObject"},function(){if(null===this.ip){var a=this.TF;null!==a&&""!==a?(a=this.sd(a),this.ip=null!==a?a:this):this.ip=this}return this.ip});w.defineProperty(S,{kJ:"resizeCellSize"},function(){return this.Hs},function(a){var b=this.Hs;b.L(a)||(this.Hs=a=a.S(),this.h("resizeCellSize",b,a))});
w.defineProperty(S,{nJ:"rotateAdornmentTemplate"},function(){return this.Js},function(a){var b=this.Js;b!==a&&(this.Js=a,this.h("rotateAdornmentTemplate",b,a))});w.defineProperty(S,{oJ:"rotateObjectName"},function(){return this.Ks},function(a){var b=this.Ks;b!==a&&(this.Ks=a,this.kp=null,this.h("rotateObjectName",b,a))});w.u(S,{VF:"rotateObject"},function(){if(null===this.kp){var a=this.oJ;null!==a&&""!==a?(a=this.sd(a),this.kp=null!==a?a:this):this.kp=this}return this.kp});
w.defineProperty(S,{text:"text"},function(){return this.Dd},function(a){var b=this.Dd;b!==a&&(this.Dd=a,this.h("text",b,a))});
w.defineProperty(S,{Ka:"containingGroup"},function(){return this.Xk},function(a){if(this.de()){var b=this.Xk;if(b!==a){null===a||this!==a&&!a.mi(this)||(this===a&&w.k("Cannot make a Group a member of itself: "+this.toString()),w.k("Cannot make a Group indirectly contain itself: "+this.toString()+" already contains "+a.toString()));this.J(Qm);var c=this.g;null!==b?hr(b,this):this instanceof U&&null!==c&&c.wl.remove(this);this.Xk=a;null!==a?ir(a,this):this instanceof U&&null!==c&&c.wl.add(this);this.J(Hm);
if(null!==c){var d=this.data,e=c.ba;null!==d&&e instanceof P&&e.bB(d,e.ub(null!==a?a.data:null))}d=this.pE;null!==d&&(e=!0,null!==c&&(e=c.Ua,c.Ua=!0),d(this,b,a),null!==c&&(c.Ua=e));if(this instanceof U)for(c=new J(S),ch(c,this,!0,0,!0),c=c.i;c.next();)if(d=c.value,d instanceof T)for(d=d.fe;d.next();)ln(d.value);if(this instanceof T)for(d=this.fe;d.next();)ln(d.value);this.h("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&kl(b,-1,a))}}else w.k("cannot set the Part.containingGroup of a Link or Adornment")});
g=S.prototype;g.Vl=function(){var a=this.Ka;null!==a&&(a.I(),null!==a.Kb&&a.Kb.I(),a.Tf())};g.na=function(){var a=this.g;null!==a&&!zm(this)&&!Am(this)&&this.isVisible()&&this.mc.H()&&a.na(jl(this,this.mc))};g.I=function(){C.prototype.I.call(this);var a=this.g;null!==a&&(a.qg.add(this),this instanceof T&&null!==this.Lc&&Oo(this.Lc),a.Le(!0))};g.Wt=function(a){a||(a=this.Xk,null!==a&&ir(a,this))};g.Xt=function(a){a||(a=this.Xk,null!==a&&hr(a,this))};
g.tn=function(){var a=this.data;if(null!==a){var b=this.g;null!==b&&(b=b.ba,null!==b&&b.Xx(a))}};w.defineProperty(S,{pE:"containingGroupChanged"},function(){return this.Vq},function(a){var b=this.Vq;b!==a&&(null!==a&&w.j(a,"function",S,"containingGroupChanged"),this.Vq=a,this.h("containingGroupChanged",b,a))});S.prototype.findSubGraphLevel=function(){return jr(this,this)};function jr(a,b){var c=b.Ka;return null!==c?1+jr(a,c):b instanceof T&&(c=b.Lc,null!==c)?jr(a,c):0}
S.prototype.findTopLevelPart=function(){return kr(this,this)};function kr(a,b){var c=b.Ka;return null!==c?kr(a,c):b instanceof T&&(c=b.Lc,null!==c)?kr(a,c):b}w.u(S,{cq:"isTopLevel"},function(){return null!==this.Ka||this instanceof T&&this.lf?!1:!0});S.prototype.isMemberOf=S.prototype.mi=function(a){return a instanceof U?lr(this,this,a):!1};function lr(a,b,c){if(b===c||null===c)return!1;var d=b.Ka;return null===d||d!==c&&!lr(a,d,c)?b instanceof T&&(b=b.Lc,null!==b)?lr(a,b,c):!1:!0}
S.prototype.findCommonContainingGroup=S.prototype.MH=function(a){if(null===a)return null;if(this===a)return this.Ka;for(var b=this;null!==b;)b instanceof U&&gr(b,!0),b=b.Ka;for(var c=null,b=a;null!==b;){if(0!==(b.N&1048576)){c=b;break}b=b.Ka}for(b=this;null!==b;)b instanceof U&&gr(b,!1),b=b.Ka;return c};w.defineProperty(S,{AI:"layoutConditions"},function(){return this.Ur},function(a){var b=this.Ur;b!==a&&(this.Ur=a,this.h("layoutConditions",b,a))});
S.prototype.canLayout=function(){if(!this.lF||!this.isVisible())return!1;var a=this.layer;return null!==a&&a.Jc||this instanceof T&&this.lf?!1:!0};S.prototype.invalidateLayout=S.prototype.J=function(a){void 0===a&&(a=16777215);var b;this.lF&&0!==(a&this.AI)?(b=this.layer,null!==b&&b.Jc||this instanceof T&&this.lf?b=!1:(b=this.g,b=null!==b&&b.oa.fb?!1:!0)):b=!1;if(b)if(b=this.Xk,null!==b){var c=b.Rb;null!==c?c.J():b.J(a)}else a=this.g,null!==a&&(c=a.Rb,null!==c&&c.J())};
function Mm(a){if(!a.isVisible())return!1;a=a.layer;return null!==a&&a.Jc?!1:!0}w.defineProperty(S,{AE:"dragComputation"},function(){return this.or},function(a){var b=this.or;b!==a&&(null!==a&&w.j(a,"function",S,"dragComputation"),this.or=a,this.h("dragComputation",b,a))});w.defineProperty(S,{yJ:"shadowOffset"},function(){return this.an},function(a){var b=this.an;b.L(a)||(this.an=a=a.S(),this.na(),this.h("shadowOffset",b,a))});
w.defineProperty(S,{shadowColor:"shadowColor"},function(){return this.$m},function(a){var b=this.$m;b!==a&&(this.$m=a,this.na(),this.h("shadowColor",b,a))});w.defineProperty(S,{shadowBlur:"shadowBlur"},function(){return this.zg},function(a){var b=this.zg;b!==a&&(this.zg=a,this.na(),this.h("shadowBlur",b,a))});function dh(a){0===arguments.length?S.call(this,Nj):S.call(this,a);this.N&=-257;this.kl="Adornment";this.Dc=null;this.fD=0;this.WD=!1;this.Kb=this.$g=null}w.La(dh,S);w.fa("Adornment",dh);
dh.prototype.toString=function(){var a=this.Nf;return"Adornment("+this.rd+")"+(null!==a?a.toString():"")};dh.prototype.updateRelationshipsFromData=function(){};dh.prototype.lu=function(a){var b=this.qb.U,c=this.qb;if(b instanceof W&&c instanceof X){var d=b.path,c=d.vf;b.lu(a);c=d.vf;a=this.wa.n;b=a.length;for(d=0;d<b;d++){var e=a[d];e.Uf&&e instanceof X&&(e.gb=c)}}};w.u(dh,{placeholder:"placeholder"},function(){return this.Kb});
w.defineProperty(dh,{qb:"adornedObject"},function(){return this.Dc},function(a){var b=this.Nf,c=null;null!==a&&(c=a.U);null===b||null!==a&&b===c||b.Aj(this.rd);this.Dc=a;null!==c&&c.zl(this.rd,this)});w.u(dh,{Nf:"adornedPart"},function(){var a=this.Dc;return null!==a?a.U:null});dh.prototype.Yl=function(){var a=this.Dc;if(null===a)return!0;a=a.U;return null===a||!zm(a)};dh.prototype.de=function(){return!1};w.u(dh,{Ka:"containingGroup"},function(){return null});
dh.prototype.Tn=function(a,b,c,d,e,f,h){if(a===Of&&"elements"===b)if(e instanceof Hj){var k=e;null===this.Kb?this.Kb=k:this.Kb!==k&&w.k("Cannot insert a second Placeholder into the visual tree of an Adornment.")}else e instanceof C&&(k=e.Kt(function(a){return a instanceof Hj}),k instanceof Hj&&(null===this.Kb?this.Kb=k:this.Kb!==k&&w.k("Cannot insert a second Placeholder into the visual tree of an Adornment.")));else a===Pf&&"elements"===b&&null!==this.Kb&&(d===this.Kb?this.Kb=null:d instanceof C&&
this.Kb.Xl(d)&&(this.Kb=null));S.prototype.Tn.call(this,a,b,c,d,e,f,h)};dh.prototype.updateAdornments=function(){};dh.prototype.tn=function(){};function T(a){S.call(this,a);this.xa=13;this.nc=new I(W);this.ot=this.Uo=this.ml=this.Wr=this.Vr=null;this.Oq=jd;this.le=this.Hh=null;this.Cs=mr;this.pk=!1}w.La(T,S);w.fa("Node",T);
T.prototype.cloneProtected=function(a){S.prototype.cloneProtected.call(this,a);a.xa=this.xa;a.xa=this.xa&-17;a.Vr=this.Vr;a.Wr=this.Wr;a.ml=this.ml;a.ot=this.ot;a.Oq=this.Oq.S();a.Cs=this.Cs};T.prototype.ki=function(a){S.prototype.ki.call(this,a);a.Tf();a.Hh=this.Hh;a.le=null};var nr;T.DirectionDefault=nr=w.p(T,"DirectionDefault",0);T.DirectionAbsolute=w.p(T,"DirectionAbsolute",1);var or;T.DirectionRotatedNode=or=w.p(T,"DirectionRotatedNode",2);var uo;
T.DirectionRotatedNodeOrthogonal=uo=w.p(T,"DirectionRotatedNodeOrthogonal",3);T.SpreadingNone=w.p(T,"SpreadingNone",10);var mr;T.SpreadingEvenly=mr=w.p(T,"SpreadingEvenly",11);var pr;T.SpreadingPacked=pr=w.p(T,"SpreadingPacked",12);function qr(a,b){null!==b&&(null===a.Hh&&(a.Hh=new J(ul)),a.Hh.add(b))}
function rr(a,b,c,d){if(null===b||null===a.Hh)return null;for(var e=a.Hh.i;e.next();){var f=e.value;if(f.iq===a&&f.qu===b&&f.Ox===c&&f.Px===d||f.iq===b&&f.qu===a&&f.Ox===d&&f.Px===c)return f}return null}T.prototype.invalidateLinkBundle=function(a,b,c){if(void 0===b||null===b)b="";if(void 0===c||null===c)c="";a=rr(this,a,b,c);null!==a&&a.aq()};
T.prototype.Tn=function(a,b,c,d,e,f,h){a===Of&&"elements"===b?this.le=null:a===Pf&&"elements"===b&&(null===this.g?this.le=null:d instanceof G&&Xo(this,d,function(a,b){Uo(a,b,!0)}));S.prototype.Tn.call(this,a,b,c,d,e,f,h)};T.prototype.invalidateConnectedLinks=T.prototype.Tf=function(a){void 0===a&&(a=null);for(var b=this.fe;b.next();){var c=b.value;null!==a&&a.contains(c)||(sr(this,c.ed),sr(this,c.Sd),c.Xb())}};
function Fo(a,b){for(var c=a.fe;c.next();){var d=c.value;if(d.ed===b||d.Sd===b)sr(a,d.ed),sr(a,d.Sd),d.Xb()}}function sr(a,b){if(null!==b){var c=b.Bs;null!==c&&c.aq();c=a.Ka;null===c||c.we||sr(c,c.Ol(""))}}T.prototype.Yl=function(){return!0};w.defineProperty(T,{bJ:"portSpreading"},function(){return this.Cs},function(a){var b=this.Cs;b!==a&&(this.Cs=a,this.h("portSpreading",b,a),a=this.g,null!==a&&a.oa.fb||this.Tf())});
w.defineProperty(T,{Pz:"avoidable"},function(){return 0!==(this.xa&8)},function(a){var b=0!==(this.xa&8);if(b!==a){this.xa^=8;var c=this.g;null!==c&&En(c,this);this.h("avoidable",b,a)}});w.defineProperty(T,{gH:"avoidableMargin"},function(){return this.Oq},function(a){"number"===typeof a?a=new eb(a):w.G(a,eb,T,"avoidableMargin");var b=this.Oq;if(!b.L(a)){this.Oq=a=a.S();var c=this.g;null!==c&&En(c,this);this.h("avoidableMargin",b,a)}});
T.prototype.getAvoidableRect=function(a){a.set(this.Y);a.Jw(this.gH);return a};T.prototype.findVisibleNode=function(){for(var a=this;null!==a&&!a.isVisible();)a=a.Ka;return a};
T.prototype.isVisible=function(){if(!S.prototype.isVisible.call(this))return!1;var a=!0,b=ql,c=this.g;if(null!==c){a=c.Pa;if(a.kf&&(a=a.Pm.ka(this),null!==a&&a.Ux))return!0;a=c.Od;b=c.sB}if(b===ql){if(c=this.Ql(),null!==c&&!c.gd)return!1}else if(b===Um){if(c=a?this.HE():this.IE(),0<c.count&&c.all(function(a){return!a.gd}))return!1}else if(b===Vm&&(c=a?this.HE():this.IE(),0<c.count&&c.any(function(a){return!a.gd})))return!1;c=this.Lc;return null!==c?c.isVisible():!0};
T.prototype.td=function(a){S.prototype.td.call(this,a);for(var b=this.fe;b.next();)b.value.td(a)};w.u(T,{fe:"linksConnected"},function(){return this.nc.i});T.prototype.findLinksConnected=T.prototype.FE=function(a){void 0===a&&(a=null);if(null===a)return this.nc.i;var b=new ya(this.nc),c=this;b.jq=function(b){return b.W===c&&b.Jg===a||b.$===c&&b.Eh===a};return b};
T.prototype.findLinksOutOf=T.prototype.ix=function(a){void 0===a&&(a=null);var b=new ya(this.nc),c=this;b.jq=function(b){return b.W!==c?!1:null===a?!0:b.Jg===a};return b};T.prototype.findLinksInto=T.prototype.Ig=function(a){void 0===a&&(a=null);var b=new ya(this.nc),c=this;b.jq=function(b){return b.$!==c?!1:null===a?!0:b.Eh===a};return b};
T.prototype.findNodesConnected=T.prototype.GE=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.nc.i;d.next();){var e=d.value;if(e.W===this){if(null===a||e.Jg===a)e=e.$,null!==b?b.add(e):null!==c&&c!==e?(b=new J(T),b.add(c),b.add(e)):c=e}else e.$!==this||null!==a&&e.Eh!==a||(e=e.W,null!==b?b.add(e):null!==c&&c!==e?(b=new J(T),b.add(c),b.add(e)):c=e)}return null!==b?b.i:null!==c?new wa(c):va};
T.prototype.findNodesOutOf=T.prototype.IE=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.nc.i;d.next();){var e=d.value;e.W!==this||null!==a&&e.Jg!==a||(e=e.$,null!==b?b.add(e):null!==c&&c!==e?(b=new J(T),b.add(c),b.add(e)):c=e)}return null!==b?b.i:null!==c?new wa(c):va};
T.prototype.findNodesInto=T.prototype.HE=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.nc.i;d.next();){var e=d.value;e.$!==this||null!==a&&e.Eh!==a||(e=e.W,null!==b?b.add(e):null!==c&&c!==e?(b=new J(T),b.add(c),b.add(e)):c=e)}return null!==b?b.i:null!==c?new wa(c):va};
T.prototype.findLinksBetween=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new ya(this.nc),e=this;d.jq=function(d){return(d.W!==e||d.$!==a||null!==b&&d.Jg!==b||null!==c&&d.Eh!==c)&&(d.W!==a||d.$!==e||null!==c&&d.Jg!==c||null!==b&&d.Eh!==b)?!1:!0};return d};T.prototype.findLinksTo=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new ya(this.nc),e=this;d.jq=function(d){return d.W!==e||d.$!==a||null!==b&&d.Jg!==b||null!==c&&d.Eh===c?!1:!0};return d};
w.defineProperty(T,{CI:"linkConnected"},function(){return this.Vr},function(a){var b=this.Vr;b!==a&&(null!==a&&w.j(a,"function",T,"linkConnected"),this.Vr=a,this.h("linkConnected",b,a))});w.defineProperty(T,{DI:"linkDisconnected"},function(){return this.Wr},function(a){var b=this.Wr;b!==a&&(null!==a&&w.j(a,"function",T,"linkDisconnected"),this.Wr=a,this.h("linkDisconnected",b,a))});
w.defineProperty(T,{Gx:"linkValidation"},function(){return this.ml},function(a){var b=this.ml;b!==a&&(null!==a&&w.j(a,"function",T,"linkValidation"),this.ml=a,this.h("linkValidation",b,a))});
function tr(a,b,c){sr(a,c);if(!a.nc.contains(b)){a.nc.add(b);var d=a.CI;if(null!==d){var e=!0,f=a.g;null!==f&&(e=f.Ua,f.Ua=!0);d(a,b,c);null!==f&&(f.Ua=e)}b.Kc&&(c=b.W,b=b.$,null!==c&&null!==b&&c!==b&&(d=!0,f=a.g,null!==f&&(d=f.Od),a=d?b:c,e=d?c:b,a.pk||(a.pk=e),!e.uj||null!==f&&f.oa.fb||(d?c===e&&(e.uj=!1):b===e&&(e.uj=!1))))}}
function ur(a,b,c){sr(a,c);if(a.nc.remove(b)){var d=a.DI,e=a.g;if(null!==d){var f=!0;null!==e&&(f=e.Ua,e.Ua=!0);d(a,b,c);null!==e&&(e.Ua=f)}b.Kc&&(c=!0,null!==e&&(c=e.Od),a=c?b.$:b.W,b=c?b.W:b.$,null!==a&&(a.pk=!1),null===b||b.uj||(0===b.nc.count?(b.pk=null,null!==e&&e.oa.fb||(b.uj=!0)):xn(b)))}}
function xn(a){a.pk=!1;if(0!==a.nc.count){var b=!0,c=a.g;if(null===c||!c.oa.fb){null!==c&&(b=c.Od);for(c=a.nc.i;c.next();){var d=c.value;if(d.Kc)if(b){if(d.W===a){a.uj=!1;return}}else if(d.$===a){a.uj=!1;return}}a.uj=!0}}}
T.prototype.updateRelationshipsFromData=function(){S.prototype.updateRelationshipsFromData.call(this);var a=this.data;if(null!==a){var b=this.g;if(null!==b){var c=b.ba;c instanceof Zf&&(a=c.An(a),a=b.Ie(a),c=this.Ql(),a!==c&&(c=this.vn(),null!==a?null!==c?b.Od?c.W=a:c.$=a:$m(b,a,this):null!==c&&Pm(b,c,!1)))}}};T.prototype.Wt=function(a){S.prototype.Wt.call(this,a);a||(xn(this),a=this.Uo,null!==a&&vr(a,this))};
T.prototype.Xt=function(a){S.prototype.Xt.call(this,a);a||(a=this.Uo,null!==a&&null!==a.rf&&(a.rf.remove(this),a.I()))};T.prototype.tn=function(){if(0<this.nc.count){var a=this.g;if(null!==a)for(var b=a.ob.zE,c=this.nc.copy().i;c.next();){var d=c.value;b?a.remove(d):(d.W===this&&(d.W=null),d.$===this&&(d.$=null))}}this.Lc=null;S.prototype.tn.call(this)};w.u(T,{lf:"isLinkLabel"},function(){return null!==this.Uo});
w.defineProperty(T,{Lc:"labeledLink"},function(){return this.Uo},function(a){var b=this.Uo;if(b!==a){var c=this.g,d=this.data;if(null!==b&&(null!==b.rf&&(b.rf.remove(this),b.I()),null!==c&&null!==d&&!c.oa.fb)){var e=b.data,f=c.ba;if(null!==e&&f instanceof P){var h=f.ub(d);void 0!==h&&f.gJ(e,h)}}this.Uo=a;null!==a&&(vr(a,this),null===c||null===d||c.oa.fb||(e=a.data,f=c.ba,null!==e&&f instanceof P&&(h=f.ub(d),void 0!==h&&f.cE(e,h))));Oo(this);this.h("labeledLink",b,a)}});
T.prototype.findPort=T.prototype.Ol=function(a){if(null===this.le){if(""===a&&!1===this.Ck)return this;Vo(this)}var b=this.le.ka(a);return null!==b||""!==a&&(b=this.le.ka(""),null!==b)?b:this};w.u(T,{port:"port"},function(){return this.Ol("")});w.u(T,{ports:"ports"},function(){null===this.le&&Vo(this);return this.le.qF});function Vo(a){null===a.le?a.le=new ka("string",G):a.le.clear();Xo(a,a,function(a,c){var d=c.Pd;null!==d&&a.le.add(d,c)});0===a.le.count&&a.le.add("",a)}
function Uo(a,b,c){var d=b.Pd;if(null!==d&&(null!==a.le&&a.le.remove(d),b=a.g,null!==b&&c)){c=null;for(d=a.FE(d);d.next();)a=d.value,null===c&&(c=w.lb()),c.push(a);if(null!==c){for(d=0;d<c.length;d++)a=c[d],b.remove(a);w.va(c)}}}
T.prototype.isInTreeOf=function(a){if(null===a||a===this)return!1;var b=!0,c=this.g;null!==c&&(b=c.Od);c=this;if(b)for(;c!==a;){for(var b=null,d=c.nc.i;d.next();){var e=d.value;if(e.Kc&&(b=e.W,b!==c&&b!==this))break}if(b===this||null===b||b===c)return!1;c=b}else for(;c!==a;){b=null;for(d=c.nc.i;d.next()&&(e=d.value,!e.Kc||(b=e.$,b===c||b===this)););if(b===this||null===b||b===c)return!1;c=b}return!0};
T.prototype.findTreeRoot=function(){var a=!0,b=this.g;null!==b&&(a=b.Od);b=this;if(a)for(;;){for(var a=null,c=b.nc.i;c.next();){var d=c.value;if(d.Kc&&(a=d.W,a!==b&&a!==this))break}if(a===this)return this;if(null===a||a===b)return b;b=a}else for(;;){a=null;for(c=b.nc.i;c.next()&&(d=c.value,!d.Kc||(a=d.$,a===b||a===this)););if(a===this)return this;if(null===a||a===b)return b;b=a}};
T.prototype.findCommonTreeParent=function(a){if(null===a)return null;if(this===a)return this;for(var b=this;null!==b;)gr(b,!0),b=b.Ql();for(var c=null,b=a;null!==b;){if(0!==(b.N&1048576)){c=b;break}b=b.Ql()}for(b=this;null!==b;)gr(b,!1),b=b.Ql();return c};T.prototype.findTreeParentLink=T.prototype.vn=function(){var a=!0,b=this.g;null!==b&&(a=b.Od);b=this.nc.i;if(a)for(;b.next();){if(a=b.value,a.Kc&&a.W!==this)return a}else for(;b.next();)if(a=b.value,a.Kc&&a.$!==this)return a;return null};
T.prototype.findTreeParentNode=T.prototype.Ql=function(){var a=this.pk;if(null===a)return null;if(a instanceof T)return a;var b=!0,a=this.g;null!==a&&(b=a.Od);a=this.nc.i;if(b)for(;a.next();){if(b=a.value,b.Kc&&(b=b.W,b!==this))return this.pk=b}else for(;a.next();)if(b=a.value,b.Kc&&(b=b.$,b!==this))return this.pk=b;return this.pk=null};T.prototype.findTreeParentChain=function(){function a(b,d){if(null!==b){d.add(b);var e=b.vn();null!==e&&(d.add(e),a(b.Ql(),d))}}var b=new J(S);a(this,b);return b};
T.prototype.findTreeLevel=function(){return wr(this,this)};function wr(a,b){var c=b.Ql();return null===c?0:1+wr(a,c)}T.prototype.findTreeChildrenLinks=T.prototype.kx=function(){var a=!0,b=this.g;null!==b&&(a=b.Od);var b=new ya(this.nc),c=this;b.jq=a?function(a){return a.Kc&&a.W===c?!0:!1}:function(a){return a.Kc&&a.$===c?!0:!1};return b};
T.prototype.findTreeChildrenNodes=T.prototype.KE=function(){var a=!0,b=this.g;null!==b&&(a=b.Od);var c=b=null,d=this.nc.i;if(a)for(;d.next();)a=d.value,a.Kc&&a.W===this&&(a=a.$,null!==b?b.add(a):null!==c&&c!==a?(b=new I(T),b.add(c),b.add(a)):c=a);else for(;d.next();)a=d.value,a.Kc&&a.$===this&&(a=a.W,null!==b?b.add(a):null!==c&&c!==a?(b=new I(T),b.add(c),b.add(a)):c=a);return null!==b?b.i:null!==c?new wa(c):va};
T.prototype.findTreeParts=function(a){void 0===a&&(a=Infinity);w.j(a,"number",T,"findTreeParts:level");var b=new J(S);ch(b,this,!1,a,!0);return b};T.prototype.collapseTree=T.prototype.collapseTree=function(a){void 0===a&&(a=1);w.Ed(a,T,"collapseTree:level");1>a&&(a=1);var b=this.g;if(null!==b&&!b.wh){b.wh=!0;var c=new J(T);c.add(this);xr(this,c,b.Od,a,b.Pa,this,b.sB===ql);b.wh=!1}};
function xr(a,b,c,d,e,f,h){if(1<d)for(var k=c?a.ix():a.Ig();k.next();){var l=k.value;l.Kc&&(l=l.mA(a),null===l||l===a||b.contains(l)||(b.add(l),xr(l,b,c,d-1,e,f,h)))}else yr(a,b,c,e,f,h)}function yr(a,b,c,d,e,f){for(var h=e===a?!0:a.gd,k=c?a.ix():a.Ig();k.next();){var l=k.value;l.Kc&&(l=l.mA(a),null===l||l===a||b.contains(l)||(b.add(l),h&&(f&&cl(d,l,e),l.Vl(),l.td(!1)),l.gd&&(l.Ou=l.gd,yr(l,b,c,d,e,f))))}a.gd=!1}
T.prototype.expandTree=T.prototype.expandTree=function(a){void 0===a&&(a=2);w.Ed(a,T,"expandTree:level");2>a&&(a=2);var b=this.g;if(null!==b&&!b.wh){b.wh=!0;var c=new J(T);c.add(this);zr(this,c,b.Od,a,b.Pa,this,b.sB===ql);b.wh=!1}};function zr(a,b,c,d,e,f,h){for(var k=f===a?!1:a.gd,l=c?a.ix():a.Ig();l.next();){var m=l.value;m.Kc&&(k||m.Zg||m.Xb(),m=m.mA(a),null!==m&&m!==a&&!b.contains(m)&&(b.add(m),k||(m.td(!0),m.Vl(),h&&bl(e,m,f)),2<d||m.Ou))&&(m.Ou=!1,zr(m,b,c,d-1,e,f,h))}a.gd=!0}
w.defineProperty(T,{gd:"isTreeExpanded"},function(){return 0!==(this.xa&1)},function(a){var b=0!==(this.xa&1);if(b!==a){this.xa^=1;var c=this.g;this.h("isTreeExpanded",b,a);b=this.MJ;if(null!==b){var d=!0;null!==c&&(d=c.Ua,c.Ua=!0);b(this);null!==c&&(c.Ua=d)}null!==c&&c.oa.fb?this.td(a):a?this.expandTree():this.collapseTree()}});w.defineProperty(T,{Ou:"wasTreeExpanded"},function(){return 0!==(this.xa&2)},function(a){var b=0!==(this.xa&2);b!==a&&(this.xa^=2,this.h("wasTreeExpanded",b,a))});
w.defineProperty(T,{MJ:"treeExpandedChanged"},function(){return this.ot},function(a){var b=this.ot;b!==a&&(null!==a&&w.j(a,"function",T,"treeExpandedChanged"),this.ot=a,this.h("treeExpandedChanged",b,a))});w.defineProperty(T,{uj:"isTreeLeaf"},function(){return 0!==(this.xa&4)},function(a){var b=0!==(this.xa&4);b!==a&&(this.xa^=4,this.h("isTreeLeaf",b,a))});
function W(){S.call(this,aj);this.Vb=8;this.mg=null;this.Nh="";this.Cg=this.xr=null;this.hi="";this.nt=null;this.Gq=dj;this.ar=0;this.dr=dj;this.er=NaN;this.Um=Ar;this.at=.5;this.rf=null;this.ad=(new I(z)).freeze();this.$g=this.oC=this.iC=this.ti=this.Gi=this.gb=this.mw=this.lp=this.Ue=null;this.Cz=new z;this.V=this.GD=this.FD=null}w.La(W,S);w.fa("Link",W);
W.prototype.cloneProtected=function(a){S.prototype.cloneProtected.call(this,a);a.Vb=this.Vb&-113;a.Nh=this.Nh;a.xr=this.xr;a.hi=this.hi;a.nt=this.nt;a.Gq=this.Gq;a.ar=this.ar;a.dr=this.dr;a.er=this.er;a.Um=this.Um;a.at=this.at;null!==this.V&&(a.V=this.V.copy())};W.prototype.ki=function(a){S.prototype.ki.call(this,a);this.Nh=a.Nh;this.hi=a.hi;a.Ue=null;a.Xb();a.ti=this.ti};
W.prototype.fc=function(a){a.De===W?2===(a.value&2)?this.Zx=a:a===sj||a===cj||a===bj?this.Ye=a:a===Br||a===Cr||a===Dr?this.xt=a:a!==Ar&&a!==dj&&w.k("Unknown Link enum value for a Link property: "+a):S.prototype.fc.call(this,a)};var Ar;W.Normal=Ar=w.p(W,"Normal",1);W.Orthogonal=w.p(W,"Orthogonal",2);W.AvoidsNodes=w.p(W,"AvoidsNodes",6);var Er;W.AvoidsNodesStraight=Er=w.p(W,"AvoidsNodesStraight",7);var dj;W.None=dj=w.p(W,"None",0);var sj;W.Bezier=sj=w.p(W,"Bezier",9);var cj;
W.JumpGap=cj=w.p(W,"JumpGap",10);var bj;W.JumpOver=bj=w.p(W,"JumpOver",11);var Br;W.End=Br=w.p(W,"End",17);var Cr;W.Scale=Cr=w.p(W,"Scale",18);var Dr;W.Stretch=Dr=w.p(W,"Stretch",19);var lq;W.OrientAlong=lq=w.p(W,"OrientAlong",21);var Np;W.OrientPlus90=Np=w.p(W,"OrientPlus90",22);var Pp;W.OrientMinus90=Pp=w.p(W,"OrientMinus90",23);var Dq;W.OrientOpposite=Dq=w.p(W,"OrientOpposite",24);var Eq;W.OrientUpright=Eq=w.p(W,"OrientUpright",25);var Op;W.OrientPlus90Upright=Op=w.p(W,"OrientPlus90Upright",26);
var Qp;W.OrientMinus90Upright=Qp=w.p(W,"OrientMinus90Upright",27);var Rp;W.OrientUpright45=Rp=w.p(W,"OrientUpright45",28);g=W.prototype;g.Kd=function(){null===this.V&&(this.V=new to)};g.Yl=function(){var a=this.W;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(zm(a)||Am(a))return!1}a=this.$;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),zm(a)||Am(a))?!1:!0};g.dB=function(){return!1};g.eB=function(){};g.de=function(){return!1};
W.prototype.computeAngle=function(a,b,c){a=0;switch(b){default:case dj:a=0;break;case lq:a=c;break;case Np:a=c+90;break;case Pp:a=c-90;break;case Dq:a=c+180;break;case Eq:a=Be(c);90<a&&270>a&&(a-=180);break;case Op:a=Be(c+90);90<a&&270>a&&(a-=180);break;case Qp:a=Be(c-90);90<a&&270>a&&(a-=180);break;case Rp:a=Be(c);if(45<a&&135>a||225<a&&315>a)return 0;90<a&&270>a&&(a-=180)}return Be(a)};
w.defineProperty(W,{W:"fromNode"},function(){return this.mg},function(a){var b=this.mg;if(b!==a){var c=this.ed;null!==b&&(this.Cg!==b&&ur(b,this,c),Fr(this),this.J(Qm));this.mg=a;null!==a&&this.td(a.isVisible());this.Gi=null;this.Xb();var d=this.g;if(null!==d){var e=this.data,f=d.ba;if(null!==e)if(f instanceof P){var h=null!==a?a.data:null;f.$A(e,f.ub(h))}else f instanceof Zf&&(h=null!==a?a.data:null,d.Od?f.oi(e,f.ub(h)):(null!==b&&f.oi(b.data,void 0),f.oi(h,f.ub(null!==this.Cg?this.Cg.data:null))))}e=
this.ed;f=this.NE;null!==f&&(h=!0,null!==d&&(h=d.Ua,d.Ua=!0),f(this,c,e),null!==d&&(d.Ua=h));null!==a&&(this.Cg!==a&&tr(a,this,e),Gr(this),this.J(Hm));this.h("fromNode",b,a);ln(this)}});
w.defineProperty(W,{Jg:"fromPortId"},function(){return this.Nh},function(a){var b=this.Nh;if(b!==a){var c=this.ed;null!==c&&sr(this.W,c);Fr(this);this.Nh=a;var d=this.ed;null!==d&&sr(this.W,d);var e=this.g;if(null!==e){var f=this.data,h=e.ba;null!==f&&h instanceof P&&h.aB(f,a)}c!==d&&(this.Gi=null,this.Xb(),f=this.NE,null!==f&&(h=!0,null!==e&&(h=e.Ua,e.Ua=!0),f(this,c,d),null!==e&&(e.Ua=h)));Gr(this);this.h("fromPortId",b,a)}});w.u(W,{ed:"fromPort"},function(){var a=this.mg;return null===a?null:a.Ol(this.Nh)});
w.defineProperty(W,{NE:"fromPortChanged"},function(){return this.xr},function(a){var b=this.xr;b!==a&&(null!==a&&w.j(a,"function",W,"fromPortChanged"),this.xr=a,this.h("fromPortChanged",b,a))});
w.defineProperty(W,{$:"toNode"},function(){return this.Cg},function(a){var b=this.Cg;if(b!==a){var c=this.Sd;null!==b&&(this.mg!==b&&ur(b,this,c),Fr(this),this.J(Qm));this.Cg=a;null!==a&&this.td(a.isVisible());this.Gi=null;this.Xb();var d=this.g;if(null!==d){var e=this.data,f=d.ba;if(null!==e)if(f instanceof P){var h=null!==a?a.data:null;f.fB(e,f.ub(h))}else f instanceof Zf&&(h=null!==a?a.data:null,d.Od?(null!==b&&f.oi(b.data,void 0),f.oi(h,f.ub(null!==this.mg?this.mg.data:null))):f.oi(e,f.ub(h)))}e=
this.Sd;f=this.nG;null!==f&&(h=!0,null!==d&&(h=d.Ua,d.Ua=!0),f(this,c,e),null!==d&&(d.Ua=h));null!==a&&(this.mg!==a&&tr(a,this,e),Gr(this),this.J(Hm));this.h("toNode",b,a);ln(this)}});
w.defineProperty(W,{Eh:"toPortId"},function(){return this.hi},function(a){var b=this.hi;if(b!==a){var c=this.Sd;null!==c&&sr(this.$,c);Fr(this);this.hi=a;var d=this.Sd;null!==d&&sr(this.$,d);var e=this.g;if(null!==e){var f=this.data,h=e.ba;null!==f&&h instanceof P&&h.gB(f,a)}c!==d&&(this.Gi=null,this.Xb(),f=this.nG,null!==f&&(h=!0,null!==e&&(h=e.Ua,e.Ua=!0),f(this,c,d),null!==e&&(e.Ua=h)));Gr(this);this.h("toPortId",b,a)}});w.u(W,{Sd:"toPort"},function(){var a=this.Cg;return null===a?null:a.Ol(this.hi)});
w.defineProperty(W,{nG:"toPortChanged"},function(){return this.nt},function(a){var b=this.nt;b!==a&&(null!==a&&w.j(a,"function",W,"toPortChanged"),this.nt=a,this.h("toPortChanged",b,a))});w.defineProperty(W,{Ab:"fromSpot"},function(){return null!==this.V?this.V.Rj:oc},function(a){this.Kd();var b=this.V.Rj;b.L(a)||(a=a.S(),this.V.Rj=a,this.h("fromSpot",b,a),this.Xb())});
w.defineProperty(W,{Rl:"fromEndSegmentLength"},function(){return null!==this.V?this.V.Pj:NaN},function(a){this.Kd();var b=this.V.Pj;b!==a&&(0>a&&w.Ea(a,">= 0",W,"fromEndSegmentLength"),this.V.Pj=a,this.h("fromEndSegmentLength",b,a),this.Xb())});w.defineProperty(W,{St:"fromEndSegmentDirection"},function(){return null!==this.V?this.V.Oj:nr},function(a){this.Kd();var b=this.V.Oj;b!==a&&(w.Gt("Link.fromEndSegmentDirection","2.0"),this.V.Oj=a,this.h("fromEndSegmentDirection",b,a),this.Xb())});
w.defineProperty(W,{Tt:"fromShortLength"},function(){return null!==this.V?this.V.Qj:NaN},function(a){this.Kd();var b=this.V.Qj;b!==a&&(this.V.Qj=a,this.h("fromShortLength",b,a),this.Xb())});w.defineProperty(W,{Bb:"toSpot"},function(){return null!==this.V?this.V.ok:oc},function(a){this.Kd();var b=this.V.ok;b.L(a)||(a=a.S(),this.V.ok=a,this.h("toSpot",b,a),this.Xb())});
w.defineProperty(W,{jm:"toEndSegmentLength"},function(){return null!==this.V?this.V.mk:NaN},function(a){this.Kd();var b=this.V.mk;b!==a&&(0>a&&w.Ea(a,">= 0",W,"toEndSegmentLength"),this.V.mk=a,this.h("toEndSegmentLength",b,a),this.Xb())});w.defineProperty(W,{Lu:"toEndSegmentDirection"},function(){return null!==this.V?this.V.lk:nr},function(a){this.Kd();var b=this.V.lk;b!==a&&(w.Gt("Link.toEndSegmentDirection","2.0"),this.V.lk=a,this.h("toEndSegmentDirection",b,a),this.Xb())});
w.defineProperty(W,{Mu:"toShortLength"},function(){return null!==this.V?this.V.nk:NaN},function(a){this.Kd();var b=this.V.nk;b!==a&&(this.V.nk=a,this.h("toShortLength",b,a),this.Xb())});function ln(a){var b=a.W,c=a.$;null!==b?null!==c?Hr(a,b.MH(c)):Hr(a,null):Hr(a,null)}function Hr(a,b){var c=a.Xk;if(c!==b){null!==c&&hr(c,a);a.Xk=b;null!==b&&ir(b,a);var d=a.pE;if(null!==d){var e=!0,f=a.g;null!==f&&(e=f.Ua,f.Ua=!0);d(a,c,b);null!==f&&(f.Ua=e)}!a.Zg||a.FD!==c&&a.GD!==c||a.Xb()}}
W.prototype.Vl=function(){var a=this.Ka;null!==a&&this.W!==a&&this.$!==a&&a.Tw&&S.prototype.Vl.call(this)};W.prototype.getOtherNode=W.prototype.mA=function(a){var b=this.W;return a===b?this.$:b};W.prototype.getOtherPort=function(a){var b=this.ed;return a===b?this.Sd:b};w.u(W,{VK:"isLabeledLink"},function(){return null===this.rf?!1:0<this.rf.count});w.u(W,{Vf:"labelNodes"},function(){return null===this.rf?va:this.rf.i});function vr(a,b){null===a.rf&&(a.rf=new J(T));a.rf.add(b);a.I()}
W.prototype.Wt=function(a){S.prototype.Wt.call(this,a);Ir(this)&&ej(this,this.Y);a||(a=this.mg,null!==a&&tr(a,this,this.ed),a=this.Cg,null!==a&&tr(a,this,this.Sd),Gr(this))};W.prototype.Xt=function(a){S.prototype.Xt.call(this,a);Ir(this)&&ej(this,this.Y);a||(a=this.mg,null!==a&&ur(a,this,this.ed),a=this.Cg,null!==a&&ur(a,this,this.Sd),Fr(this))};
W.prototype.tn=function(){this.Zg=!0;if(null!==this.rf){var a=this.g;if(null!==a)for(var b=this.rf.copy().i;b.next();)a.remove(b.value)}b=this.data;null!==b&&(a=this.g,null!==a&&(a=a.ba,a instanceof P?a.Wx(b):a instanceof Zf&&a.oi(b,void 0)))};
W.prototype.updateRelationshipsFromData=function(){var a=this.data;if(null!==a){var b=this.g;if(null!==b){var c=b.ba;if(c instanceof P){var d=c.Sl(a);this.W=d=b.Ie(d);d=c.Tl(a);this.$=d=b.Ie(d);a=c.Ak(a);if(0<a.length||0<this.Vf.count){if(1===a.length&&1===this.Vf.count){var d=a[0],e=this.Vf.first();if(c.ub(e.data)===d)return}var d=(new J).Hc(a),f=new J;this.Vf.each(function(a){null!==a.data&&(a=c.ub(a.data),void 0!==a&&f.add(a))});a=f.copy();a.Vx(d);d=d.copy();d.Vx(f);if(0<a.count||0<d.count){var h=
this;a.each(function(a){a=b.Ie(a);null!==a&&a.Lc===h&&(a.Lc=null)});d.each(function(a){a=b.Ie(a);null!==a&&a.Lc!==h&&(a.Lc=h)})}}}}}};W.prototype.move=function(a){var b=this.position,c=b.x;isNaN(c)&&(c=0);b=b.y;isNaN(b)&&(b=0);c=a.x-c;b=a.y-b;S.prototype.move.call(this,a);this.am(c,b);for(a=this.Vf;a.next();){var d=a.value,e=d.position;d.moveTo(e.x+c,e.y+b)}};
w.defineProperty(W,{eJ:"relinkableFrom"},function(){return 0!==(this.Vb&1)},function(a){var b=0!==(this.Vb&1);b!==a&&(this.Vb^=1,this.h("relinkableFrom",b,a),this.ce())});w.defineProperty(W,{fJ:"relinkableTo"},function(){return 0!==(this.Vb&2)},function(a){var b=0!==(this.Vb&2);b!==a&&(this.Vb^=2,this.h("relinkableTo",b,a),this.ce())});W.prototype.canRelinkFrom=function(){if(!this.eJ)return!1;var a=this.layer;if(null===a)return!0;if(!a.hn)return!1;a=a.g;return null===a||a.hn?!0:!1};
W.prototype.canRelinkTo=function(){if(!this.fJ)return!1;var a=this.layer;if(null===a)return!0;if(!a.hn)return!1;a=a.g;return null===a||a.hn?!0:!1};w.defineProperty(W,{Au:"resegmentable"},function(){return 0!==(this.Vb&4)},function(a){var b=0!==(this.Vb&4);b!==a&&(this.Vb^=4,this.h("resegmentable",b,a),this.ce())});
w.defineProperty(W,{Kc:"isTreeLink"},function(){return 0!==(this.Vb&8)},function(a){var b=0!==(this.Vb&8);b!==a&&(this.Vb^=8,this.h("isTreeLink",b,a),null!==this.W&&xn(this.W),null!==this.$&&xn(this.$))});w.u(W,{path:"path"},function(){var a=this.Hd();return a instanceof X?a:null});
w.u(W,{Un:"routeBounds"},function(){this.ao();var a=new A;var b=Infinity,c=Infinity,d=this.qa;if(0===d)a.l(NaN,NaN,0,0);else{if(1===d)d=this.m(0),b=Math.min(d.x,b),c=Math.min(d.y,c),a.l(d.x,d.y,0,0);else if(2===d){var e=this.m(0),f=this.m(1),b=Math.min(e.x,f.x),c=Math.min(e.y,f.y);a.l(e.x,e.y,0,0);a.ri(f)}else if(this.computeCurve()===sj&&3<=d&&!this.ic)if(e=this.m(0),b=e.x,c=e.y,a.l(b,c,0,0),3===d)d=this.m(1),b=Math.min(d.x,b),c=Math.min(d.y,c),f=this.m(2),b=Math.min(f.x,b),c=Math.min(f.y,c),Zd(e.x,
e.y,d.x,d.y,d.x,d.y,f.x,f.y,.5,a);else for(var h=3;h<d;h+=3){var k=this.m(h-2);h+3>=d&&(h=d-1);var l=this.m(h-1),f=this.m(h);Zd(e.x,e.y,k.x,k.y,l.x,l.y,f.x,f.y,.5,a);b=Math.min(f.x,b);c=Math.min(f.y,c);e=f}else for(e=this.m(0),f=this.m(1),b=Math.min(e.x,f.x),c=Math.min(e.y,f.y),a.l(e.x,e.y,0,0),a.ri(f),h=2;h<d;h++)e=this.m(h),b=Math.min(e.x,b),c=Math.min(e.y,c),a.ri(e);this.Cz.l(b-a.x,c-a.y)}return this.mw=a});w.u(W,{wF:"midPoint"},function(){this.ao();return this.computeMidPoint(new z)});
W.prototype.computeMidPoint=function(a){var b=this.qa;if(0===b)return a.assign(Cd),a;if(1===b)return a.assign(this.m(0)),a;if(2===b){var c=this.m(0),d=this.m(1);a.l((c.x+d.x)/2,(c.y+d.y)/2);return a}if(this.computeCurve()===sj&&3<=b&&!this.ic){if(3===b)return this.m(1);var c=(b-1)/3|0,e=3*(c/2|0);if(1===c%2){var c=this.m(e),d=this.m(e+1),f=this.m(e+2),e=this.m(e+3),b=d.x,h=d.y,d=f.x,k=f.y,f=(b+d)/2,l=(h+k)/2,h=((c.y+h)/2+l)/2,k=(l+(k+e.y)/2)/2;a.x=(((c.x+b)/2+f)/2+(f+(d+e.x)/2)/2)/2;a.y=(h+k)/2}else a.assign(this.m(e));
return a}e=0;f=w.lb();for(h=0;h<b-1;h++)c=0,c=this.m(h),d=this.m(h+1),Xa(c.x,d.x)?(c=d.y-c.y,0>c&&(c=-c)):Xa(c.y,d.y)?(c=d.x-c.x,0>c&&(c=-c)):c=Math.sqrt(c.uf(d)),f.push(c),e+=c;for(d=h=c=0;c<e/2&&h<b;){d=f[h];if(c+d>e/2)break;c+=d;h++}w.va(f);b=this.m(h);f=this.m(h+1);b.x===f.x?b.y>f.y?a.l(b.x,b.y-(e/2-c)):a.l(b.x,b.y+(e/2-c)):b.y===f.y?b.x>f.x?a.l(b.x-(e/2-c),b.y):a.l(b.x+(e/2-c),b.y):(c=(e/2-c)/d,a.l(b.x+c*(f.x-b.x),b.y+c*(f.y-b.y)));return a};w.u(W,{vF:"midAngle"},function(){this.ao();return this.computeMidAngle()});
W.prototype.computeMidAngle=function(){var a=this.qa;if(2>a)return NaN;if(this.computeCurve()===sj&&4<=a&&!this.ic){var b=(a-1)/3|0,c=3*(b/2|0);if(1===b%2){var c=Math.floor(c),b=this.m(c),d=this.m(c+1),a=this.m(c+2),c=this.m(c+3),e=d.x,d=d.y,f=a.x,a=a.y,h=(e+f)/2,k=(d+a)/2;return Oa(((b.x+e)/2+h)/2,((b.y+d)/2+k)/2,(h+(f+c.x)/2)/2,(k+(a+c.y)/2)/2)}if(0<c&&c+1<a)return b=this.m(c-1),d=this.m(c+1),b.yc(d)}c=a/2|0;if(0===a%2)return b=this.m(c-1),d=this.m(c),4<=a&&b.Ic(d)&&(b=this.m(c-2),a=this.m(c+1),
c=b.uf(d),e=d.uf(a),!(c>e+10))?e>c+10?d.yc(a):b.yc(a):b.yc(d);b=this.m(c-1);d=this.m(c);a=this.m(c+1);c=b.uf(d);e=d.uf(a);return c>e+10?b.yc(d):e>c+10?d.yc(a):b.yc(a)};
w.defineProperty(W,{points:"points"},function(){return this.ad},function(a){var b=this.ad;if(b!==a){var c=null;if(Array.isArray(a)){var d=0===a.length%2;if(d)for(var e=0;e<a.length;e++)if("number"!==typeof a[e]||isNaN(a[e])){d=!1;break}if(d)for(c=new I(z),d=0;d<a.length/2;d++){var f=(new z(a[2*d],a[2*d+1])).freeze();c.add(f)}else{e=!0;for(d=0;d<a.length;d++){var h=a[d];if(!w.Qa(f)||"number"!==typeof h.x||isNaN(h.x)||"number"!==typeof h.y||isNaN(h.y)){e=!1;break}}if(e)for(c=new I(z),d=0;d<a.length;d++)f=
a[d],c.add((new z(f.x,f.y)).freeze());else w.k("Link.points array must contain only an even number of numbers or objects with x and y properties, not: "+a)}}else if(a instanceof I)for(c=a.copy(),a=c.i;a.next();)a.value.freeze();else w.k("Link.points value is not an instance of List or Array: "+a);c.freeze();this.ad=c;this.Ke();this.I();Jr(this);a=this.g;null!==a&&(a.Fn||a.oa.fb||a.Hx.add(this),a.Pa.oc&&(this.lp=c));this.h("points",b,c)}});w.u(W,{qa:"pointsCount"},function(){return this.ad.count});
W.prototype.getPoint=W.prototype.m=function(a){return this.ad.n[a]};W.prototype.setPoint=W.prototype.Tg=function(a,b){null===this.Ue&&w.k("Call Link.startRoute before modifying the points of the route.");this.ad.fg(a,b)};W.prototype.setPointAt=W.prototype.ea=function(a,b,c){null===this.Ue&&w.k("Call Link.startRoute before modifying the points of the route.");this.ad.fg(a,new z(b,c))};
W.prototype.insertPoint=function(a,b){null===this.Ue&&w.k("Call Link.startRoute before modifying the points of the route.");this.ad.Ld(a,b)};W.prototype.insertPointAt=W.prototype.w=function(a,b,c){null===this.Ue&&w.k("Call Link.startRoute before modifying the points of the route.");this.ad.Ld(a,new z(b,c))};W.prototype.addPoint=W.prototype.ii=function(a){null===this.Ue&&w.k("Call Link.startRoute before modifying the points of the route.");this.ad.add(a)};
W.prototype.addPointAt=W.prototype.Bl=function(a,b){null===this.Ue&&w.k("Call Link.startRoute before modifying the points of the route.");this.ad.add(new z(a,b))};W.prototype.removePoint=W.prototype.NF=function(a){null===this.Ue&&w.k("Call Link.startRoute before modifying the points of the route.");this.ad.Xc(a)};W.prototype.clearPoints=W.prototype.Jp=function(){null===this.Ue&&w.k("Call Link.startRoute before modifying the points of the route.");this.ad.clear()};
W.prototype.movePoints=W.prototype.am=function(a,b){for(var c=new I(z),d=this.ad.i;d.next();){var e=d.value;c.add((new z(e.x+a,e.y+b)).freeze())}c.freeze();d=this.ad;this.ad=c;this.I();Jr(this);e=this.g;null!==e&&e.Pa.oc&&(this.lp=c);this.h("points",d,c)};W.prototype.startRoute=W.prototype.fm=function(){null===this.Ue&&(this.Ue=this.ad,this.ad=this.ad.copy())};
W.prototype.commitRoute=W.prototype.ij=function(){if(null!==this.Ue){for(var a=this.Ue,b=this.ad,c=Infinity,d=Infinity,e=a.n,f=e.length,h=0;h<f;h++)var k=e[h],c=Math.min(k.x,c),d=Math.min(k.y,d);for(var l=Infinity,m=Infinity,n=b.n,p=n.length,h=0;h<p;h++)k=n[h],l=Math.min(k.x,l),m=Math.min(k.y,m),k.freeze();b.freeze();if(p===f)for(h=0;h<p;h++){if(f=e[h],k=n[h],f.x-c!==k.x-l||f.y-d!==k.y-m){this.I();this.Ke();break}}else this.I(),this.Ke();this.Ue=null;c=this.g;null!==c&&c.Pa.oc&&(this.lp=b);Jr(this);
this.h("points",a,b)}};W.prototype.rollbackRoute=W.prototype.lJ=function(){null!==this.Ue&&(this.ad=this.Ue,this.Ue=null)};function Jr(a){0===a.ad.count?a.Zg=!1:(a.Zg=!0,a.Op=a.m(0),a.Pp=a.m(a.qa-1),Kr(a,!1))}W.prototype.invalidateRoute=W.prototype.Xb=function(){if(!this.Dj){var a=this.g;a&&(a.Hx.contains(this)||a.oa.fb||a.Pa.vI&&!a.Pa.kf)||(a=this.path,null!==a&&(this.Zg=!1,this.I(),a.I()))}};
w.defineProperty(W,{Zg:null},function(){return 0!==(this.Vb&16)},function(a){0!==(this.Vb&16)!==a&&(this.Vb^=16)});w.defineProperty(W,{Dj:"suspendsRouting"},function(){return 0!==(this.Vb&32)},function(a){0!==(this.Vb&32)!==a&&(this.Vb^=32)});w.defineProperty(W,{Tz:null},function(){return 0!==(this.Vb&64)},function(a){0!==(this.Vb&64)!==a&&(this.Vb^=64)});w.defineProperty(W,{Op:"defaultFromPoint"},function(){return this.iC},function(a){this.iC=a.copy()});
w.defineProperty(W,{Pp:"defaultToPoint"},function(){return this.oC},function(a){this.oC=a.copy()});W.prototype.updateRoute=W.prototype.ao=function(){if(!this.Zg&&!this.Tz){var a=!0;try{this.Tz=!0,this.fm(),a=this.computePoints()}finally{this.Tz=!1,a?this.ij():this.lJ()}}};
W.prototype.computePoints=function(){var a=this.g;if(null===a)return!1;var b=this.W,c=null;null===b?(a.sl||(a.Ls=new X,a.Ls.Aa=nd,a.Ls.kb=0,a.sl=new T,a.sl.add(a.Ls),a.sl.Ze()),this.Op&&(a.sl.position=a.sl.location=this.Op,a.sl.Ze(),b=a.sl,c=a.Ls)):c=this.ed;if(null!==c&&!b.isVisible()){var d=b.findVisibleNode();null!==d&&d!==b?(b=d,c=d.Ol("")):b=d}this.FD=b;if(null===b||!b.location.H())return!1;for(;!(null===c||c.Y.H()&&c.vj());)c=c.O;if(null===c)return!1;var e=this.$,f=null;null===e?(a.tl||(a.Ms=
new X,a.Ms.Aa=nd,a.Ms.kb=0,a.tl=new T,a.tl.add(a.Ms),a.tl.Ze()),this.Pp&&(a.tl.position=a.tl.location=this.Pp,a.tl.Ze(),e=a.tl,f=a.Ms)):f=this.Sd;null===f||e.isVisible()||(a=e.findVisibleNode(),null!==a&&a!==e?(e=a,f=a.Ol("")):e=a);this.GD=e;if(null===e||!e.location.H())return!1;for(;!(null===f||f.Y.H()&&f.vj());)f=f.O;if(null===f)return!1;var h=this.qa,d=Lr(this,c),a=Mr(this,f),k=d===sb,l=a===sb,m=c===f&&null!==c,n=this.ic,p=this.Ye===sj;this.Gi=m&&!n?p=!0:!1;var q=this.xt===dj||m;if(!n&&!m&&k&&
l){if(k=!1,!q&&3<=h&&(q=this.getLinkPoint(b,c,d,!0,!1,e,f),l=this.getLinkPoint(e,f,a,!1,!1,b,c),k=this.adjustPoints(0,q,h-1,l))&&(q=this.getLinkPoint(b,c,d,!0,!1,e,f),l=this.getLinkPoint(e,f,a,!1,!1,b,c),this.adjustPoints(0,q,h-1,l)),!k)if(this.Jp(),p){var h=this.getLinkPoint(b,c,d,!0,!1,e,f),q=this.getLinkPoint(e,f,a,!1,!1,b,c),k=q.x-h.x,l=q.y-h.y,m=this.computeCurviness(),p=n=0,r=h.x+k/3,s=h.y+l/3,u=r,t=s;K(l,0)?t=0<k?t-m:t+m:(n=-k/l,p=Math.sqrt(m*m/(n*n+1)),0>m&&(p=-p),u=(0>l?-1:1)*p+r,t=n*(u-
r)+s);var r=h.x+2*k/3,s=h.y+2*l/3,x=r,v=s;K(l,0)?v=0<k?v-m:v+m:(x=(0>l?-1:1)*p+r,v=n*(x-r)+s);this.Jp();this.ii(h);this.Bl(u,t);this.Bl(x,v);this.ii(q);this.Tg(0,this.getLinkPoint(b,c,d,!0,!1,e,f));this.Tg(3,this.getLinkPoint(e,f,a,!1,!1,b,c))}else d=this.getLinkPoint(b,c,d,!0,!1,e,f),a=this.getLinkPoint(e,f,a,!1,!1,b,c),this.hasCurviness()?(q=a.x-d.x,e=a.y-d.y,f=this.computeCurviness(),b=d.x+q/2,c=d.y+e/2,h=b,k=c,K(e,0)?k=0<q?k-f:k+f:(q=-q/e,h=Math.sqrt(f*f/(q*q+1)),0>f&&(h=-h),h=(0>e?-1:1)*h+b,
k=q*(h-b)+c),this.ii(d),this.Bl(h,k)):this.ii(d),this.ii(a)}else{p=this.Dk;q&&(n&&p||m)&&this.Jp();var B=m?this.computeCurviness():0,p=this.getLinkPoint(b,c,d,!0,n,e,f),r=u=s=0;if(n||!k||m)if(t=this.computeEndSegmentLength(b,c,d,!0),r=this.getLinkDirection(b,c,p,d,!0,n,e,f),m&&(k||d.L(a)||!n&&1===d.x+a.x&&1===d.y+a.y)&&(r-=n?90:30,0>B&&(r-=180)),0>r?r+=360:360<=r&&(r-=360),m&&(t+=Math.abs(B)*(n?1:2)),0===r?s=t:90===r?u=t:180===r?s=-t:270===r?u=-t:(s=t*Math.cos(r*Math.PI/180),u=t*Math.sin(r*Math.PI/
180)),d.Nd()&&m){var y=c.Wa(Fb,w.K()),H=w.xb(y.x+1E3*s,y.y+1E3*u);this.getLinkPointFromPoint(b,c,y,H,!0,p);w.v(y);w.v(H)}var t=this.getLinkPoint(e,f,a,!1,n,b,c),E=v=x=0;if(n||!l||m)y=this.computeEndSegmentLength(e,f,a,!1),E=this.getLinkDirection(e,f,t,a,!1,n,b,c),m&&(l||d.L(a)||!n&&1===d.x+a.x&&1===d.y+a.y)&&(E+=n?0:30,0>B&&(E+=180)),0>E?E+=360:360<=E&&(E-=360),m&&(y+=Math.abs(B)*(n?1:2)),0===E?x=y:90===E?v=y:180===E?x=-y:270===E?v=-y:(x=y*Math.cos(E*Math.PI/180),v=y*Math.sin(E*Math.PI/180)),a.Nd()&&
m&&(y=f.Wa(Fb,w.K()),H=w.xb(y.x+1E3*x,y.y+1E3*v),this.getLinkPointFromPoint(e,f,y,H,!1,t),w.v(y),w.v(H));a=p;if(n||!k||m)a=new z(p.x+s,p.y+u);d=t;if(n||!l||m)d=new z(t.x+x,t.y+v);!q&&!n&&k&&3<h&&this.adjustPoints(0,p,h-2,d)?this.Tg(h-1,t):!q&&!n&&l&&3<h&&this.adjustPoints(1,a,h-1,t)?this.Tg(0,p):!q&&(n?6<=h:4<h)&&this.adjustPoints(1,a,h-2,d)?(this.Tg(0,p),this.Tg(h-1,t)):(this.Jp(),this.ii(p),(n||!k||m)&&this.ii(a),n&&this.addOrthoPoints(a,r,d,E,b,e),(n||!l||m)&&this.ii(d),this.ii(t))}return!0};
function Nr(a,b){Math.abs(b.x-a.x)>Math.abs(b.y-a.y)?(b.x=b.x>=a.x?a.x+9E9:a.x-9E9,b.y=a.y):(b.y=b.y>=a.y?a.y+9E9:a.y-9E9,b.x=a.x);return b}
W.prototype.getLinkPointFromPoint=function(a,b,c,d,e,f){void 0===f&&(f=new z);if(null===a||null===b)return f.assign(c),f;a.isVisible()||(e=a.findVisibleNode(),null!==e&&e!==a&&(b=e.port));var h=e=0,k=0,l=0;a=null;e=b.O;null===e||e.Yg()||(e=e.O);if(null===e)e=d.x,h=d.y,k=c.x,l=c.y;else{a=e.ph;e=1/(a.m11*a.m22-a.m12*a.m21);var k=a.m22*e,l=-a.m12*e,m=-a.m21*e,n=a.m11*e,p=e*(a.m21*a.dy-a.m22*a.dx),q=e*(a.m12*a.dx-a.m11*a.dy);e=d.x*k+d.y*m+p;h=d.x*l+d.y*n+q;k=c.x*k+c.y*m+p;l=c.x*l+c.y*n+q}b.zn(e,h,k,l,
f);null!==a&&f.transform(a);return f};function Or(a,b){var c=b.Bs;null===c&&(c=new Pr,c.port=b,c.Nc=b.U,b.Bs=c);return Qr(c,a)}
W.prototype.getLinkPoint=function(a,b,c,d,e,f,h,k){void 0===k&&(k=new z);if(c.fd())return b.Wa(c,k),k;if(c.sj()){var l=Or(this,b);if(null!==l){k.assign(l.fq);if(e&&this.Zx===Er){var m=Or(this,h);if(null!==m&&l.rn<m.rn){var l=w.K(),m=w.K(),n=new A(b.Wa(vb,l),b.Wa(Kb,m)),p=this.computeSpot(!d);a=this.getLinkPoint(f,h,p,!d,e,a,b,m);(c.qj(Tb)||c.qj(Ub))&&a.y>=n.y&&a.y<=n.y+n.height?k.y=a.y:(c.qj(Sb)||c.qj(Vb))&&a.x>=n.x&&a.x<=n.x+n.width&&(k.x=a.x);w.v(l);w.v(m)}}return k}}c=b.Wa(Fb,w.K());l=f=null;this.qa>
(e?6:2)?(l=d?this.m(1):this.m(this.qa-2),e&&(l=Nr(c,l.copy()))):(f=w.K(),l=h.Wa(Fb,f),e&&(l=Nr(c,l)),w.v(f));this.getLinkPointFromPoint(a,b,c,l,d,k);w.v(c);return k};
W.prototype.getLinkDirection=function(a,b,c,d,e,f,h,k){a:if(d.fd())c=d.x>d.y?d.x>1-d.y?0:d.x<1-d.y?270:315:d.x<d.y?d.x>1-d.y?90:d.x<1-d.y?180:135:.5>d.x?225:.5<d.x?45:0;else{if(d.sj()){var l=Or(this,b);if(null!==l)switch(l.xe){case w.jd:c=270;break a;case w.Qc:c=180;break a;default:case w.Zc:c=0;break a;case w.Yc:c=90;break a}}var l=b.Wa(Fb,w.K()),m=null,n=null;this.qa>(f?6:2)?(n=e?this.m(1):this.m(this.qa-2),n=f?Nr(l,n.copy()):c):(m=w.K(),n=k.Wa(Fb,m),w.v(m));c=0;c=Math.abs(n.x-l.x)>Math.abs(n.y-
l.y)?n.x>=l.x?0:180:n.y>=l.y?90:270;w.v(l)}d.Nd()&&h.mi(a)&&(c+=180,360<=c&&(c-=360));a=nr;a=e?this.St:this.Lu;a===nr&&(a=e?b.St:b.Lu);switch(a){case or:b=b.xn();c+=b;360<=c&&(c-=360);break;case nr:case uo:b=b.xn();if(0===b)break;45<=b&&135>b?c+=90:135<=b&&225>b?c+=180:225<=b&&315>b&&(c+=270);360<=c&&(c-=360)}return c};
W.prototype.computeEndSegmentLength=function(a,b,c,d){if(null!==b&&c.sj()&&(a=Or(this,b),null!==a))return a.bx;a=NaN;a=d?this.Rl:this.jm;null!==b&&isNaN(a)&&(a=d?b.Rl:b.jm);isNaN(a)&&(a=10);return a};W.prototype.computeSpot=function(a){return a?Lr(this,this.ed):Mr(this,this.Sd)};function Lr(a,b){if(null===b)return Fb;var c=a.Ab;c.Uc()&&null!==b&&(c=b.Ab);return c===oc?sb:c}function Mr(a,b){if(null===b)return Fb;var c=a.Bb;c.Uc()&&null!==b&&(c=b.Bb);return c===oc?sb:c}
W.prototype.computeOtherPoint=function(a,b){var c=b.Wa(Fb),d;d=b.Bs;d=null!==d?Qr(d,this):null;null!==d&&(c=d.fq);return c};W.prototype.computeShortLength=function(a){if(a){if(a=this.Tt,isNaN(a)){var b=this.ed;null!==b&&(a=b.Tt)}}else a=this.Mu,isNaN(a)&&(b=this.Sd,null!==b&&(a=b.Mu));return isNaN(a)?0:a};
W.prototype.yk=function(a,b,c,d,e,f){if(!1===this.Sg)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var h=f;void 0===f&&(h=w.Ef(),h.reset());h.multiply(this.transform);if(this.on(a,h))return Xp(this,b,c,e),void 0===f&&w.ue(h),!0;if(this.Kg(a,h)){var k=!1;if(!this.En)for(var l=this.wa.n,m=l.length;m--;){var n=l[m];if(n.visible||n===this.Xf){var p=n.Y,q=this.Ia;if(!(p.x>q.width||p.y>q.height||0>p.x+p.width||0>p.y+p.height)){p=w.Ef();p.set(h);if(n instanceof C)k=n.yk(a,b,c,d,e,p);else if(this.path===
n){if(n instanceof X){var k=n,r=a,s=d,q=p;if(!1===k.Sg)k=!1;else if(q.multiply(k.transform),s)b:{var u=r,t=q;if(k.on(u,t))k=!0;else{if(void 0===t&&(t=k.transform,u.vk(k.Y))){k=!0;break b}var q=u.left,r=u.right,s=u.top,u=u.bottom,x=w.K(),v=w.K(),B=w.K(),y=w.Ef();y.set(t);y.yF(k.transform);y.qx();v.x=r;v.y=s;v.transform(y);x.x=q;x.y=s;x.transform(y);t=!1;iq(k,x,v,B)?t=!0:(x.x=r,x.y=u,x.transform(y),iq(k,x,v,B)?t=!0:(v.x=q,v.y=u,v.transform(y),iq(k,x,v,B)?t=!0:(x.x=q,x.y=s,x.transform(y),iq(k,x,v,B)&&
(t=!0))));w.ue(y);w.v(x);w.v(v);w.v(B);k=t}}else k=k.on(r,q)}}else k=Ao(n,a,d,p);k&&(null!==b&&(n=b(n)),n&&(null===c||c(n))&&(e instanceof J&&e.add(n),e instanceof I&&e.add(n)));w.ue(p)}}}void 0===f&&w.ue(h);return k||null!==this.background||null!==this.jn}void 0===f&&w.ue(h);return!1};w.u(W,{ic:"isOrthogonal"},function(){return 2===(this.Um.value&2)});w.u(W,{Dk:"isAvoiding"},function(){return 4===(this.Um.value&4)});
W.prototype.computeCurve=function(){if(null===this.Gi){var a=this.ed,b=this.ic;this.Gi=null!==a&&a===this.Sd&&!b}return this.Gi?sj:this.Ye};W.prototype.computeCorner=function(){if(this.Ye===sj)return 0;var a=this.Yz;if(isNaN(a)||0>a)a=10;return a};W.prototype.findMidLabel=function(){for(var a=this.path,b=this.wa.n,c=b.length,d=0;d<c;d++){var e=b[d];if(e!==a&&!e.Uf&&(-Infinity===e.Me||isNaN(e.Me)))return e}for(a=this.Vf;a.next();)if(b=a.value,-Infinity===b.Me||isNaN(b.Me))return b;return null};
W.prototype.computeSpacing=function(){if(!this.isVisible())return 0;var a;a=Math.max(14,this.computeThickness());var b=this.ed,c=this.Sd;if(null!==b&&null!==c){var d=this.findMidLabel();if(null!==d){var e=d.Ia,f=d.margin,h=isNaN(e.width)?30:e.width*d.scale+f.left+f.right,e=isNaN(e.height)?14:e.height*d.scale+f.top+f.bottom,d=d.rq;d===lq||d===Eq||d===Dq?a=Math.max(a,e):d===Pp||d===Qp||d===Np||d===Op?a=Math.max(a,h):(b=b.Wa(Fb).yc(c.Wa(Fb))/180*Math.PI,a=Math.max(a,Math.abs(Math.sin(b)*h)+Math.abs(Math.cos(b)*
e)+1));this.Ye===sj&&(a*=1.333)}}return a};W.prototype.arrangeBundledLinks=function(a,b){if(b)for(var c=0;c<a.length;c++)a[c].Xb()};W.prototype.computeCurviness=function(){var a=this.Xw;if(isNaN(a)){var a=16,b=this.ti;if(null!==b){for(var c=w.lb(),d=0,e=b.links,f=0;f<e.length;f++){var h=e[f],h=h.computeSpacing();c.push(h);d+=h}d=-d/2;for(f=0;f<e.length;f++){h=e[f];if(h===this){a=d+c[f]/2;break}d+=c[f]}b.iq===this.W&&(a=-a);w.va(c)}}return a};
W.prototype.computeThickness=function(){if(!this.isVisible())return 0;var a=this.path;return null!==a?Math.max(a.kb,1):1};W.prototype.hasCurviness=function(){return!isNaN(this.Xw)||null!==this.ti};
W.prototype.adjustPoints=function(a,b,c,d){var e=this.xt;if(this.ic){if(e===Cr)return!1;e===Dr&&(e=Br)}switch(e){case Cr:var f=this.m(a),h=this.m(c);if(!f.Ic(b)||!h.Ic(d)){var e=f.x,f=f.y,k=h.x-e,l=h.y-f,m=Math.sqrt(k*k+l*l);if(!Xa(m,0)){var n=0;Xa(k,0)?n=0>l?-Math.PI/2:Math.PI/2:(n=Math.atan(l/Math.abs(k)),0>k&&(n=Math.PI-n));var h=b.x,p=b.y,l=d.x-h,q=d.y-p,r=Math.sqrt(l*l+q*q),k=0;Xa(l,0)?k=0>q?-Math.PI/2:Math.PI/2:(k=Math.atan(q/Math.abs(l)),0>l&&(k=Math.PI-k));m=r/m;n=k-n;this.Tg(a,b);for(a+=
1;a<c;a++)b=this.m(a),k=b.x-e,l=b.y-f,b=Math.sqrt(k*k+l*l),Xa(b,0)||(q=0,Xa(k,0)?q=0>l?-Math.PI/2:Math.PI/2:(q=Math.atan(l/Math.abs(k)),0>k&&(q=Math.PI-q)),k=q+n,b*=m,this.ea(a,h+b*Math.cos(k),p+b*Math.sin(k)));this.Tg(c,d)}}return!0;case Dr:f=this.m(a);p=this.m(c);if(!f.Ic(b)||!p.Ic(d)){var e=f.x,f=f.y,h=p.x,p=p.y,m=(h-e)*(h-e)+(p-f)*(p-f),k=b.x,n=b.y,l=d.x,q=d.y,r=0,s=1;0!==l-k?(r=(q-n)/(l-k),s=Math.sqrt(1+1/(r*r))):r=9E9;this.Tg(a,b);for(a+=1;a<c;a++){b=this.m(a);var u=b.x,t=b.y,x=.5;0!==m&&(x=
((e-u)*(e-h)+(f-t)*(f-p))/m);var v=e+x*(h-e),B=f+x*(p-f);b=Math.sqrt((u-v)*(u-v)+(t-B)*(t-B));t<r*(u-v)+B&&(b=-b);0<r&&(b=-b);u=k+x*(l-k);x=n+x*(q-n);0!==r?(b=u+b/s,this.ea(a,b,x-(b-u)/r)):this.ea(a,u,x+b)}this.Tg(c,d)}return!0;case Br:a:{if(this.ic){h=this.m(a);p=this.m(a+1);e=this.m(a+2);m=p.x;k=p.y;K(h.y,p.y)?K(p.x,e.x)?k=b.y:K(p.y,e.y)&&(m=b.x):K(h.x,p.x)&&(K(p.y,e.y)?m=b.x:K(p.x,e.x)&&(k=b.y));f=this.g;if(this.Dk&&null!==f&&(h=zn(f,!0,this.Ka,null),!h.$l(Math.min(m,e.x),Math.min(k,e.y),Math.abs(m-
e.x),Math.abs(k-e.y)))){c=!1;break a}this.ea(a+1,m,k);h=this.m(c);p=this.m(c-1);e=this.m(c-2);m=p.x;k=p.y;K(h.y,p.y)?K(p.x,e.x)?k=d.y:K(p.y,e.y)&&(m=d.x):K(h.x,p.x)&&(K(p.y,e.y)?m=d.x:K(p.x,e.x)&&(k=d.y));if(this.Dk&&null!==f&&(h=zn(f,!0,this.Ka,null),!h.$l(Math.min(m,e.x),Math.min(k,e.y),Math.abs(m-e.x),Math.abs(k-e.y)))){c=!1;break a}this.ea(c-1,m,k)}this.Tg(a,b);this.Tg(c,d);c=!0}return c;default:return!1}};
W.prototype.addOrthoPoints=function(a,b,c,d,e,f){b=-45<=b&&45>b?0:45<=b&&135>b?90:135<=b&&225>b?180:270;d=-45<=d&&45>d?0:45<=d&&135>d?90:135<=d&&225>d?180:270;var h=e.Y.copy(),k=f.Y.copy();if(h.H()&&k.H()){h.Sf(8,8);k.Sf(8,8);h.ri(a);k.ri(c);var l,m;if(0===b)if(c.x>a.x||270===d&&c.y<a.y&&k.right>a.x||90===d&&c.y>a.y&&k.right>a.x)l=new z(c.x,a.y),m=new z(c.x,(a.y+c.y)/2),180===d?(l.x=this.computeMidOrthoPosition(a.x,c.x,!1),m.x=l.x,m.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(l.x=a.x<k.left?this.computeMidOrthoPosition(a.x,
k.left,!1):a.x<k.right&&(270===d&&a.y<k.top||90===d&&a.y>k.bottom)?this.computeMidOrthoPosition(a.x,c.x,!1):k.right,m.x=l.x,m.y=c.y):0===d&&a.x<k.left&&a.y>k.top&&a.y<k.bottom&&(l.x=a.x,l.y=a.y<c.y?Math.min(c.y,k.top):Math.max(c.y,k.bottom),m.y=l.y);else{l=new z(a.x,c.y);m=new z((a.x+c.x)/2,c.y);if(180===d||90===d&&c.y<h.top||270===d&&c.y>h.bottom)180===d&&(k.Ha(a)||h.Ha(c))?l.y=this.computeMidOrthoPosition(a.y,c.y,!0):c.y<a.y&&(180===d||90===d)?l.y=this.computeMidOrthoPosition(h.top,Math.max(c.y,
k.bottom),!0):c.y>a.y&&(180===d||270===d)&&(l.y=this.computeMidOrthoPosition(h.bottom,Math.min(c.y,k.top),!0)),m.x=c.x,m.y=l.y;if(l.y>h.top&&l.y<h.bottom)if(c.x>=h.left&&c.x<=a.x||a.x<=k.right&&a.x>=c.x){if(90===d||270===d)l=new z(Math.max((a.x+c.x)/2,a.x),a.y),m=new z(l.x,c.y)}else l.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,0===d?h.top:Math.min(h.top,k.top)):Math.max(c.y,0===d?h.bottom:Math.max(h.bottom,k.bottom)),m.x=c.x,m.y=l.y}else if(180===b)if(c.x<a.x||270===d&&c.y<a.y&&k.left<a.x||
90===d&&c.y>a.y&&k.left<a.x)l=new z(c.x,a.y),m=new z(c.x,(a.y+c.y)/2),0===d?(l.x=this.computeMidOrthoPosition(a.x,c.x,!1),m.x=l.x,m.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(l.x=a.x>k.right?this.computeMidOrthoPosition(a.x,k.right,!1):a.x>k.left&&(270===d&&a.y<k.top||90===d&&a.y>k.bottom)?this.computeMidOrthoPosition(a.x,c.x,!1):k.left,m.x=l.x,m.y=c.y):180===d&&a.x>k.right&&a.y>k.top&&a.y<k.bottom&&(l.x=a.x,l.y=a.y<c.y?Math.min(c.y,k.top):Math.max(c.y,k.bottom),m.y=l.y);else{l=new z(a.x,c.y);m=new z((a.x+
c.x)/2,c.y);if(0===d||90===d&&c.y<h.top||270===d&&c.y>h.bottom)0===d&&(k.Ha(a)||h.Ha(c))?l.y=this.computeMidOrthoPosition(a.y,c.y,!0):c.y<a.y&&(0===d||90===d)?l.y=this.computeMidOrthoPosition(h.top,Math.max(c.y,k.bottom),!0):c.y>a.y&&(0===d||270===d)&&(l.y=this.computeMidOrthoPosition(h.bottom,Math.min(c.y,k.top),!0)),m.x=c.x,m.y=l.y;if(l.y>h.top&&l.y<h.bottom)if(c.x<=h.right&&c.x>=a.x||a.x>=k.left&&a.x<=c.x){if(90===d||270===d)l=new z(Math.min((a.x+c.x)/2,a.x),a.y),m=new z(l.x,c.y)}else l.y=270===
d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,180===d?h.top:Math.min(h.top,k.top)):Math.max(c.y,180===d?h.bottom:Math.max(h.bottom,k.bottom)),m.x=c.x,m.y=l.y}else if(90===b)if(c.y>a.y||180===d&&c.x<a.x&&k.bottom>a.y||0===d&&c.x>a.x&&k.bottom>a.y)l=new z(a.x,c.y),m=new z((a.x+c.x)/2,c.y),270===d?(l.y=this.computeMidOrthoPosition(a.y,c.y,!0),m.x=c.x,m.y=l.y):180===d&&c.x<a.x||0===d&&c.x>a.x?(l.y=a.y<k.top?this.computeMidOrthoPosition(a.y,k.top,!0):a.y<k.bottom&&(180===d&&a.x<k.left||0===d&&a.x>k.right)?
this.computeMidOrthoPosition(a.y,c.y,!0):k.bottom,m.x=c.x,m.y=l.y):90===d&&a.y<k.top&&a.x>k.left&&a.x<k.right&&(l.x=a.x<c.x?Math.min(c.x,k.left):Math.max(c.x,k.right),l.y=a.y,m.x=l.x);else{l=new z(c.x,a.y);m=new z(c.x,(a.y+c.y)/2);if(270===d||0===d&&c.x<h.left||180===d&&c.x>h.right)270===d&&(k.Ha(a)||h.Ha(c))?l.x=this.computeMidOrthoPosition(a.x,c.x,!1):c.x<a.x&&(270===d||0===d)?l.x=this.computeMidOrthoPosition(h.left,Math.max(c.x,k.right),!1):c.x>a.x&&(270===d||180===d)&&(l.x=this.computeMidOrthoPosition(h.right,
Math.min(c.x,k.left),!1)),m.x=l.x,m.y=c.y;if(l.x>h.left&&l.x<h.right)if(c.y>=h.top&&c.y<=a.y||a.y<=k.bottom&&a.y>=c.y){if(0===d||180===d)l=new z(a.x,Math.max((a.y+c.y)/2,a.y)),m=new z(c.x,l.y)}else l.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,90===d?h.left:Math.min(h.left,k.left)):Math.max(c.x,90===d?h.right:Math.max(h.right,k.right)),m.x=l.x,m.y=c.y}else if(c.y<a.y||180===d&&c.x<a.x&&k.top<a.y||0===d&&c.x>a.x&&k.top<a.y)l=new z(a.x,c.y),m=new z((a.x+c.x)/2,c.y),90===d?(l.y=this.computeMidOrthoPosition(a.y,
c.y,!0),m.x=c.x,m.y=l.y):180===d&&c.x<a.x||0===d&&c.x>=a.x?(l.y=a.y>k.bottom?this.computeMidOrthoPosition(a.y,k.bottom,!0):a.y>k.top&&(180===d&&a.x<k.left||0===d&&a.x>k.right)?this.computeMidOrthoPosition(a.y,c.y,!0):k.top,m.x=c.x,m.y=l.y):270===d&&a.y>k.bottom&&a.x>k.left&&a.x<k.right&&(l.x=a.x<c.x?Math.min(c.x,k.left):Math.max(c.x,k.right),l.y=a.y,m.x=l.x);else{l=new z(c.x,a.y);m=new z(c.x,(a.y+c.y)/2);if(90===d||0===d&&c.x<h.left||180===d&&c.x>h.right)90===d&&(k.Ha(a)||h.Ha(c))?l.x=this.computeMidOrthoPosition(a.x,
c.x,!1):c.x<a.x&&(90===d||0===d)?l.x=this.computeMidOrthoPosition(h.left,Math.max(c.x,k.right),!1):c.x>a.x&&(90===d||180===d)&&(l.x=this.computeMidOrthoPosition(h.right,Math.min(c.x,k.left),!1)),m.x=l.x,m.y=c.y;if(l.x>h.left&&l.x<h.right)if(c.y<=h.bottom&&c.y>=a.y||a.y>=k.top&&a.y<=c.y){if(0===d||180===d)l=new z(a.x,Math.min((a.y+c.y)/2,a.y)),m=new z(c.x,l.y)}else l.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,270===d?h.left:Math.min(h.left,k.left)):Math.max(c.x,270===d?h.right:Math.max(h.right,
k.right)),m.x=l.x,m.y=c.y}var n=l,p=m;if(this.Dk){var q=this.g,r;(r=null===q)||(q.Pa.kf?r=!1:(r=q.Za,r=r instanceof hh?!r.Aw||r.nI:!0),r=!r);if(r||h.Ha(c)&&!f.mi(e)||k.Ha(a)&&!e.mi(f)||e===f||this.layer.Jc)a=!1;else if(e=zn(q,!0,this.Ka,null),e.$l(Math.min(a.x,n.x),Math.min(a.y,n.y),Math.abs(a.x-n.x),Math.abs(a.y-n.y))&&e.$l(Math.min(n.x,p.x),Math.min(n.y,p.y),Math.abs(n.x-p.x),Math.abs(n.y-p.y))&&e.$l(Math.min(p.x,c.x),Math.min(p.y,c.y),Math.abs(p.x-c.x),Math.abs(p.y-c.y)))a=!1;else if(h=h.copy().Gh(k),
h.Sf(2*e.Ip,2*e.Gp),Rr(e,a,b,c,d,h),k=Sr(e,c.x,c.y),e.abort||999999!==k||(Cn(e),k=e.fG,h.Sf(e.Ip*k,e.Gp*k),Rr(e,a,b,c,d,h),k=Sr(e,c.x,c.y)),e.abort||999999!==k||(Cn(e),k=e.rF,h.Sf(e.Ip*k,e.Gp*k),Rr(e,a,b,c,d,h),k=Sr(e,c.x,c.y)),!e.abort&&999999===k&&e.wG&&(Cn(e),Rr(e,a,b,c,d,e.jb),k=Sr(e,c.x,c.y)),!e.abort&&999999>k&&0!==Sr(e,c.x,c.y)){Tr(this,e,c.x,c.y,d,!0);d=this.m(2);if(4>this.qa)0===b||180===b?(d.x=a.x,d.y=c.y):(d.x=c.x,d.y=a.y),this.ea(2,d.x,d.y),this.w(3,d.x,d.y);else if(c=this.m(3),0===b||
180===b)K(d.x,c.x)?(b=0===b?Math.max(d.x,a.x):Math.min(d.x,a.x),this.ea(2,b,a.y),this.ea(3,b,c.y)):K(d.y,c.y)?(Math.abs(a.y-d.y)<=e.Gp/2&&(this.ea(2,d.x,a.y),this.ea(3,c.x,a.y)),this.w(2,d.x,a.y)):this.ea(2,a.x,d.y);else if(90===b||270===b)K(d.y,c.y)?(b=90===b?Math.max(d.y,a.y):Math.min(d.y,a.y),this.ea(2,a.x,b),this.ea(3,c.x,b)):K(d.x,c.x)?(Math.abs(a.x-d.x)<=e.Ip/2&&(this.ea(2,a.x,d.y),this.ea(3,a.x,c.y)),this.w(2,a.x,d.y)):this.ea(2,d.x,a.y);a=!0}else a=!1}else a=!1;a||(this.ii(l),this.ii(m))}};
W.prototype.computeMidOrthoPosition=function(a,b){if(this.hasCurviness()){var c=this.computeCurviness();return(a+b)/2+c}return(a+b)/2};function Eh(a){if(null===a.g||!a.Dk)return!1;var b=a.points.n,c=b.length;if(4>c)return!1;a=zn(a.g,!0,a.Ka,null);for(var d=1;d<c-2;d++){var e=b[d],f=b[d+1];if(!a.$l(Math.min(e.x,f.x),Math.min(e.y,f.y),Math.abs(e.x-f.x),Math.abs(e.y-f.y)))return!0}return!1}
function Tr(a,b,c,d,e,f){var h=b.Ip,k=b.Gp,l=Sr(b,c,d),m=c,n=d;for(0===e?m+=h:90===e?n+=k:180===e?m-=h:n-=k;1<l&&Sr(b,m,n)===l-1;)c=m,d=n,0===e?m+=h:90===e?n+=k:180===e?m-=h:n-=k,l-=1;if(f){if(1<l)if(180===e||0===e)c=Math.floor(c/h)*h+h/2;else if(90===e||270===e)d=Math.floor(d/k)*k+k/2}else c=Math.floor(c/h)*h+h/2,d=Math.floor(d/k)*k+k/2;1<l&&(f=e,m=c,n=d,0===e?(f=90,n+=k):90===e?(f=180,m-=h):180===e?(f=270,n-=k):270===e&&(f=0,m+=h),Sr(b,m,n)===l-1?Tr(a,b,m,n,f,!1):(m=c,n=d,0===e?(f=270,n-=k):90===
e?(f=0,m+=h):180===e?(f=90,n+=k):270===e&&(f=180,m-=h),Sr(b,m,n)===l-1&&Tr(a,b,m,n,f,!1)));a.Bl(c,d)}W.prototype.findClosestSegment=function(a){var b=a.x;a=a.y;for(var c=this.m(0),d=this.m(1),e=Ma(b,a,c.x,c.y,d.x,d.y),f=0,h=1;h<this.qa-1;h++){var c=this.m(h+1),k=Ma(b,a,d.x,d.y,c.x,c.y),d=c;k<e&&(f=h,e=k)}return f};W.prototype.Ke=function(){this.gb=null};w.u(W,{vf:"geometry"},function(){null===this.gb&&(this.ao(),this.gb=this.makeGeometry());return this.gb});
W.prototype.lu=function(a){if(!a){if(!1===this.Zg)return;a=this.Hd();if(null!==this.gb&&(null===a||null!==a.vf))return}this.gb=this.makeGeometry();a=this.path;if(null!==a){a.gb=this.gb;for(var b=this.wa.n,c=b.length,d=0;d<c;d++){var e=b[d];e!==a&&e.Uf&&e instanceof X&&(e.gb=this.gb)}}};
W.prototype.makeGeometry=function(){var a=this.qa;if(2>a)return new Fe(Je);var b=!1,c=this.g;null!==c&&Ir(this)&&c.Zk.contains(this)&&null!==this.mw&&(b=!0);var d=c=0,e=this.m(0).copy(),f=e.copy(),c=this.ad.n,h=this.computeCurve();if(h===sj&&3<=a&&!Xa(this.wq,0))if(3===a)var k=this.m(1),c=Math.min(e.x,k.x),d=Math.min(e.y,k.y),k=this.m(2),c=Math.min(c,k.x),d=Math.min(d,k.y);else{if(this.ic)for(k=0;k<a;k++)d=c[k],f.x=Math.min(d.x,f.x),f.y=Math.min(d.y,f.y);else for(k=3;k<a;k+=3)k+3>=a&&(k=a-1),c=this.m(k),
f.x=Math.min(c.x,f.x),f.y=Math.min(c.y,f.y);c=f.x;d=f.y}else{for(k=0;k<a;k++)d=c[k],f.x=Math.min(d.x,f.x),f.y=Math.min(d.y,f.y);c=f.x;d=f.y}c-=this.Cz.x;d-=this.Cz.y;e.x-=c;e.y-=d;if(2!==a||Ir(this)){var l=w.s();0!==this.computeShortLength(!0)&&(e=Ur(this,e,!0,f));M(l,e.x,e.y,!1,!1);if(h===sj&&3<=a&&!Xa(this.wq,0))if(3===a)k=this.m(1),a=k.x-c,b=k.y-d,k=this.m(2).copy(),k.x-=c,k.y-=d,0!==this.computeShortLength(!1)&&(k=Ur(this,k,!1,f)),N(l,a,b,a,b,k.x,k.y);else if(this.ic){for(var f=new z(c,d),e=this.m(1).copy(),
h=new z(c,d),a=new z(c,d),b=this.m(0),m=null,n=this.wq/3,k=1;k<this.qa-1;k++){var m=this.m(k),p=b,q=m,r=this.m(Vr(this,m,k,!1));if(!Xa(p.x,q.x)||!Xa(q.x,r.x))if(!Xa(p.y,q.y)||!Xa(q.y,r.y)){var s=n,u=h,t=a;isNaN(s)&&(s=this.wq/3);var x=p.x,p=p.y,v=q.x,q=q.y,B=r.x,r=r.y,y=s*Wr(x,p,v,q),s=s*Wr(v,q,B,r);Xa(p,q)&&Xa(v,B)&&(v>x?r>q?(u.x=v-y,u.y=q-y,t.x=v+s,t.y=q+s):(u.x=v-y,u.y=q+y,t.x=v+s,t.y=q-s):r>q?(u.x=v+y,u.y=q-y,t.x=v-s,t.y=q+s):(u.x=v+y,u.y=q+y,t.x=v-s,t.y=q-s));Xa(x,v)&&Xa(q,r)&&(q>p?(B>v?(u.x=
v-y,u.y=q-y,t.x=v+s):(u.x=v+y,u.y=q-y,t.x=v-s),t.y=q+s):(B>v?(u.x=v-y,u.y=q+y,t.x=v+s):(u.x=v+y,u.y=q+y,t.x=v-s),t.y=q-s));if(Xa(x,v)&&Xa(v,B)||Xa(p,q)&&Xa(q,r))x=.5*(x+B),p=.5*(p+r),u.x=x,u.y=p,t.x=x,t.y=p;1===k?(e.x=.5*(b.x+m.x),e.y=.5*(b.y+m.y)):2===k&&Xa(b.x,this.m(0).x)&&Xa(b.y,this.m(0).y)&&(e.x=.5*(b.x+m.x),e.y=.5*(b.y+m.y));N(l,e.x-c,e.y-d,h.x-c,h.y-d,m.x-c,m.y-d);f.set(h);e.set(a);b=m}}k=b.x;b=b.y;f=this.m(this.qa-1);0!==this.computeShortLength(!1)&&(f=Ur(this,f.copy(),!1,bd));k=.5*(k+f.x);
b=.5*(b+f.y);N(l,a.x-c,a.y-d,k-c,b-d,f.x-c,f.y-d)}else for(k=3;k<a;k+=3)b=this.m(k-2),k+3>=a&&(k=a-1),f=this.m(k-1),e=this.m(k),k===a-1&&0!==this.computeShortLength(!1)&&(e=Ur(this,e.copy(),!1,bd)),N(l,b.x-c,b.y-d,f.x-c,f.y-d,e.x-c,e.y-d);else{f=w.K();f.assign(this.m(0));for(k=1;k<a;){k=Vr(this,f,k,1<k);u=this.m(k);if(k>=a-1){f!==u&&(0!==this.computeShortLength(!1)&&(u=Ur(this,u.copy(),!1,bd)),Xr(this,l,-c,-d,f,u,b));break}k=Vr(this,u,k+1,k<a-3);e=l;h=-c;m=-d;n=f;t=this.m(k);x=f;p=b;K(n.y,u.y)&&K(u.x,
t.x)?(s=this.computeCorner(),s=Math.min(s,Math.abs(u.x-n.x)/2),s=v=Math.min(s,Math.abs(t.y-u.y)/2),K(s,0)?(Xr(this,e,h,m,n,u,p),x.assign(u)):(q=u.x,B=u.y,r=q,y=B,q=u.x>n.x?u.x-s:u.x+s,y=t.y>u.y?u.y+v:u.y-v,Xr(this,e,h,m,n,new z(q,B),p),Xe(e,u.x+h,u.y+m,r+h,y+m),x.l(r,y))):K(n.x,u.x)&&K(u.y,t.y)?(s=this.computeCorner(),v=Math.min(s,Math.abs(u.y-n.y)/2),v=s=Math.min(v,Math.abs(t.x-u.x)/2),K(s,0)?(Xr(this,e,h,m,n,u,p),x.assign(u)):(q=u.x,y=B=u.y,B=u.y>n.y?u.y-v:u.y+v,r=t.x>u.x?u.x+s:u.x-s,Xr(this,e,
h,m,n,new z(q,B),p),Xe(e,u.x+h,u.y+m,r+h,y+m),x.l(r,y))):(Xr(this,e,h,m,n,u,p),x.assign(u))}w.v(f)}c=l.o;w.q(l)}else l=this.m(1).copy(),l.x-=c,l.y-=d,0!==this.computeShortLength(!0)&&(e=Ur(this,e,!0,f)),0!==this.computeShortLength(!1)&&(l=Ur(this,l,!1,f)),c=new Fe(Je),c.ia=e.x,c.ga=e.y,c.D=l.x,c.F=l.y;return c};
function Wr(a,b,c,d){a=c-a;if(isNaN(a)||Infinity===a||-Infinity===a)return NaN;0>a&&(a=-a);b=d-b;if(isNaN(b)||Infinity===b||-Infinity===b)return NaN;0>b&&(b=-b);return Xa(a,0)?b:Xa(b,0)?a:Math.sqrt(a*a+b*b)}
function Ur(a,b,c,d){var e=a.qa;if(2>e)return b;if(c){var f=a.m(1);c=f.x-d.x;d=f.y-d.y;f=Wr(b.x,b.y,c,d);if(0===f)return b;e=2===e?.5*f:f;a=a.computeShortLength(!0);a>e&&(a=e);c=a*(c-b.x)/f;a=a*(d-b.y)/f;b.x+=c;b.y+=a}else{f=a.m(e-2);c=f.x-d.x;d=f.y-d.y;f=Wr(b.x,b.y,c,d);if(0===f)return b;e=2===e?.5*f:f;a=a.computeShortLength(!1);a>e&&(a=e);c=a*(b.x-c)/f;a=a*(b.y-d)/f;b.x-=c;b.y-=a}return b}
function Vr(a,b,c,d){for(var e=a.qa,f=b;Xa(b.x,f.x)&&Xa(b.y,f.y);){if(c>=e)return e-1;f=a.m(c++)}if(!Xa(b.x,f.x)&&!Xa(b.y,f.y))return c-1;for(var h=f;Xa(b.x,f.x)&&Xa(f.x,h.x)&&(!d||(b.y>=f.y?f.y>=h.y:f.y<=h.y))||Xa(b.y,f.y)&&Xa(f.y,h.y)&&(!d||(b.x>=f.x?f.x>=h.x:f.x<=h.x));){if(c>=e)return e-1;h=a.m(c++)}return c-2}
function Xr(a,b,c,d,e,f,h){if(!h&&Ir(a)){h=[];var k=0;a.isVisible()&&(k=Yr(a,e,f,h));var l=e.x,l=e.y;if(0<k)if(K(e.y,f.y))if(e.x<f.x)for(var m=0;m<k;){var n=Math.max(e.x,Math.min(h[m++]-5,f.x-10));b.lineTo(n+c,f.y+d);for(var l=n+c,p=Math.min(n+10,f.x);m<k;){var q=h[m];if(q<p+10)m++,p=Math.min(q+5,f.x);else break}q=(n+p)/2+c;q=f.y-10+d;n=p+c;p=f.y+d;a.Ye===cj?M(b,n,p,!1,!1):N(b,l,q,n,q,n,p)}else for(m=k-1;0<=m;){n=Math.min(e.x,Math.max(h[m--]+5,f.x+10));b.lineTo(n+c,f.y+d);l=n+c;for(p=Math.max(n-10,
f.x);0<=m;)if(q=h[m],q>p-10)m--,p=Math.max(q-5,f.x);else break;q=f.y-10+d;n=p+c;p=f.y+d;a.Ye===cj?M(b,n,p,!1,!1):N(b,l,q,n,q,n,p)}else if(K(e.x,f.x))if(e.y<f.y)for(m=0;m<k;){n=Math.max(e.y,Math.min(h[m++]-5,f.y-10));b.lineTo(f.x+c,n+d);l=n+d;for(p=Math.min(n+10,f.y);m<k;)if(q=h[m],q<p+10)m++,p=Math.min(q+5,f.y);else break;q=f.x-10+c;n=f.x+c;p+=d;a.Ye===cj?M(b,n,p,!1,!1):N(b,q,l,q,p,n,p)}else for(m=k-1;0<=m;){n=Math.min(e.y,Math.max(h[m--]+5,f.y+10));b.lineTo(f.x+c,n+d);l=n+d;for(p=Math.max(n-10,f.y);0<=
m;)if(q=h[m],q>p-10)m--,p=Math.max(q-5,f.y);else break;q=f.x-10+c;n=f.x+c;p+=d;a.Ye===cj?M(b,n,p,!1,!1):N(b,q,l,q,p,n,p)}}b.lineTo(f.x+c,f.y+d)}
function Yr(a,b,c,d){var e=a.g;if(null===e||b.L(c))return 0;for(e=e.Ex;e.next();){var f=e.value;if(null!==f&&f.visible)for(var f=f.zb.n,h=f.length,k=0;k<h;k++){var l=f[k];if(l instanceof W){if(l===a)return 0<d.length&&d.sort(function(a,b){return a-b}),d.length;if(l.isVisible()&&Ir(l)){var m=l.Un;m.H()&&a.Un.Kg(m)&&!a.usesSamePort(l)&&(m=l.path,null!==m&&m.vj()&&Zr(b,c,d,l))}}}}0<d.length&&d.sort(function(a,b){return a-b});return d.length}
function Zr(a,b,c,d){for(var e=K(a.y,b.y),f=d.qa,h=d.m(0),k=w.K(),l=1;l<f;l++){var m=d.m(l);if(l<f-1){var n=d.m(l+1);if(h.y===m.y&&m.y===n.y){if(m.x>h.x&&n.x>m.x||m.x<h.x&&n.x<m.x)m=n,l++}else h.x===m.x&&m.x===n.x&&(m.y>h.y&&n.y>m.y||m.y<h.y&&n.y<m.y)&&(m=n,l++)}a:{var n=k,p=a.x,q=a.y,r=b.x,s=b.y,u=h.x,h=h.y,t=m.x,x=m.y;if(!K(p,r)){if(K(q,s)&&K(u,t)&&Math.min(p,r)<u&&Math.max(p,r)>u&&Math.min(h,x)<q&&Math.max(h,x)>q&&!K(h,x)){n.x=u;n.y=q;n=!0;break a}}else if(!K(q,s)&&K(h,x)&&Math.min(q,s)<h&&Math.max(q,
s)>h&&Math.min(u,t)<p&&Math.max(u,t)>p&&!K(u,t)){n.x=p;n.y=h;n=!0;break a}n.x=0;n.y=0;n=!1}n&&(e?c.push(k.x):c.push(k.y));h=m}w.v(k)}w.u(W,{Ot:"firstPickIndex"},function(){var a;2>=this.qa?a=0:((a=this.ic)||(a=this.computeSpot(!0)!==sb),a=a?1:0);return a});w.u(W,{Cx:"lastPickIndex"},function(){var a=this.qa;if(0===a)a=0;else if(2>=a)a-=1;else{var b;(b=this.ic)||(b=this.computeSpot(!1)!==sb);a=b?a-2:a-1}return a});function Ir(a){a=a.Ye;return a===bj||a===cj}
function Kr(a,b){if(b||Ir(a)){var c=a.g;null===c||c.Zk.contains(a)||null===a.mw||c.Zk.add(a,a.mw)}}function ej(a,b){var c=a.layer;if(null!==c&&c.visible&&!c.Jc){var d=c.g;if(null!==d)for(var e=!1,d=d.Ex;d.next();){var f=d.value;if(f.visible)if(f===c)for(var e=!0,h=!1,f=f.zb.n,k=f.length,l=0;l<k;l++){var m=f[l];m instanceof W&&(m===a?h=!0:h&&$r(a,m,b))}else if(e)for(f=f.zb.n,k=f.length,l=0;l<k;l++)m=f[l],m instanceof W&&$r(a,m,b)}}}
function $r(a,b,c){if(null!==b&&null!==b.gb&&Ir(b)){var d=b.Un;d.H()&&(a.Un.Kg(d)||c.Kg(d))&&(a.usesSamePort(b)||b.Ke())}}W.prototype.usesSamePort=function(a){var b=this.qa,c=a.qa;if(0<b&&0<c){var d=this.m(0),e=a.m(0);if(d.Ic(e))return!0;b=this.m(b-1);a=a.m(c-1);if(b.Ic(a)||d.Ic(a)||b.Ic(e))return!0}else if(this.W===a.W||this.$===a.$||this.W===a.$||this.$===a.W)return!0;return!1};
W.prototype.isVisible=function(){if(!S.prototype.isVisible.call(this))return!1;var a=this.Ka,b=!0,c=this.g;null!==c&&(b=c.Od);var d=this.W;if(null!==d){if(this.Kc&&b&&!d.gd)return!1;if(d===a)return!0;for(c=d;null!==c;){if(c.Lc===this)return!0;c=c.Ka}c=d.findVisibleNode();if(null===c||c===a)return!1}d=this.$;if(null!==d){if(this.Kc&&!b&&!d.gd)return!1;if(d===a)return!0;for(c=d;null!==c;){if(c.Lc===this)return!0;c=c.Ka}b=d.findVisibleNode();if(null===b||b===a)return!1}return!0};
W.prototype.td=function(a){S.prototype.td.call(this,a);null!==this.ti&&this.ti.aq();if(null!==this.rf)for(var b=this.rf.i;b.next();)b.value.td(a)};w.defineProperty(W,{xt:"adjusting"},function(){return this.Gq},function(a){var b=this.Gq;b!==a&&(this.Gq=a,this.h("adjusting",b,a))});w.defineProperty(W,{Yz:"corner"},function(){return this.ar},function(a){var b=this.ar;b!==a&&(this.ar=a,this.Ke(),this.h("corner",b,a))});
w.defineProperty(W,{Ye:"curve"},function(){return this.dr},function(a){var b=this.dr;b!==a&&(this.dr=a,this.Xb(),this.Ke(),Kr(this,b===cj||b===bj||a===cj||a===bj),this.h("curve",b,a))});w.defineProperty(W,{Xw:"curviness"},function(){return this.er},function(a){var b=this.er;b!==a&&(this.er=a,this.Xb(),this.Ke(),this.h("curviness",b,a))});
w.defineProperty(W,{Zx:"routing"},function(){return this.Um},function(a){var b=this.Um;b!==a&&(this.Um=a,this.Gi=null,this.Xb(),Kr(this,2===(b.value&2)||2===(a.value&2)),this.h("routing",b,a))});w.defineProperty(W,{wq:"smoothness"},function(){return this.at},function(a){var b=this.at;b!==a&&(this.at=a,this.Ke(),this.h("smoothness",b,a))});
function Gr(a){var b=a.mg;if(null!==b){var c=a.Cg;if(null!==c){var d=a.Nh;a=a.hi;for(var e=null,f=null,h=b.nc.n,k=h.length,l=0;l<k;l++){var m=h[l];if(m.mg===b&&m.Nh===d&&m.Cg===c&&m.hi===a||m.mg===c&&m.Nh===a&&m.Cg===b&&m.hi===d)null===f?f=m:(null===e&&(e=[],e.push(f)),e.push(m))}if(null!==e){f=rr(b,c,d,a);null===f&&(f=new ul,f.iq=b,f.Ox=d,f.qu=c,f.Px=a,qr(b,f),qr(c,f));f.links=e;for(l=0;l<e.length;l++)m=e[l],m.ti=f;f.aq()}}}}
function Fr(a){var b=a.ti;null!==b&&(a.ti=null,a=b.links.indexOf(a),0<=a&&(w.Fg(b.links,a),b.aq()))}function ul(){w.lc(this);this.Kv=!1;this.Px=this.qu=this.Ox=this.iq=null;this.links=[]}ul.prototype.aq=function(){if(!this.Kv){var a=this.links;0<a.length&&(a=a[0].g,null!==a&&a.FC.add(this))}this.Kv=!0};
ul.prototype.uB=function(){if(this.Kv){this.Kv=!1;var a=this.links;if(0<a.length){var b=a[0],c=b.g;b.arrangeBundledLinks(a,null===c||c.Fn);1===a.length&&(b.ti=null,a.length=0)}0===a.length&&(a=this.iq,null!==this&&null!==a.Hh&&a.Hh.remove(this),a=this.qu,null!==this&&null!==a.Hh&&a.Hh.remove(this))}};w.$d(ul,{iq:!0,Ox:!0,qu:!0,Px:!0,links:!0,spacing:!0});
function An(){w.lc(this);this.iB=this.group=null;this.Yt=!0;this.abort=!1;this.wg=this.vg=1;this.bs=this.as=-1;this.Ae=this.ze=8;this.xd=null;this.wG=!1;this.fG=22;this.rF=111}w.$d(An,{group:!0,iB:!0,Yt:!0,abort:!0,wG:!0,fG:!0,rF:!0});
An.prototype.initialize=function(a){if(!(0>=a.width||0>=a.height)){var b=a.y,c=a.x+a.width,d=a.y+a.height;this.vg=Math.floor((a.x-this.ze)/this.ze)*this.ze;this.wg=Math.floor((b-this.Ae)/this.Ae)*this.Ae;this.as=Math.ceil((c+2*this.ze)/this.ze)*this.ze;this.bs=Math.ceil((d+2*this.Ae)/this.Ae)*this.Ae;a=1+(Math.ceil((this.as-this.vg)/this.ze)|0);b=1+(Math.ceil((this.bs-this.wg)/this.Ae)|0);if(null===this.xd||this.Ap<a-1||this.Bp<b-1){c=[];for(d=0;d<=a;d++){for(var e=[],f=0;f<=b;f++)e[f]=0;c[d]=e}this.xd=
c;this.Ap=a-1;this.Bp=b-1}if(null!==this.xd)for(a=0;a<=this.Ap;a++)for(b=0;b<=this.Bp;b++)this.xd[a][b]=999999}};w.u(An,{jb:null},function(){return new A(this.vg,this.wg,this.as-this.vg,this.bs-this.wg)});w.defineProperty(An,{Ip:null},function(){return this.ze},function(a){0<a&&a!==this.ze&&(this.ze=a,this.initialize(this.jb))});w.defineProperty(An,{Gp:null},function(){return this.Ae},function(a){0<a&&a!==this.Ae&&(this.Ae=a,this.initialize(this.jb))});
function as(a,b,c){return a.vg<=b&&b<=a.as&&a.wg<=c&&c<=a.bs}function Sr(a,b,c){if(!as(a,b,c))return 0;b-=a.vg;b/=a.ze;c-=a.wg;c/=a.Ae;return a.xd[b|0][c|0]}function Dn(a,b,c){as(a,b,c)&&(b-=a.vg,b/=a.ze,c-=a.wg,c/=a.Ae,a.xd[b|0][c|0]=0)}function Cn(a){if(null!==a.xd)for(var b=0;b<=a.Ap;b++)for(var c=0;c<=a.Bp;c++)1<=a.xd[b][c]&&(a.xd[b][c]|=999999)}
An.prototype.$l=function(a,b,c,d){if(a>this.as||a+c<this.vg||b>this.bs||b+d<this.wg)return!0;a=(a-this.vg)/this.ze|0;b=(b-this.wg)/this.Ae|0;c=Math.max(0,c)/this.ze+1|0;var e=Math.max(0,d)/this.Ae+1|0;0>a&&(c+=a,a=0);0>b&&(e+=b,b=0);if(0>c||0>e)return!0;d=Math.min(a+c-1,this.Ap)|0;for(c=Math.min(b+e-1,this.Bp)|0;a<=d;a++)for(e=b;e<=c;e++)if(0===this.xd[a][e])return!1;return!0};
function bs(a,b,c,d,e,f,h,k,l){if(!(b<f||b>h||c<k||c>l)){var m,n;m=b|0;n=c|0;var p=a.xd[m][n];if(1<=p&&999999>p)for(e?n+=d:m+=d,p+=1;f<=m&&m<=h&&k<=n&&n<=l&&!(p>=a.xd[m][n]);)a.xd[m][n]=p,p+=1,e?n+=d:m+=d;m=e?n:m;if(e)if(0<d)for(c+=d;c<m;c+=d)bs(a,b,c,1,!e,f,h,k,l),bs(a,b,c,-1,!e,f,h,k,l);else for(c+=d;c>m;c+=d)bs(a,b,c,1,!e,f,h,k,l),bs(a,b,c,-1,!e,f,h,k,l);else if(0<d)for(b+=d;b<m;b+=d)bs(a,b,c,1,!e,f,h,k,l),bs(a,b,c,-1,!e,f,h,k,l);else for(b+=d;b>m;b+=d)bs(a,b,c,1,!e,f,h,k,l),bs(a,b,c,-1,!e,f,h,
k,l)}}function cs(a,b,c,d,e,f,h,k,l){b|=0;c|=0;var m=0,n=1;for(a.xd[b][c]=n;0===m&&b>f&&b<h&&c>k&&c<l;)n+=1,a.xd[b][c]=n,e?c+=d:b+=d,m=a.xd[b][c]}function ds(a,b,c,d,e,f,h,k,l){b|=0;c|=0;var m=0;for(a.xd[b][c]=999999;0===m&&b>f&&b<h&&c>k&&c<l;)a.xd[b][c]=999999,e?c+=d:b+=d,m=a.xd[b][c]}
function Rr(a,b,c,d,e,f){if(null!==a.xd){a.abort=!1;var h=b.x,k=b.y;if(as(a,h,k)&&(h-=a.vg,h/=a.ze,k-=a.wg,k/=a.Ae,b=d.x,d=d.y,as(a,b,d)))if(b-=a.vg,b/=a.ze,d-=a.wg,d/=a.Ae,1>=Math.abs(h-b)&&1>=Math.abs(k-d))a.abort=!0;else{var l=f.x,m=f.y,n=f.x+f.width,p=f.y+f.height,l=l-a.vg,l=l/a.ze,m=m-a.wg,m=m/a.Ae,n=n-a.vg,n=n/a.ze,p=p-a.wg,p=p/a.Ae;f=Math.max(0,Math.min(a.Ap,l|0));n=Math.min(a.Ap,Math.max(0,n|0));m=Math.max(0,Math.min(a.Bp,m|0));p=Math.min(a.Bp,Math.max(0,p|0));h|=0;k|=0;b|=0;d|=0;l=90===c||
270===c;cs(a,h,k,0===c||90===c?1:-1,l,f,n,m,p);cs(a,h,k,1,!l,f,n,m,p);cs(a,h,k,-1,!l,f,n,m,p);ds(a,b,d,0===e||90===e?1:-1,90===e||270===e,f,n,m,p);ds(a,b,d,1,!(90===e||270===e),f,n,m,p);ds(a,b,d,-1,!(90===e||270===e),f,n,m,p);a.abort||(bs(a,h,k,1,!1,f,n,m,p),bs(a,h,k,-1,!1,f,n,m,p),bs(a,h,k,1,!0,f,n,m,p),bs(a,h,k,-1,!0,f,n,m,p))}}}function Pr(){w.lc(this);this.port=this.Nc=null;this.ag=[];this.hq=!1}w.$d(Pr,{Nc:!0,port:!0,ag:!0,hq:!0});
Pr.prototype.toString=function(){for(var a=this.ag,b=this.Nc.toString()+" "+a.length.toString()+":",c=0;c<a.length;c++){var d=a[c];null!==d&&(b+="\n  "+d.toString())}return b};
function es(a,b,c,d){b=b.offsetY;switch(b){case w.Yc:return 90;case w.Qc:return 180;case w.jd:return 270;case w.Zc:return 0}switch(b){case w.Yc|w.jd:return 180<c?270:90;case w.Qc|w.Zc:return 90<c&&270>=c?180:0}a=180*Math.atan2(a.height,a.width)/Math.PI;switch(b){case w.Qc|w.jd:return c>a&&c<=180+a?180:270;case w.jd|w.Zc:return c>180-a&&c<=360-a?270:0;case w.Zc|w.Yc:return c>a&&c<=180+a?90:0;case w.Yc|w.Qc:return c>180-a&&c<=360-a?180:90;case w.Qc|w.jd|w.Zc:return 90<c&&c<=180+a?180:c>180+a&&c<=360-
a?270:0;case w.jd|w.Zc|w.Yc:return 180<c&&c<=360-a?270:c>a&&180>=c?90:0;case w.Zc|w.Yc|w.Qc:return c>a&&c<=180-a?90:c>180-a&&270>=c?180:0;case w.Yc|w.Qc|w.jd:return c>180-a&&c<=180+a?180:c>180+a?270:90}d&&b!==(w.Qc|w.jd|w.Zc|w.Yc)&&(c-=15,0>c&&(c+=360));return c>a&&c<180-a?90:c>=180-a&&c<=180+a?180:c>180+a&&c<360-a?270:0}Pr.prototype.aq=function(){this.ag.length=0};
function Qr(a,b){var c=a.ag;if(0===c.length){a:if(!a.hq){c=a.hq;a.hq=!0;var d,e=null,f=a.Nc,f=f instanceof U?f:null;if(null===f||f.we)d=a.Nc.FE(a.port.Pd);else{if(!f.Y.H()){a.hq=c;break a}e=f;d=e.EE()}var h=a.ag.length=0,k=a.port.Wa(vb,w.K()),l=a.port.Wa(Kb,w.K()),f=w.Vg(k.x,k.y,0,0);f.ri(l);w.v(k);w.v(l);k=w.xb(f.x+f.width/2,f.y+f.height/2);for(d=d.i;d.next();)if(l=d.value,l.isVisible()){var m=l.ed===a.port||l.W.mi(e),n=l.computeSpot(m);if(n.sj()&&(m=m?l.Sd:l.ed,null!==m)){var p=m.U;if(null!==p){var m=
l.computeOtherPoint(p,m),p=k.yc(m),n=es(f,n,p,l.ic),q=0;0===n?(q=w.Zc,180<p&&(p-=360)):q=90===n?w.Yc:180===n?w.Qc:w.jd;n=a.ag[h];void 0===n?(n=new fs(l,p,q),a.ag[h]=n):(n.link=l,n.angle=p,n.xe=q);n.Mx.set(m);h++}}}w.v(k);a.ag.sort(Pr.prototype.XI);e=a.ag.length;k=-1;for(h=d=0;h<e;h++)n=a.ag[h],void 0!==n&&(n.xe!==k&&(k=n.xe,d=0),n.Zp=d,d++);k=-1;d=0;for(h=e-1;0<=h;h--)n=a.ag[h],void 0!==n&&(n.xe!==k&&(k=n.xe,d=n.Zp+1),n.rn=d);h=a.ag;m=a.port;e=a.Nc.bJ;k=w.K();d=w.K();l=w.K();n=w.K();m.Wa(vb,k);m.Wa(Ab,
d);m.Wa(Kb,l);m.Wa(Ib,n);var r=q=p=m=0;if(e===pr)for(var s=0;s<h.length;s++){var u=h[s];if(null!==u){var t=u.link.computeThickness();switch(u.xe){case w.Yc:q+=t;break;case w.Qc:r+=t;break;case w.jd:m+=t;break;default:case w.Zc:p+=t}}}for(var x=0,v=0,B=1,s=0;s<h.length;s++)if(u=h[s],null!==u){var y,H;if(x!==u.xe){x=u.xe;switch(x){case w.Yc:y=l;H=n;break;case w.Qc:y=n;H=k;break;case w.jd:y=k;H=d;break;default:case w.Zc:y=d,H=l}var E=H.x-y.x;H=H.y-y.y;switch(x){case w.Yc:q>Math.abs(E)?(B=Math.abs(E)/
q,q=Math.abs(E)):B=1;break;case w.Qc:r>Math.abs(H)?(B=Math.abs(H)/r,r=Math.abs(H)):B=1;break;case w.jd:m>Math.abs(E)?(B=Math.abs(E)/m,m=Math.abs(E)):B=1;break;default:case w.Zc:p>Math.abs(H)?(B=Math.abs(H)/p,p=Math.abs(H)):B=1}v=0}var V=u.fq;if(e===pr){t=u.link.computeThickness();t*=B;V.set(y);switch(x){case w.Yc:V.x=y.x+E/2+q/2-v-t/2;break;case w.Qc:V.y=y.y+H/2+r/2-v-t/2;break;case w.jd:V.x=y.x+E/2-m/2+v+t/2;break;default:case w.Zc:V.y=y.y+H/2-p/2+v+t/2}v+=t}else t=.5,e===mr&&(t=(u.Zp+1)/(u.rn+1)),
V.x=y.x+E*t,V.y=y.y+H*t}w.v(k);w.v(d);w.v(l);w.v(n);y=a.ag;for(E=0;E<y.length;E++)H=y[E],null!==H&&(H.bx=a.computeEndSegmentLength(H));a.hq=c;w.Gb(f)}c=a.ag}for(f=0;f<c.length;f++)if(y=c[f],null!==y&&y.link===b)return y;return null}Pr.prototype.XI=function(a,b){return a===b?0:null===a?-1:null===b?1:a.xe<b.xe?-1:a.xe>b.xe?1:a.angle<b.angle?-1:a.angle>b.angle?1:0};
Pr.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.Nc,this.port,sb,b.ed===this.port),d=a.Zp;if(0>d)return c;var e=a.rn;if(1>=e||!b.ic)return c;var b=a.Mx,f=a.fq;if(a.xe===w.Qc||a.xe===w.Yc)d=e-1-d;return((a=a.xe===w.Qc||a.xe===w.Zc)?b.y<f.y:b.x<f.x)?c+8*d:(a?b.y===f.y:b.x===f.x)?c:c+8*(e-1-d)};function fs(a,b,c){this.link=a;this.angle=b;this.xe=c;this.Mx=new z;this.rn=this.Zp=0;this.fq=new z;this.bx=0}
w.$d(fs,{link:!0,angle:!0,xe:!0,Mx:!0,Zp:!0,rn:!0,fq:!0,bx:!0});fs.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.xe.toString()+":"+this.Zp.toString()+"/"+this.rn.toString()+" "+this.fq.toString()+" "+this.bx.toString()+" "+this.Mx.toString()};function to(){this.ok=this.Rj=oc;this.mk=this.Pj=NaN;this.lk=this.Oj=nr;this.nk=this.Qj=NaN;this.lt=this.vr=null;this.mt=this.wr=Infinity}
to.prototype.copy=function(){var a=new to;a.Rj=this.Rj.S();a.ok=this.ok.S();a.Pj=this.Pj;a.mk=this.mk;a.Oj=this.Oj;a.lk=this.lk;a.Qj=this.Qj;a.nk=this.nk;a.vr=this.vr;a.lt=this.lt;a.wr=this.wr;a.mt=this.mt;return a};function U(a){T.call(this,a);this.xa|=4608;this.ds=new J(S);this.bp=new J(U);this.Kb=this.et=this.ol=this.es=this.cs=null;this.ie=new pg;this.ie.group=this}w.La(U,T);w.fa("Group",U);
U.prototype.cloneProtected=function(a){T.prototype.cloneProtected.call(this,a);this.xa&=-32769;a.cs=this.cs;a.es=this.es;a.ol=this.ol;a.et=this.et;var b=a.Kt(function(a){return a instanceof Hj});a.Kb=b instanceof Hj?b:null;null!==this.ie?(a.ie=this.ie.copy(),a.ie.group=a):(null!==a.ie&&(a.ie.group=null),a.ie=null)};U.prototype.ki=function(a){T.prototype.ki.call(this,a);var b=a.Vp();for(a=a.Mc;a.next();){var c=a.value;c.I();c.J(8);c.Ct();if(c instanceof T)c.Tf(b);else if(c instanceof W)for(c=c.Vf;c.next();)c.value.Tf(b)}};
U.prototype.Tn=function(a,b,c,d,e,f,h){if(a===Of&&"elements"===b)if(e instanceof Hj){var k=e;null===this.Kb?this.Kb=k:this.Kb!==k&&w.k("Cannot insert a second Placeholder into the visual tree of a Group.")}else e instanceof C&&(k=e.Kt(function(a){return a instanceof Hj}),k instanceof Hj&&(null===this.Kb?this.Kb=k:this.Kb!==k&&w.k("Cannot insert a second Placeholder into the visual tree of a Group.")));else a===Pf&&"elements"===b&&null!==this.Kb&&(d===this.Kb?this.Kb=null:d instanceof C&&this.Kb.Xl(d)&&
(this.Kb=null));T.prototype.Tn.call(this,a,b,c,d,e,f,h)};U.prototype.hj=function(a,b,c,d){this.nl=this.Kb;C.prototype.hj.call(this,a,b,c,d)};U.prototype.Yl=function(){if(!T.prototype.Yl.call(this))return!1;for(var a=this.Mc;a.next();){var b=a.value;if(b instanceof T){if(b.isVisible()&&zm(b))return!1}else if(b instanceof W&&b.isVisible()&&zm(b)&&b.W!==this&&b.$!==this)return!1}return!0};w.u(U,{placeholder:"placeholder"},function(){return this.Kb});
w.defineProperty(U,{sH:"computesBoundsAfterDrag"},function(){return 0!==(this.xa&2048)},function(a){var b=0!==(this.xa&2048);b!==a&&(w.j(a,"boolean",U,"computesBoundsAfterDrag"),this.xa^=2048,this.h("computesBoundsAfterDrag",b,a))});w.defineProperty(U,{Tw:"computesBoundsIncludingLinks"},function(){return 0!==(this.xa&4096)},function(a){w.j(a,"boolean",U,"computesBoundsIncludingLinks");var b=0!==(this.xa&4096);b!==a&&(this.xa^=4096,this.h("computesBoundsIncludingLinks",b,a))});
w.defineProperty(U,{tH:"computesBoundsIncludingLocation"},function(){return 0!==(this.xa&8192)},function(a){w.j(a,"boolean",U,"computesBoundsIncludingLocation");var b=0!==(this.xa&8192);b!==a&&(this.xa^=8192,this.h("computesBoundsIncludingLocation",b,a))});w.defineProperty(U,{dI:"handlesDragDropForMembers"},function(){return 0!==(this.xa&16384)},function(a){w.j(a,"boolean",U,"handlesDragDropForMembers");var b=0!==(this.xa&16384);b!==a&&(this.xa^=16384,this.h("handlesDragDropForMembers",b,a))});
w.u(U,{Mc:"memberParts"},function(){return this.ds.i});function ir(a,b){if(a.ds.add(b)){b instanceof U&&a.bp.add(b);var c=a.NI;if(null!==c){var d=!0,e=a.g;null!==e&&(d=e.Ua,e.Ua=!0);c(a,b);null!==e&&(e.Ua=d)}a.isVisible()&&a.we||b.td(!1)}b instanceof W&&!a.Tw||(c=a.Kb,null===c&&(c=a),c.I())}
function hr(a,b){if(a.ds.remove(b)){b instanceof U&&a.bp.remove(b);var c=a.OI;if(null!==c){var d=!0,e=a.g;null!==e&&(d=e.Ua,e.Ua=!0);c(a,b);null!==e&&(e.Ua=d)}a.isVisible()&&a.we||b.td(!0)}b instanceof W&&!a.Tw||(c=a.Kb,null===c&&(c=a),c.I())}U.prototype.tn=function(){if(0<this.ds.count){var a=this.g;if(null!==a)for(var b=this.ds.copy().i;b.next();)a.remove(b.value)}T.prototype.tn.call(this)};
w.defineProperty(U,{Rb:"layout"},function(){return this.ie},function(a){var b=this.ie;b!==a&&(null!==a&&w.G(a,pg,U,"layout"),null!==b&&(b.g=null,b.group=null),this.ie=a,null!==a&&(a.g=this.g,a.group=this),this.h("layout",b,a))});w.defineProperty(U,{NI:"memberAdded"},function(){return this.cs},function(a){var b=this.cs;b!==a&&(null!==a&&w.j(a,"function",U,"memberAdded"),this.cs=a,this.h("memberAdded",b,a))});
w.defineProperty(U,{OI:"memberRemoved"},function(){return this.es},function(a){var b=this.es;b!==a&&(null!==a&&w.j(a,"function",U,"memberRemoved"),this.es=a,this.h("memberRemoved",b,a))});w.defineProperty(U,{FA:"memberValidation"},function(){return this.ol},function(a){var b=this.ol;b!==a&&(null!==a&&w.j(a,"function",U,"memberValidation"),this.ol=a,this.h("memberValidation",b,a))});
U.prototype.canAddMembers=function(a){var b=this.g;if(null===b)return!1;b=b.ob;for(a=Bh(a).i;a.next();)if(!b.isValidMember(this,a.value))return!1;return!0};U.prototype.addMembers=function(a,b){var c=this.g;if(null===c)return!1;for(var c=c.ob,d=!0,e=Bh(a).i;e.next();){var f=e.value;!b||c.isValidMember(this,f)?f.Ka=this:d=!1}return d};
w.defineProperty(U,{OJ:"ungroupable"},function(){return 0!==(this.xa&256)},function(a){var b=0!==(this.xa&256);b!==a&&(w.j(a,"boolean",U,"ungroupable"),this.xa^=256,this.h("ungroupable",b,a))});U.prototype.canUngroup=function(){if(!this.OJ)return!1;var a=this.layer;if(null!==a&&!a.Pw)return!1;a=a.g;return null===a||a.Pw?!0:!1};
U.prototype.Tf=function(a){void 0===a&&(a=null);var b=0!==(this.xa&65536);T.prototype.Tf.call(this,a);if(!b)for(0!==(this.xa&65536)!==!0&&(this.xa^=65536),b=this.EE();b.next();){var c=b.value;if(null===a||!a.contains(c)){var d=c.W;null!==d&&d!==this&&d.mi(this)&&!d.isVisible()?c.Xb():(d=c.$,null!==d&&d!==this&&d.mi(this)&&!d.isVisible()&&c.Xb())}}};
U.prototype.findExternalLinksConnected=U.prototype.EE=function(){var a=this.Vp();a.add(this);for(var b=new J(W),c=a.i;c.next();){var d=c.value;if(d instanceof T)for(d=d.fe;d.next();){var e=d.value;a.contains(e)||b.add(e)}}return b.i};U.prototype.findExternalNodesConnected=function(){var a=this.Vp();a.add(this);for(var b=new J(T),c=a.i;c.next();){var d=c.value;if(d instanceof T)for(d=d.fe;d.next();){var e=d.value,f=e.W;a.contains(f)&&f!==this||b.add(f);e=e.$;a.contains(e)&&e!==this||b.add(e)}}return b.i};
U.prototype.findContainingGroupChain=function(){function a(b,d){null!==b&&(d.add(b),a(b.Ka,d))}var b=new J(U);a(this,b);return b};U.prototype.findSubGraphParts=U.prototype.Vp=function(){var a=new J(S);ch(a,this,!0,0,!0);a.remove(this);return a};U.prototype.td=function(a){T.prototype.td.call(this,a);for(var b=this.Mc;b.next();)b.value.td(a)};U.prototype.collapseSubGraph=U.prototype.collapseSubGraph=function(){var a=this.g;if(null!==a&&!a.wh){a.wh=!0;var b=this.Vp();gs(this,b,a.Pa,this);a.wh=!1}};
function gs(a,b,c,d){for(var e=a.Mc;e.next();){var f=e.value;f.td(!1);if(f instanceof U){var h=f;h.we&&(h.wB=h.we,gs(h,b,c,d))}if(f instanceof T)f.Tf(b),cl(c,f,d);else if(f instanceof W)for(f=f.Vf;f.next();)f.value.Tf(b)}a.we=!1}U.prototype.expandSubGraph=U.prototype.expandSubGraph=function(){var a=this.g;if(null!==a&&!a.wh){a.wh=!0;var b=this.Vp();hs(this,b,a.Pa,this);a.wh=!1}};
function hs(a,b,c,d){for(var e=a.Mc;e.next();){var f=e.value;f.td(!0);if(f instanceof U){var h=f;h.wB&&(h.wB=!1,hs(h,b,c,d))}if(f instanceof T)f.Tf(b),bl(c,f,d);else if(f instanceof W)for(f=f.Vf;f.next();)f.value.Tf(b)}a.we=!0}
w.defineProperty(U,{we:"isSubGraphExpanded"},function(){return 0!==(this.xa&512)},function(a){var b=0!==(this.xa&512);if(b!==a){w.j(a,"boolean",U,"isSubGraphExpanded");this.xa^=512;var c=this.g;this.h("isSubGraphExpanded",b,a);b=this.DJ;if(null!==b){var d=!0;null!==c&&(d=c.Ua,c.Ua=!0);b(this);null!==c&&(c.Ua=d)}null!==c&&c.oa.fb?null!==this.Kb&&this.Kb.I():a?this.expandSubGraph():this.collapseSubGraph()}});
w.defineProperty(U,{wB:"wasSubGraphExpanded"},function(){return 0!==(this.xa&1024)},function(a){var b=0!==(this.xa&1024);b!==a&&(w.j(a,"boolean",U,"wasSubGraphExpanded"),this.xa^=1024,this.h("wasSubGraphExpanded",b,a))});w.defineProperty(U,{DJ:"subGraphExpandedChanged"},function(){return this.et},function(a){var b=this.et;b!==a&&(null!==a&&w.j(a,"function",U,"subGraphExpandedChanged"),this.et=a,this.h("subGraphExpandedChanged",b,a))});
U.prototype.move=function(a){var b=this.position,c=b.x;isNaN(c)&&(c=0);b=b.y;isNaN(b)&&(b=0);var c=a.x-c,b=a.y-b,d=w.xb(c,b);T.prototype.move.call(this,a);for(a=this.Vp().i;a.next();){var e=a.value;if(!(e instanceof W||e instanceof T&&e.lf)){var f=e.position,h=e.location;f.H()?(d.x=f.x+c,d.y=f.y+b,e.position=d):h.H()&&(d.x=h.x+c,d.y=h.y+b,e.location=d)}}for(a.reset();a.next();)e=a.value,e instanceof W&&(f=e.position,d.x=f.x+c,d.y=f.y+b,e.move(d));w.v(d)};
w.defineProperty(U,{Qn:null},function(){return 0!==(this.xa&32768)},function(a){0!==(this.xa&32768)!==a&&(this.xa^=32768)});function Hj(){G.call(this);this.ff=dd;this.Ps=new A(NaN,NaN,NaN,NaN)}w.La(Hj,G);w.fa("Placeholder",Hj);Hj.prototype.cloneProtected=function(a){G.prototype.cloneProtected.call(this,a);a.ff=this.ff.S();a.Ps=this.Ps.copy()};Hj.prototype.uk=function(a){if(null===this.background&&null===this.jn)return!1;var b=this.Ia;return db(0,0,b.width,b.height,a.x,a.y)};
Hj.prototype.Ln=function(){var a=this.U;null!==a&&(a instanceof U||a instanceof dh)||w.k("Placeholder is not inside a Group or Adornment.");if(a instanceof U){var b=this.computeBorder(this.Ps),c=this.Sc;Pa(c,b.width||0,b.height||0);yo(this,0,0,c.width,c.height);for(var c=a.Mc,d=!1;c.next();)if(c.value.isVisible()){d=!0;break}!d||isNaN(b.x)||isNaN(b.y)||(c=new z,c.Vn(b,a.zf),a.location=new z(c.x,c.y))}else{var b=this.Aa,c=this.Sc,d=this.padding,e=d.left+d.right,f=d.top+d.bottom;if(b.H())Pa(c,b.width+
e||0,b.height+f||0),yo(this,-d.left,-d.top,c.width,c.height);else{var h=a.qb,k=h.Wa(vb,w.K()),b=w.Vg(k.x,k.y,0,0);b.ri(h.Wa(Kb,k));b.ri(h.Wa(Ab,k));b.ri(h.Wa(Ib,k));a.Ri.l(b.x,b.y);Pa(c,b.width+e||0,b.height+f||0);yo(this,-d.left,-d.top,c.width,c.height);w.v(k);w.Gb(b)}}};Hj.prototype.hj=function(a,b,c,d){var e=this.Y;e.x=a;e.y=b;e.width=c;e.height=d};
Hj.prototype.computeBorder=function(a){var b=this.U;if(b instanceof U){var c=b;if(c.sH&&this.Ps.H()){var d=c.g;if(null!==d&&(d=d.Za,d instanceof hh&&!d.pr&&null!==d.Wb&&!d.Wb.contains(c)))return a.assign(this.Ps),a}}var c=w.Df(),d=this.computeMemberBounds(c),e=this.padding;a.l(d.x-e.left,d.y-e.top,Math.max(d.width+e.left+e.right,0),Math.max(d.height+e.top+e.bottom,0));w.Gb(c);b instanceof U&&(c=b,c.tH&&c.location.H()&&a.ri(c.location));return a};
Hj.prototype.computeMemberBounds=function(a){if(!(this.U instanceof U))return a.l(0,0,0,0),a;for(var b=this.U,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,h=b.Mc;h.next();){var k=h.value;if(k.isVisible()){if(k instanceof W){var l=k;if(!b.Tw)continue;if(ym(l))continue;if(l.W===b||l.$===b)continue}k=k.Y;k.left<c&&(c=k.left);k.top<d&&(d=k.top);k.right>e&&(e=k.right);k.bottom>f&&(f=k.bottom)}}isFinite(c)&&isFinite(d)?a.l(c,d,e-c,f-d):(b=b.location,c=this.padding,a.l(b.x+c.left,b.y+c.top,0,0));return a};
w.defineProperty(Hj,{padding:"padding"},function(){return this.ff},function(a){"number"===typeof a?a=new eb(a):w.G(a,eb,Hj,"padding");var b=this.ff;b.L(a)||(this.ff=a=a.S(),this.h("padding",b,a))});function pg(){0<arguments.length&&w.hd(pg);w.lc(this);this.bz=this.Z=null;this.Wj=this.Kr=!0;this.Qr=!1;this.Kq=(new z(0,0)).freeze();this.Mr=this.Nr=!0;this.rC="";this.So=!1;this.oz=null}w.fa("Layout",pg);
pg.prototype.cloneProtected=function(a){a.Kr=this.Kr;a.Wj=this.Wj;a.Qr=this.Qr;a.Kq.assign(this.Kq);a.Nr=this.Nr;a.Mr=this.Mr;a.rC=this.rC;this.Wj||(a.So=!0)};pg.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};pg.prototype.fc=function(a){w.Ej(this,a)};pg.prototype.toString=function(){var a=w.hf(Object.getPrototypeOf(this)),a=a+"(";null!==this.group&&(a+=" in "+this.group);null!==this.g&&(a+=" for "+this.g);return a+")"};
w.defineProperty(pg,{g:"diagram"},function(){return this.Z},function(a){null!==a&&w.G(a,D,pg,"diagram");this.Z=a});w.defineProperty(pg,{group:"group"},function(){return this.bz},function(a){this.bz!==a&&(null!==a&&w.G(a,U,pg,"group"),this.bz=a,null!==a&&(this.Z=a.g))});w.defineProperty(pg,{tI:"isOngoing"},function(){return this.Kr},function(a){this.Kr!==a&&(w.j(a,"boolean",pg,"isOngoing"),this.Kr=a)});
w.defineProperty(pg,{kF:"isInitial"},function(){return this.Wj},function(a){w.j(a,"boolean",pg,"isInitial");this.Wj=a;a||(this.So=!0)});w.defineProperty(pg,{Ax:"isViewportSized"},function(){return this.Qr},function(a){this.Qr!==a&&(w.j(a,"boolean",pg,"isViewportSized"),(this.Qr=a)&&this.J())});w.defineProperty(pg,{eu:"isRouting"},function(){return this.Nr},function(a){this.Nr!==a&&(w.j(a,"boolean",pg,"isRouting"),this.Nr=a)});
w.defineProperty(pg,{nF:"isRealtime"},function(){return this.Mr},function(a){this.Mr!==a&&(w.j(a,"boolean",pg,"isRealtime"),this.Mr=a)});w.defineProperty(pg,{yf:"isValidLayout"},function(){return this.So},function(a){this.So!==a&&(w.j(a,"boolean",pg,"isValidLayout"),this.So=a,a||(a=this.g,null!==a&&(a.bv=!0)))});pg.prototype.invalidateLayout=pg.prototype.J=function(){if(this.So){var a=this.g;if(null!==a&&!a.oa.fb){var b=a.Pa;!b.Ro&&(b.kf&&b.pi(),this.tI&&a.Fn||this.kF&&!a.Fn)&&(this.yf=!1,a.Le())}}};
w.defineProperty(pg,{network:"network"},function(){return this.oz},function(a){var b=this.oz;b!==a&&(null!==a&&w.G(a,qg,pg,"network"),null!==b&&(b.Rb=null),this.oz=a,null!==a&&(a.Rb=this))});pg.prototype.createNetwork=function(){return new qg};pg.prototype.makeNetwork=function(a){var b=this.createNetwork();b.Rb=this;a instanceof D?(b.rk(a.dg,!0),b.rk(a.links,!0)):a instanceof U?b.rk(a.Mc):b.rk(a.i);return b};
pg.prototype.updateParts=function(){var a=this.g;if(null===a&&null!==this.network)for(var b=this.network.vertexes.i;b.next();){var c=b.value.Nc;if(null!==c&&(a=c.g,null!==a))break}this.yf=!0;try{null!==a&&a.Tb("Layout"),this.commitLayout()}finally{null!==a&&a.Fd("Layout")}};pg.prototype.commitLayout=function(){for(var a=this.network.vertexes.i;a.next();)a.value.commit();if(this.eu)for(a=this.network.edges.i;a.next();)a.value.commit()};
pg.prototype.doLayout=function(a){null===a&&w.k("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");var b=new J(S);a instanceof D?(is(this,b,a.dg,!0,this.Qn,!0,!1,!0),is(this,b,a.Hk,!0,this.Qn,!0,!1,!0)):a instanceof U?is(this,b,a.Mc,!1,this.Qn,!0,!1,!0):b.Hc(a.i);var c=b.count;if(0<c){a=this.g;null!==a&&a.Tb("Layout");for(var c=Math.ceil(Math.sqrt(c)),d=this.oe.x,e=d,f=this.oe.y,h=0,k=0,b=b.i;b.next();){var l=b.value;l.Ze();var m=l.za,n=m.width,
m=m.height;l.moveTo(e,f);l instanceof U&&(l.Qn=!1);e+=Math.max(n,50)+20;k=Math.max(k,Math.max(m,50));h>=c-1?(h=0,e=d,f+=k+20,k=0):h++}null!==a&&a.Fd("Layout")}this.yf=!0};pg.prototype.Qn=function(a){return!a.location.H()||a instanceof U&&a.Qn?!0:!1};
function is(a,b,c,d,e,f,h,k){for(c=c.i;c.next();){var l=c.value;d&&!l.cq||null!==e&&!e(l)||!l.canLayout()||(f&&l instanceof T?l.lf||(l instanceof U?null===l.Rb?is(a,b,l.Mc,!1,e,f,h,k):(js(l),b.add(l)):(js(l),b.add(l))):h&&l instanceof W?b.add(l):!k||!l.de()||l instanceof T||(js(l),b.add(l)))}}function js(a){var b=a.Y;(0===b.width||0===b.height||isNaN(b.width)||isNaN(b.height))&&a.Ze()}
pg.prototype.collectParts=pg.prototype.mH=function(a){var b=new J(S);a instanceof D?(is(this,b,a.dg,!0,null,!0,!0,!0),is(this,b,a.links,!0,null,!0,!0,!0),is(this,b,a.Hk,!0,null,!0,!0,!0)):a instanceof U?is(this,b,a.Mc,!1,null,!0,!0,!0):is(this,b,a.i,!1,null,!0,!0,!0);return b};w.defineProperty(pg,{oe:"arrangementOrigin"},function(){return this.Kq},function(a){w.G(a,z,pg,"arrangementOrigin");this.Kq.L(a)||(this.Kq.assign(a),this.J())});
pg.prototype.initialOrigin=function(a){var b=this.group;if(null!==b){var c=b.position.copy();(isNaN(c.x)||isNaN(c.y))&&c.set(a);b=b.placeholder;null!==b&&(c=b.Wa(vb),(isNaN(c.x)||isNaN(c.y))&&c.set(a),c.x+=b.padding.left,c.y+=b.padding.top);return c}return a};
function qg(){w.lc(this);this.ie=null;if(this.vertexes)for(var a=this.vertexes.i;a.next();){var b=a.value;b.clear();b.network=null}if(this.edges)for(a=this.edges.i;a.next();)b=a.value,b.clear(),b.network=null;this.vertexes=new J(ks);this.edges=new J(ls);this.Jx=new ka(T,ks);this.Fx=new ka(W,ls)}w.fa("LayoutNetwork",qg);
qg.prototype.clear=function(){if(this.vertexes)for(var a=this.vertexes.i;a.next();){var b=a.value;b.clear();b.network=null}if(this.edges)for(a=this.edges.i;a.next();)b=a.value,b.clear(),b.network=null;this.vertexes=new J(ks);this.edges=new J(ls);this.Jx=new ka(T,ks);this.Fx=new ka(W,ls)};
qg.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutNetwork"+(null!==this.Rb?"("+this.Rb.toString()+")":"");if(0>=a)return b;b+=" vertexes: "+this.vertexes.count+" edges: "+this.edges.count;if(1<a){for(var c=this.vertexes.i;c.next();)b+="\n    "+c.value.toString(a-1);for(c=this.edges.i;c.next();)b+="\n    "+c.value.toString(a-1)}return b};w.defineProperty(qg,{Rb:"layout"},function(){return this.ie},function(a){this.ie=a});qg.prototype.createVertex=function(){return new ks};
qg.prototype.createEdge=function(){return new ls};
qg.prototype.addParts=qg.prototype.rk=function(a,b,c){if(null!==a){void 0===b&&(b=!1);w.j(b,"boolean",qg,"addParts:toplevelonly");void 0===c&&(c=null);null===c&&(c=function(a){if(a instanceof T)return!a.lf;if(a instanceof W){var b=a.W;if(null===b||b.lf)return!1;a=a.$;return null===a||a.lf?!1:!0}return!1});for(a=a.i;a.next();){var d=a.value;if(d instanceof T&&(!b||d.cq)&&d.canLayout()&&c(d))if(d instanceof U&&null===d.Rb)this.rk(d.Mc,!1);else if(null===this.wn(d)){var e=this.createVertex();e.Nc=d;
this.Cl(e)}}for(a.reset();a.next();)if(d=a.value,d instanceof W&&(!b||d.cq)&&d.canLayout()&&c(d)&&null===this.gx(d)){var f=d.W,e=d.$;null!==f&&null!==e&&f!==e&&(f=this.findGroupVertex(f),e=this.findGroupVertex(e),null!==f&&null!==e&&this.gq(f,e,d))}}};qg.prototype.findGroupVertex=function(a){if(null===a)return null;var b=a.findVisibleNode();if(null===b)return null;a=this.wn(b);if(null!==a)return a;for(b=b.Ka;null!==b;){a=this.wn(b);if(null!==a)return a;b=b.Ka}return null};
qg.prototype.addVertex=qg.prototype.Cl=function(a){if(null!==a){this.vertexes.add(a);var b=a.Nc;null!==b&&this.Jx.add(b,a);a.network=this}};qg.prototype.addNode=qg.prototype.wt=function(a){if(null===a)return null;var b=this.wn(a);null===b&&(b=this.createVertex(),b.Nc=a,this.Cl(b));return b};qg.prototype.deleteVertex=qg.prototype.yE=function(a){if(null!==a&&ms(this,a)){for(var b=a.Oe,c=b.count-1;0<=c;c--){var d=b.da(c);this.Qp(d)}b=a.He;for(c=b.count-1;0<=c;c--)d=b.da(c),this.Qp(d)}};
function ms(a,b){if(null===b)return!1;var c=a.vertexes.remove(b);c&&(a.Jx.remove(b.Nc),b.network=null);return c}qg.prototype.deleteNode=function(a){null!==a&&(a=this.wn(a),null!==a&&this.yE(a))};qg.prototype.findVertex=qg.prototype.wn=function(a){return null===a?null:this.Jx.ka(a)};qg.prototype.addEdge=qg.prototype.Dp=function(a){if(null!==a){this.edges.add(a);var b=a.link;null!==b&&null===this.gx(b)&&this.Fx.add(b,a);b=a.toVertex;null!==b&&b.dE(a);b=a.fromVertex;null!==b&&b.bE(a);a.network=this}};
qg.prototype.addLink=function(a){if(null===a)return null;var b=a.W,c=a.$,d=this.gx(a);null===d?(d=this.createEdge(),d.link=a,null!==b&&(d.fromVertex=this.wt(b)),null!==c&&(d.toVertex=this.wt(c)),this.Dp(d)):(d.fromVertex=null!==b?this.wt(b):null,d.toVertex=null!==c?this.wt(c):null);return d};qg.prototype.deleteEdge=qg.prototype.Qp=function(a){if(null!==a){var b=a.toVertex;null!==b&&b.xE(a);b=a.fromVertex;null!==b&&b.wE(a);ns(this,a)}};
function ns(a,b){null!==b&&a.edges.remove(b)&&(a.Fx.remove(b.link),b.network=null)}qg.prototype.deleteLink=function(a){null!==a&&(a=this.gx(a),null!==a&&this.Qp(a))};qg.prototype.findEdge=qg.prototype.gx=function(a){return null===a?null:this.Fx.ka(a)};qg.prototype.linkVertexes=qg.prototype.gq=function(a,b,c){if(null===a||null===b)return null;if(a.network===this&&b.network===this){var d=this.createEdge();d.link=c;d.fromVertex=a;d.toVertex=b;this.Dp(d);return d}return null};
qg.prototype.reverseEdge=qg.prototype.Yx=function(a){if(null!==a){var b=a.fromVertex,c=a.toVertex;null!==b&&null!==c&&(b.wE(a),c.xE(a),a.Yx(),b.dE(a),c.bE(a))}};qg.prototype.deleteSelfEdges=qg.prototype.Zw=function(){for(var a=w.lb(),b=this.edges.i;b.next();){var c=b.value;c.fromVertex===c.toVertex&&a.push(c)}b=a.length;for(c=0;c<b;c++)this.Qp(a[c]);w.va(a)};
qg.prototype.deleteArtificialVertexes=function(){for(var a=w.lb(),b=this.vertexes.i;b.next();){var c=b.value;null===c.Nc&&a.push(c)}for(var c=a.length,d=0;d<c;d++)this.yE(a[d]);b=w.lb();for(c=this.edges.i;c.next();)d=c.value,null===d.link&&b.push(d);c=b.length;for(d=0;d<c;d++)this.Qp(b[d]);w.va(a);w.va(b)};function os(a){for(var b=w.lb(),c=a.edges.i;c.next();){var d=c.value;null!==d.fromVertex&&null!==d.toVertex||b.push(d)}c=b.length;for(d=0;d<c;d++)a.Qp(b[d]);w.va(b)}
qg.prototype.splitIntoSubNetworks=qg.prototype.CJ=function(){this.deleteArtificialVertexes();os(this);this.Zw();for(var a=new I(qg),b=!0;b;)for(var b=!1,c=this.vertexes.i;c.next();){var d=c.value;if(0<d.Oe.count||0<d.He.count){b=this.Rb.createNetwork();a.add(b);ps(this,b,d);b=!0;break}}a.sort(function(a,b){return null===a||null===b||a===b?0:b.vertexes.count-a.vertexes.count});return a};
function ps(a,b,c){if(null!==c&&c.network!==b){ms(a,c);b.Cl(c);for(var d=c.kc;d.next();){var e=d.value;e.network!==b&&(ns(a,e),b.Dp(e),ps(a,b,e.fromVertex))}for(d=c.hc;d.next();)c=d.value,c.network!==b&&(ns(a,c),b.Dp(c),ps(a,b,c.toVertex))}}qg.prototype.findAllParts=function(){for(var a=new J(S),b=this.vertexes.i;b.next();)a.add(b.value.Nc);for(b=this.edges.i;b.next();)a.add(b.value.link);return a};
function ks(){w.lc(this);this.network=null;this.M=(new A(0,0,10,10)).freeze();this.T=(new z(5,5)).freeze();this.pd=this.Vd=null;this.Oe=new I(ls);this.He=new I(ls)}w.fa("LayoutVertex",ks);ks.prototype.clear=function(){this.pd=this.Vd=null;this.Oe=new I(ls);this.He=new I(ls)};
ks.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutVertex#"+w.Jd(this);if(0<a&&(b+=null!==this.Nc?"("+this.Nc.toString()+")":"",1<a)){a="";for(var c=!0,d=this.Oe.i;d.next();){var e=d.value;c?c=!1:a+=",";a+=e.toString(0)}e="";c=!0;for(d=this.He.i;d.next();){var f=d.value;c?c=!1:e+=",";e+=f.toString(0)}b+=" sources: "+a+" destinations: "+e}return b};
w.defineProperty(ks,{data:"data"},function(){return this.Vd},function(a){this.Vd=a;if(null!==a){var b=a.bounds;a=b.x;var c=b.y,d=b.width,b=b.height;this.T.l(d/2,b/2);this.M.l(a,c,d,b)}});w.defineProperty(ks,{Nc:"node"},function(){return this.pd},function(a){if(this.pd!==a){this.pd=a;a.Ze();var b=a.Y,c=b.x,d=b.y,e=b.width,b=b.height;isNaN(c)&&(c=0);isNaN(d)&&(d=0);this.M.l(c,d,e,b);if(!(a instanceof U)&&(a=a.Xf.Wa(Fb),a.H())){this.T.l(a.x-c,a.y-d);return}this.T.l(e/2,b/2)}});
w.defineProperty(ks,{jb:"bounds"},function(){return this.M},function(a){this.M.L(a)||this.M.assign(a)});w.defineProperty(ks,{focus:"focus"},function(){return this.T},function(a){this.T.L(a)||this.T.assign(a)});w.defineProperty(ks,{ja:"centerX"},function(){return this.M.x+this.T.x},function(a){var b=this.M;b.x+this.T.x!==a&&(b.Ra(),b.x=a-this.T.x,b.freeze())});w.defineProperty(ks,{ra:"centerY"},function(){return this.M.y+this.T.y},function(a){var b=this.M;b.y+this.T.y!==a&&(b.Ra(),b.y=a-this.T.y,b.freeze())});
w.defineProperty(ks,{Qt:"focusX"},function(){return this.T.x},function(a){var b=this.T;b.x!==a&&(b.Ra(),b.x=a,b.freeze())});w.defineProperty(ks,{Rt:"focusY"},function(){return this.T.y},function(a){var b=this.T;b.y!==a&&(b.Ra(),b.y=a,b.freeze())});w.defineProperty(ks,{x:"x"},function(){return this.M.x},function(a){var b=this.M;b.x!==a&&(b.Ra(),b.x=a,b.freeze())});w.defineProperty(ks,{y:"y"},function(){return this.M.y},function(a){var b=this.M;b.y!==a&&(b.Ra(),b.y=a,b.freeze())});
w.defineProperty(ks,{width:"width"},function(){return this.M.width},function(a){var b=this.M;b.width!==a&&(b.Ra(),b.width=a,b.freeze())});w.defineProperty(ks,{height:"height"},function(){return this.M.height},function(a){var b=this.M;b.height!==a&&(b.Ra(),b.height=a,b.freeze())});
ks.prototype.commit=function(){var a=this.Vd;if(null!==a){var b=this.jb,c=a.bounds;w.Qa(c)?(c.x=b.x,c.y=b.y,c.width=b.width,c.height=b.height):a.bounds=b.copy()}else if(a=this.Nc,null!==a){b=this.jb;if(!(a instanceof U)){var c=a.Y,d=a.Xf.Wa(Fb);if(c.H()&&d.H()){a.moveTo(b.x+this.Qt-(d.x-c.x),b.y+this.Rt-(d.y-c.y));return}}a.moveTo(b.x,b.y)}};ks.prototype.addSourceEdge=ks.prototype.dE=function(a){null!==a&&(this.Oe.contains(a)||this.Oe.add(a))};
ks.prototype.deleteSourceEdge=ks.prototype.xE=function(a){null!==a&&this.Oe.remove(a)};ks.prototype.addDestinationEdge=ks.prototype.bE=function(a){null!==a&&(this.He.contains(a)||this.He.add(a))};ks.prototype.deleteDestinationEdge=ks.prototype.wE=function(a){null!==a&&this.He.remove(a)};w.u(ks,{BJ:"sourceVertexes"},function(){for(var a=new J(ks),b=this.kc;b.next();)a.add(b.value.fromVertex);return a.i});
w.u(ks,{GH:"destinationVertexes"},function(){for(var a=new J(ks),b=this.hc;b.next();)a.add(b.value.toVertex);return a.i});w.u(ks,{vertexes:"vertexes"},function(){for(var a=new J(ks),b=this.kc;b.next();)a.add(b.value.fromVertex);for(b=this.hc;b.next();)a.add(b.value.toVertex);return a.i});w.u(ks,{kc:"sourceEdges"},function(){return this.Oe.i});w.u(ks,{hc:"destinationEdges"},function(){return this.He.i});
w.u(ks,{edges:"edges"},function(){for(var a=new I(ls),b=this.kc;b.next();)a.add(b.value);for(b=this.hc;b.next();)a.add(b.value);return a.i});w.u(ks,{LH:"edgesCount"},function(){return this.Oe.count+this.He.count});var qs;ks.standardComparer=qs=function(a,b){var c=a.pd,d=b.pd;return c?d?(c=c.text,d=d.text,c<d?-1:c>d?1:0):1:null!==d?-1:0};
ks.smartComparer=function(a,b){if(null!==a){if(null!==b){var c=a.pd,d=b.pd;if(null!==c){if(null!==d){for(var c=c.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/),d=d.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/),e=0;e<c.length;e++)if(""!==d[e]&&void 0!==d[e]){var f=parseFloat(c[e]),h=parseFloat(d[e]);if(isNaN(f)){if(!isNaN(h))return 1;if(0!==c[e].localeCompare(d[e]))return c[e].localeCompare(d[e])}else{if(isNaN(h))return-1;if(0!==f-h)return f-
h}}else if(""!==c[e])return 1;return""!==d[e]&&void 0!==d[e]?-1:0}return 1}return null!==d?-1:0}return 1}return null!==b?-1:0};function ls(){w.lc(this);this.toVertex=this.fromVertex=this.link=this.data=this.network=null}w.fa("LayoutEdge",ls);ls.prototype.clear=function(){this.toVertex=this.fromVertex=this.link=this.data=null};
ls.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutEdge#"+w.Jd(this);0<a&&(b+=null!==this.link?"("+this.link.toString()+")":"",1<a&&(b+=" "+(this.fromVertex?this.fromVertex.toString():"null")+" --\x3e "+(this.toVertex?this.toVertex.toString():"null")));return b};ls.prototype.Yx=function(){var a=this.fromVertex;this.fromVertex=this.toVertex;this.toVertex=a};ls.prototype.commit=function(){};
ls.prototype.getOtherVertex=ls.prototype.VH=function(a){return this.toVertex===a?this.fromVertex:this.fromVertex===a?this.toVertex:null};function Ln(){0<arguments.length&&w.hd(Ln);pg.call(this);this.Ax=!0;this.rt=this.st=NaN;this.Jj=(new ha(NaN,NaN)).freeze();this.ai=(new ha(10,10)).freeze();this.ge=rs;this.kd=ss;this.$h=ts;this.Jh=us}w.La(Ln,pg);w.fa("GridLayout",Ln);
Ln.prototype.cloneProtected=function(a){pg.prototype.cloneProtected.call(this,a);a.st=this.st;a.rt=this.rt;a.Jj.assign(this.Jj);a.ai.assign(this.ai);a.ge=this.ge;a.kd=this.kd;a.$h=this.$h;a.Jh=this.Jh};Ln.prototype.fc=function(a){a.De===Ln?a===ts||a===vs||a===ws||a===xs?this.sorting=a:a===ss||a===ys?this.Of=a:a===rs||a===zs?this.alignment=a:w.k("Unknown enum value: "+a):pg.prototype.fc.call(this,a)};
Ln.prototype.doLayout=function(a){null===a&&w.k("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");this.oe=this.initialOrigin(this.oe);var b=this.g;a=this.mH(a);for(var c=a.copy().i;c.next();){var d=c.value;if(d instanceof W){var e=d;if(null!==e.W||null!==e.$){a.remove(e);continue}}d.Ze();if(d instanceof U)for(d=d.Mc;d.next();)a.remove(d.value)}e=a.dc();if(0!==e.length){switch(this.sorting){case xs:e.reverse();break;case ts:e.sort(this.comparer);
break;case vs:e.sort(this.comparer),e.reverse()}var f=this.SJ;isNaN(f)&&(f=0);var h=this.yG,h=isNaN(h)&&null!==b?Math.max(b.sb.width-b.padding.left-b.padding.right,0):Math.max(this.yG,0);0>=f&&0>=h&&(f=1);a=this.spacing.width;isFinite(a)||(a=0);c=this.spacing.height;isFinite(c)||(c=0);null!==b&&b.Tb("Layout");d=[];switch(this.alignment){case zs:var k=a,l=c,m=Math.max(this.Hp.width,1);if(!isFinite(m))for(var n=m=0;n<e.length;n++)var p=e[n],q=p.za,m=Math.max(m,q.width);var m=Math.max(m+k,1),r=Math.max(this.Hp.height,
1);if(!isFinite(r))for(n=r=0;n<e.length;n++)p=e[n],q=p.za,r=Math.max(r,q.height);for(var r=Math.max(r+l,1),s=this.Of,u=this.oe.x,t=u,x=this.oe.y,v=0,B=0,n=0;n<e.length;n++){var p=e[n],q=p.za,y=Math.ceil((q.width+k)/m)*m,H=Math.ceil((q.height+l)/r)*r,E=0;switch(s){case ys:E=Math.abs(t-q.width);break;default:E=t+q.width}if(0<f&&v>f-1||0<h&&0<v&&E>h)d.push(new A(0,x,h+k,B)),v=0,t=u,x+=B,B=0;B=Math.max(B,H);H=0;switch(s){case ys:H=-q.width;break;default:H=0}p.moveTo(t+H,x);switch(s){case ys:t-=y;break;
default:t+=y}v++}d.push(new A(0,x,h+k,B));break;case rs:k=f;l=a;m=c;n=Math.max(this.Hp.width,1);p=x=y=0;q=w.K();for(f=0;f<e.length;f++)r=e[f],s=r.za,u=ar(r,r.Xf,r.zf,q),y=Math.max(y,u.x),x=Math.max(x,s.width-u.x),p=Math.max(p,u.y);t=this.Of;switch(t){case ys:y+=l;break;default:x+=l}var n=isFinite(n)?Math.max(n+l,1):Math.max(y+x,1),V=x=this.oe.x,v=this.oe.y,B=0;h>=y&&(h-=y);for(var y=H=0,E=Math.max(this.Hp.height,1),ba=p=0,Q=!0,$=w.K(),f=0;f<e.length;f++){r=e[f];s=r.za;u=ar(r,r.Xf,r.zf,q);if(0<B)switch(t){case ys:V=
(V-x-(s.width-u.x))/n;V=Xa(Math.round(V),V)?Math.round(V):Math.floor(V);V=V*n+x;break;default:V=(V-x+u.x)/n,V=Xa(Math.round(V),V)?Math.round(V):Math.ceil(V),V=V*n+x}else switch(t){case ys:H=V+u.x+s.width;break;default:H=V-u.x}var ca=0;switch(t){case ys:ca=-(V+u.x)+H;break;default:ca=V+s.width-u.x-H}if(0<k&&B>k-1||0<h&&0<B&&ca>h){d.push(new A(0,Q?v-p:v,h+l,ba+p+m));for(V=0;V<B&&f!==B;V++){var ca=e[f-B+V],R=ar(ca,ca.Xf,ca.zf,$);ca.moveTo(ca.position.x,ca.position.y+p-R.y)}ba+=m;v=Q?v+ba:v+(ba+p);B=
ba=p=0;V=x;Q=!1}V===x&&(y=t===ys?Math.max(y,s.width-u.x):Math.min(y,-u.x));p=Math.max(p,u.y);ba=Math.max(ba,s.height-u.y);isFinite(E)&&(ba=Math.max(ba,Math.max(s.height,E)-u.y));Q?r.moveTo(V-u.x,v-u.y):r.moveTo(V-u.x,v);switch(t){case ys:V-=u.x+l;break;default:V+=s.width-u.x+l}B++}d.push(new A(0,v,h+l,(Q?ba:ba+p)+m));for(V=0;V<B&&f!==B;V++)ca=e[f-B+V],R=ar(ca,ca.Xf,ca.zf,q),ca.moveTo(ca.position.x,ca.position.y+p-R.y);w.v(q);w.v($);if(t===ys)for(f=0;f<d.length;f++)e=d[f],e.width+=y,e.x-=y;else for(f=
0;f<d.length;f++)e=d[f],e.x>y&&(e.width+=e.x-y,e.x=y)}for(k=f=h=e=0;k<d.length;k++)l=d[k],e=Math.min(e,l.x),h=Math.min(h,l.y),f=Math.max(f,l.x+l.width);this.Of===ys?this.commitLayers(d,new z(e+a/2-(f+e),h-c/2)):this.commitLayers(d,new z(e-a/2,h-c/2));null!==b&&b.Fd("Layout");this.yf=!0}};Ln.prototype.commitLayers=function(){};
w.defineProperty(Ln,{yG:"wrappingWidth"},function(){return this.st},function(a){this.st!==a&&(w.j(a,"number",Ln,"wrappingWidth"),0<a||isNaN(a))&&(this.st=a,this.Ax=isNaN(a),this.J())});w.defineProperty(Ln,{SJ:"wrappingColumn"},function(){return this.rt},function(a){this.rt!==a&&(w.j(a,"number",Ln,"wrappingColumn"),0<a||isNaN(a))&&(this.rt=a,this.J())});w.defineProperty(Ln,{Hp:"cellSize"},function(){return this.Jj},function(a){w.G(a,ha,Ln,"cellSize");this.Jj.L(a)||(this.Jj.assign(a),this.J())});
w.defineProperty(Ln,{spacing:"spacing"},function(){return this.ai},function(a){w.G(a,ha,Ln,"spacing");this.ai.L(a)||(this.ai.assign(a),this.J())});w.defineProperty(Ln,{alignment:"alignment"},function(){return this.ge},function(a){this.ge!==a&&(w.mb(a,Ln,Ln,"alignment"),a===rs||a===zs)&&(this.ge=a,this.J())});w.defineProperty(Ln,{Of:"arrangement"},function(){return this.kd},function(a){this.kd!==a&&(w.mb(a,Ln,Ln,"arrangement"),a===ss||a===ys)&&(this.kd=a,this.J())});
w.defineProperty(Ln,{sorting:"sorting"},function(){return this.$h},function(a){this.$h!==a&&(w.mb(a,Ln,Ln,"sorting"),a===ws||a===xs||a===ts||a===vs)&&(this.$h=a,this.J())});w.defineProperty(Ln,{comparer:"comparer"},function(){return this.Jh},function(a){this.Jh!==a&&(w.j(a,"function",Ln,"comparer"),this.Jh=a,this.J())});var us;Ln.standardComparer=us=function(a,b){var c=a.text,d=b.text;return c<d?-1:c>d?1:0};
Ln.smartComparer=function(a,b){if(null!==a){if(null!==b){for(var c=a.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/),d=b.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/),e=0;e<c.length;e++)if(""!==d[e]&&void 0!==d[e]){var f=parseFloat(c[e]),h=parseFloat(d[e]);if(isNaN(f)){if(!isNaN(h))return 1;if(0!==c[e].localeCompare(d[e]))return c[e].localeCompare(d[e])}else{if(isNaN(h))return-1;if(0!==f-h)return f-h}}else if(""!==c[e])return 1;return""!==
d[e]&&void 0!==d[e]?-1:0}return 1}return null!==b?-1:0};var zs;Ln.Position=zs=w.p(Ln,"Position",0);var rs;Ln.Location=rs=w.p(Ln,"Location",1);var ss;Ln.LeftToRight=ss=w.p(Ln,"LeftToRight",2);var ys;Ln.RightToLeft=ys=w.p(Ln,"RightToLeft",3);var ws;Ln.Forward=ws=w.p(Ln,"Forward",4);var xs;Ln.Reverse=xs=w.p(Ln,"Reverse",5);var ts;Ln.Ascending=ts=w.p(Ln,"Ascending",6);var vs;Ln.Descending=vs=w.p(Ln,"Descending",7);
function As(){0<arguments.length&&w.hd(As);pg.call(this);this.Ty=this.Do=this.Wd=0;this.qr=360;this.Sy=Bs;this.$k=0;this.yC=Bs;this.iv=this.Eg=this.PD=0;this.Gw=new Cs;this.jv=this.Qm=0;this.MG=600;this.Ds=NaN;this.Mq=1;this.dt=0;this.gt=360;this.kd=Bs;this.aa=Ds;this.$h=Es;this.Jh=qs;this.ai=6;this.ss=Fs}w.La(As,pg);w.fa("CircularLayout",As);
As.prototype.cloneProtected=function(a){pg.prototype.cloneProtected.call(this,a);a.Ds=this.Ds;a.Mq=this.Mq;a.dt=this.dt;a.gt=this.gt;a.kd=this.kd;a.aa=this.aa;a.$h=this.$h;a.Jh=this.Jh;a.ai=this.ai;a.ss=this.ss};As.prototype.fc=function(a){if(a.De===As)if(a===Gs||a===Hs||a===Is||a===Js||a===Es)this.sorting=a;else if(a===Ks||a===Ls||a===Ds||a===Ms)this.direction=a;else if(a===Ns||a===Os||a===Bs||a===Ps)this.Of=a;else{if(a===Qs||a===Fs)this.Ix=a}else pg.prototype.fc.call(this,a)};
As.prototype.createNetwork=function(){return new Rs};
As.prototype.doLayout=function(a){null===a&&w.k("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));a=this.network.vertexes;if(1>=a.count)1===a.count&&(a=a.first(),a.ja=0,a.ra=0);else{var b=new I(Ss);b.Hc(a.i);a=new I(Ss);var c=new I(Ss),d;d=this.sort(b);var e=this.Sy,f=this.yC,h=this.Wd,k=this.Do,l=this.Ty,m=this.qr,b=this.$k,n=this.PD,p=this.Eg,q=this.iv,e=this.Of,f=this.Ix,h=this.cJ;if(!isFinite(h)||
0>=h)h=NaN;k=this.fH;if(!isFinite(k)||0>=k)k=1;l=this.ye;isFinite(l)||(l=0);m=this.of;if(!isFinite(m)||360<m||1>m)m=360;b=this.spacing;isFinite(b)||(b=NaN);e===Ps&&f===Qs?e=Bs:e===Ps&&f!==Qs&&(f=Qs,e=this.Of);if((this.direction===Ks||this.direction===Ls)&&this.sorting!==Es){for(var r=0;!(r>=d.length);r+=2){a.add(d.da(r));if(r+1>=d.length)break;c.add(d.da(r+1))}this.direction===Ks?(this.Of===Ps&&a.reverse(),d=new I(Ss),d.Hc(a),d.Hc(c)):(this.Of===Ps&&c.reverse(),d=new I(Ss),d.Hc(c),d.Hc(a))}for(var s=
d.length,u=n=0,r=0;r<d.length;r++){var p=l+m*u*(this.direction===Ds?1:-1)/s,t=d.da(r).diameter;isNaN(t)&&(t=Ts(d.da(r),p));360>m&&(0===r||r===d.length-1)&&(t/=2);n+=t;u++}if(isNaN(h)||e===Ps){isNaN(b)&&(b=6);if(e!==Bs&&e!==Ps){t=-Infinity;for(r=0;r<s;r++){var q=d.da(r),x=d.da(r===s-1?0:r+1);isNaN(q.diameter)&&Ts(q,0);isNaN(x.diameter)&&Ts(x,0);t=Math.max(t,(q.diameter+x.diameter)/2)}q=t+b;e===Ns?(p=2*Math.PI/s,h=(t+b)/p):h=Us(this,q*(360<=m?s:s-1),k,l*Math.PI/180,m*Math.PI/180)}else h=Us(this,n+(360<=
m?s:s-1)*(e!==Ps?b:1.6*b),k,l*Math.PI/180,m*Math.PI/180);p=h*k}else if(p=h*k,u=Vs(this,h,p,l*Math.PI/180,m*Math.PI/180),isNaN(b)){if(e===Bs||e===Ps)b=(u-n)/(360<=m?s:s-1)}else if(e===Bs||e===Ps)r=(u-n)/(360<=m?s:s-1),r<b?(h=Us(this,n+b*(360<=m?s:s-1),k,l*Math.PI/180,m*Math.PI/180),p=h*k):b=r;else{t=-Infinity;for(r=0;r<s;r++)q=d.da(r),x=d.da(r===s-1?0:r+1),isNaN(q.diameter)&&Ts(q,0),isNaN(x.diameter)&&Ts(x,0),t=Math.max(t,(q.diameter+x.diameter)/2);q=t+b;r=Us(this,q*(360<=m?s:s-1),k,l*Math.PI/180,
m*Math.PI/180);r>h?(h=r,p=h*k):q=u/(360<=m?s:s-1)}this.Sy=e;this.yC=f;this.Wd=h;this.Do=k;this.Ty=l;this.qr=m;this.$k=b;this.PD=n;this.Eg=p;this.iv=q;b=d;d=this.Sy;e=this.Wd;f=this.Ty;k=this.qr;l=this.$k;m=this.Eg;n=this.iv;if(this.direction!==Ks&&this.direction!==Ls||d!==Ps)if(this.direction===Ks||this.direction===Ls){h=0;switch(d){case Os:h=180*Ws(this,e,m,f,n)/Math.PI;break;case Bs:n=b=0;h=a.first();null!==h&&(b=Ts(h,Math.PI/2));h=c.first();null!==h&&(n=Ts(h,Math.PI/2));h=180*Ws(this,e,m,f,l+(b+
n)/2)/Math.PI;break;case Ns:h=k/b.length}if(this.direction===Ks){switch(d){case Os:Xs(this,a,f,Ms);break;case Bs:Ys(this,a,f,Ms);break;case Ns:Zs(this,a,k/2,f,Ms)}switch(d){case Os:Xs(this,c,f+h,Ds);break;case Bs:Ys(this,c,f+h,Ds);break;case Ns:Zs(this,c,k/2,f+h,Ds)}}else{switch(d){case Os:Xs(this,c,f,Ms);break;case Bs:Ys(this,c,f,Ms);break;case Ns:Zs(this,c,k/2,f,Ms)}switch(d){case Os:Xs(this,a,f+h,Ds);break;case Bs:Ys(this,a,f+h,Ds);break;case Ns:Zs(this,a,k/2,f+h,Ds)}}}else switch(d){case Os:Xs(this,
b,f,this.direction);break;case Bs:Ys(this,b,f,this.direction);break;case Ns:Zs(this,b,k,f,this.direction);break;case Ps:$s(this,b,k,f,this.direction)}else $s(this,b,k,f-k/2,Ds)}this.updateParts();this.network=null;this.yf=!0};
function Zs(a,b,c,d,e){var f=a.qr,h=a.Wd;a=a.Eg;d=d*Math.PI/180;c=c*Math.PI/180;for(var k=b.length,l=0;l<k;l++){var m=d+(e===Ds?l*c/(360<=f?k:k-1):-(l*c)/k),n=b.da(l),p=h*Math.tan(m)/a,p=Math.sqrt((h*h+a*a*p*p)/(1+p*p));n.ja=p*Math.cos(m);n.ra=p*Math.sin(m);n.actualAngle=180*m/Math.PI}}
function Ys(a,b,c,d){var e=a.Wd,f=a.Eg,h=a.$k;c=c*Math.PI/180;for(var k=b.length,l=0;l<k;l++){var m=b.da(l),n=b.da(l===k-1?0:l+1),p=f*Math.sin(c);m.ja=e*Math.cos(c);m.ra=p;m.actualAngle=180*c/Math.PI;isNaN(m.diameter)&&Ts(m,0);isNaN(n.diameter)&&Ts(n,0);m=Ws(a,e,f,d===Ds?c:-c,(m.diameter+n.diameter)/2+h);c+=d===Ds?m:-m}}
function Xs(a,b,c,d){var e=a.Wd,f=a.Eg,h=a.iv;c=c*Math.PI/180;for(var k=b.length,l=0;l<k;l++){var m=b.da(l);m.ja=e*Math.cos(c);m.ra=f*Math.sin(c);m.actualAngle=180*c/Math.PI;m=Ws(a,e,f,d===Ds?c:-c,h);c+=d===Ds?m:-m}}function $s(a,b,c,d,e){var f=a.jv,f=a.qr;a.Qm=0;a.Gw=new Cs;if(360>c){for(f=d+(e===Ds?f:-f);0>f;)f+=360;f%=360;180<f&&(f-=360);f*=Math.PI/180;a.jv=f;at(a,b,c,d,e)}else bt(a,b,c,d,e);a.Gw.commit(b)}
function bt(a,b,c,d,e){var f=a.Wd,h=a.$k,k=a.Do,l=f*Math.cos(d*Math.PI/180),m=a.Eg*Math.sin(d*Math.PI/180),n=b.dc();if(3===n.length)n[0].ja=f,n[0].ra=0,n[1].ja=n[0].ja-n[0].width/2-n[1].width/2-h,n[1].y=n[0].y,n[2].ja=(n[0].ja+n[1].ja)/2,n[2].y=n[0].y-n[2].height-h;else if(4===n.length)n[0].ja=f,n[0].ra=0,n[2].ja=-n[0].ja,n[2].ra=n[0].ra,n[1].ja=0,n[1].y=Math.min(n[0].y,n[2].y)-n[1].height-h,n[3].ja=0,n[3].y=Math.max(n[0].y+n[0].height+h,n[2].y+n[2].height+h);else{for(var f=w.K(),p=0;p<n.length;p++){n[p].ja=
l;n[p].ra=m;if(p>=n.length-1)break;ct(a,l,m,n,p,e,f)||dt(a,l,m,n,p,e,f);l=f.x;m=f.y}w.v(f);a.Qm++;if(!(23<a.Qm)){var l=n[0].ja,m=n[0].ra,f=n[n.length-1].ja,p=n[n.length-1].ra,q=Math.abs(l-f)-((n[0].width+n[n.length-1].width)/2+h),r=Math.abs(m-p)-((n[0].height+n[n.length-1].height)/2+h),h=0;1>Math.abs(r)?Math.abs(l-f)<(n[0].width+n[n.length-1].width)/2&&(h=0):h=0<r?r:1>Math.abs(q)?0:q;q=!1;q=Math.abs(f)>Math.abs(p)?0<f!==m>p:0<p!==l<f;if(q=e===Ds?q:!q)h=-Math.abs(h),h=Math.min(h,-n[n.length-1].width),
h=Math.min(h,-n[n.length-1].height);a.Gw.compare(h,n);1<Math.abs(h)&&(a.Wd=8>a.Qm?a.Wd-h/(2*Math.PI):5>n.length&&10<h?a.Wd/2:a.Wd-(0<h?1.7:-2.3),a.Eg=a.Wd*k,bt(a,b,c,d,e))}}}
function at(a,b,c,d,e){for(var f=a.Wd,h=a.Eg,k=a.Do,l=f*Math.cos(d*Math.PI/180),m=h*Math.sin(d*Math.PI/180),n=w.K(),p=b.dc(),q=0;q<p.length;q++){p[q].ja=l;p[q].ra=m;if(q>=p.length-1)break;ct(a,l,m,p,q,e,n)||dt(a,l,m,p,q,e,n);l=n.x;m=n.y}w.v(n);a.Qm++;if(!(23<a.Qm)){l=Math.atan2(m,l);l=e===Ds?a.jv-l:l-a.jv;l=Math.abs(l)<Math.abs(l-2*Math.PI)?l:l-2*Math.PI;f=l*(f+h)/2;h=a.Gw;if(Math.abs(f)<Math.abs(h.Wp))for(h.Wp=f,h.co=[],h.Aq=[],l=0;l<p.length;l++)h.co[l]=p[l].jb.x,h.Aq[l]=p[l].jb.y;1<Math.abs(f)&&
(a.Wd=8>a.Qm?a.Wd-f/(2*Math.PI):a.Wd-(0<f?1.7:-2.3),a.Eg=a.Wd*k,at(a,b,c,d,e))}}function ct(a,b,c,d,e,f,h){var k=a.Wd,l=a.Eg,m=0,n=0;a=(d[e].width+d[e+1].width)/2+a.$k;var p=!1;if(0<=c!==(f===Ds)){if(m=b+a,m>k){m=b-a;if(m<-k)return h.x=m,h.y=n,!1;p=!0}}else if(m=b-a,m<-k){m=b+a;if(m>k)return h.x=m,h.y=n,!1;p=!0}n=Math.sqrt(1-Math.min(1,m*m/(k*k)))*l;0>c!==p&&(n=-n);if(Math.abs(c-n)>(d[e].height+d[e+1].height)/2)return h.x=m,h.y=n,!1;h.x=m;h.y=n;return!0}
function dt(a,b,c,d,e,f,h){var k=a.Wd,l=a.Eg,m=0,n=0;a=(d[e].height+d[e+1].height)/2+a.$k;d=!1;if(0<=b!==(f===Ds)){if(n=c-a,n<-l){n=c+a;if(n>l){h.x=m;h.y=n;return}d=!0}}else if(n=c+a,n>l){n=c-a;if(n<-l){h.x=m;h.y=n;return}d=!0}m=Math.sqrt(1-Math.min(1,n*n/(l*l)))*k;0>b!==d&&(m=-m);h.x=m;h.y=n}As.prototype.commitLayout=function(){this.commitNodes();this.eu&&this.commitLinks()};
As.prototype.commitNodes=function(){for(var a=this.VG,b=this.network.vertexes.i;b.next();){var c=b.value;c.x+=a.x;c.y+=a.y;c.commit()}};As.prototype.commitLinks=function(){for(var a=this.network.edges.i;a.next();)a.value.commit()};
function Vs(a,b,c,d,e){var f=a.MG;if(.001>Math.abs(a.Do-1))return void 0!==d&&void 0!==e?e*b:2*Math.PI*b;a=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c;for(var h=0,k=0,k=void 0!==d&&void 0!==e?e/(f+1):Math.PI/(2*(f+1)),l=0,m=0;m<=f;m++)l=void 0!==d&&void 0!==e?d+m*e/f:m*Math.PI/(2*f),l=Math.sin(l),h+=Math.sqrt(1-a*a*l*l)*k;return void 0!==d&&void 0!==e?(b>c?b:c)*h:4*(b>c?b:c)*h}function Us(a,b,c,d,e){var f=0,f=void 0!==d&&void 0!==e?Vs(a,1,c,d,e):Vs(a,1,c);return b/f}
function Ws(a,b,c,d,e){if(.001>Math.abs(a.Do-1))return e/b;var f=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c,h=0;a=2*Math.PI/(700*a.network.vertexes.count);b>c&&(d+=Math.PI/2);for(var k=0;;k++){var l=Math.sin(d+k*a),h=h+(b>c?b:c)*Math.sqrt(1-f*f*l*l)*a;if(h>=e)return k*a}}
As.prototype.sort=function(a){switch(this.sorting){case Is:break;case Js:a.reverse();break;case Gs:a.sort(this.comparer);break;case Hs:a.sort(this.comparer);a.reverse();break;case Es:for(var b=[],c=0;c<a.length;c++)b.push(0);for(var d=new I(Ss),c=0;c<a.length;c++){var e=-1,f=-1;if(0===c)for(var h=0;h<a.length;h++){var k=a.da(h).LH;k>e&&(e=k,f=h)}else for(h=0;h<a.length;h++)k=b[h],k>e&&(e=k,f=h);d.add(a.da(f));b[f]=-1;f=a.da(f);e=0;for(h=f.kc;h.next();)e=a.indexOf(h.value.fromVertex),0>e||0<=b[e]&&
b[e]++;for(f=f.hc;f.next();)e=a.indexOf(f.value.toVertex),0>e||0<=b[e]&&b[e]++}a=[];for(f=0;f<d.length;f++){b=d.da(f);a[f]=[];for(var l=0,c=b.hc;c.next();)l=d.indexOf(c.value.toVertex),l!==f&&0>a[f].indexOf(l)&&a[f].push(l);for(b=b.kc;b.next();)l=d.indexOf(b.value.fromVertex),l!==f&&0>a[f].indexOf(l)&&a[f].push(l)}h=[];for(f=0;f<a.length;f++)h[f]=0;for(var b=[],k=[],m=[],c=[],e=new I(Ss),n=0,f=0;f<a.length;f++){var p=a[f].length;if(1===p)c.push(f);else if(0===p)e.add(d.da(f));else{if(0===n)b.push(f);
else{for(var q=Infinity,r=Infinity,s=-1,u=[],p=0;p<b.length;p++)0>a[b[p]].indexOf(b[p===b.length-1?0:p+1])&&u.push(p===b.length-1?0:p+1);if(0===u.length)for(p=0;p<b.length;p++)u.push(p);for(p=0;p<u.length;p++){var t=u[p],x,l=a[f];x=k;for(var v=m,B=h,y=t,H=b,E=0,V=0;V<x.length;V++){var ba=B[x[V]],Q=B[v[V]],$=0,ca=0;ba<Q?($=ba,ca=Q):($=Q,ca=ba);if($<y&&y<=ca)for(ba=0;ba<l.length;ba++)Q=l[ba],0>H.indexOf(Q)||$<B[Q]&&B[Q]<ca||$===B[Q]||ca===B[Q]||E++;else for(ba=0;ba<l.length;ba++)Q=l[ba],0>H.indexOf(Q)||
$<B[Q]&&B[Q]<ca&&$!==B[Q]&&ca!==B[Q]&&E++}x=E;for(B=v=0;B<a[f].length;B++)l=b.indexOf(a[f][B]),0<=l&&(l=Math.abs(t-(l>=t?l+1:l)),v+=l<b.length+1-l?l:b.length+1-l);for(B=0;B<k.length;B++)l=h[k[B]],y=h[m[B]],l>=t&&l++,y>=t&&y++,l>y&&(H=y,y=l,l=H),y-l<(b.length+2)/2===(l<t&&t<=y)&&v++;if(x<q||x===q&&v<r)q=x,r=v,s=t}b.splice(s,0,f);for(p=0;p<b.length;p++)h[b[p]]=p;for(p=0;p<a[f].length;p++)q=a[f][p],0<=b.indexOf(q)&&(k.push(f),m.push(q))}n++}}f=!1;for(h=b.length;;){f=!0;for(k=0;k<c.length;k++)if(m=c[k],
n=a[m][0],l=b.indexOf(n),0<=l){for(r=p=0;r<a[n].length;r++)q=a[n][r],q=b.indexOf(q),0>q||q===l||(s=q>l?q-l:l-q,p+=q<l!==s>h-s?1:-1);b.splice(0>p?l:l+1,0,m);c.splice(k,1);k--}else f=!1;if(f)break;else b.push(c[0]),c.splice(0,1)}for(f=0;f<b.length;f++)e.add(d.da(b[f]));return e;default:w.k("Invalid sorting type.")}return a};w.defineProperty(As,{cJ:"radius"},function(){return this.Ds},function(a){this.Ds!==a&&(w.j(a,"number",As,"radius"),0<a||isNaN(a))&&(this.Ds=a,this.J())});
w.defineProperty(As,{fH:"aspectRatio"},function(){return this.Mq},function(a){this.Mq!==a&&(w.j(a,"number",As,"aspectRatio"),0<a&&(this.Mq=a,this.J()))});w.defineProperty(As,{ye:"startAngle"},function(){return this.dt},function(a){this.dt!==a&&(w.j(a,"number",As,"startAngle"),this.dt=a,this.J())});w.defineProperty(As,{of:"sweepAngle"},function(){return this.gt},function(a){this.gt!==a&&(w.j(a,"number",As,"sweepAngle"),this.gt=0<a&&360>=a?a:360,this.J())});
w.defineProperty(As,{Of:"arrangement"},function(){return this.kd},function(a){this.kd!==a&&(w.mb(a,As,As,"arrangement"),a===Ps||a===Bs||a===Os||a===Ns)&&(this.kd=a,this.J())});w.defineProperty(As,{direction:"direction"},function(){return this.aa},function(a){this.aa!==a&&(w.mb(a,As,As,"direction"),a===Ds||a===Ms||a===Ks||a===Ls)&&(this.aa=a,this.J())});
w.defineProperty(As,{sorting:"sorting"},function(){return this.$h},function(a){this.$h!==a&&(w.mb(a,As,As,"sorting"),a===Is||a===Js||a===Gs||Hs||a===Es)&&(this.$h=a,this.J())});w.defineProperty(As,{comparer:"comparer"},function(){return this.Jh},function(a){this.Jh!==a&&(w.j(a,"function",As,"comparer"),this.Jh=a,this.J())});w.defineProperty(As,{spacing:"spacing"},function(){return this.ai},function(a){this.ai!==a&&(w.j(a,"number",As,"spacing"),this.ai=a,this.J())});
w.defineProperty(As,{Ix:"nodeDiameterFormula"},function(){return this.ss},function(a){this.ss!==a&&(w.mb(a,As,As,"nodeDiameterFormula"),a===Fs||a===Qs)&&(this.ss=a,this.J())});w.u(As,{WG:"actualXRadius"},function(){return this.Wd});w.u(As,{XG:"actualYRadius"},function(){return this.Eg});w.u(As,{UJ:"actualSpacing"},function(){return this.$k});w.u(As,{VG:"actualCenter"},function(){return isNaN(this.oe.x)||isNaN(this.oe.y)?new z(0,0):new z(this.oe.x+this.WG,this.oe.y+this.XG)});var Bs;
As.ConstantSpacing=Bs=w.p(As,"ConstantSpacing",0);var Os;As.ConstantDistance=Os=w.p(As,"ConstantDistance",1);var Ns;As.ConstantAngle=Ns=w.p(As,"ConstantAngle",2);var Ps;As.Packed=Ps=w.p(As,"Packed",3);var Ds;As.Clockwise=Ds=w.p(As,"Clockwise",4);var Ms;As.Counterclockwise=Ms=w.p(As,"Counterclockwise",5);var Ks;As.BidirectionalLeft=Ks=w.p(As,"BidirectionalLeft",6);var Ls;As.BidirectionalRight=Ls=w.p(As,"BidirectionalRight",7);var Is;As.Forwards=Is=w.p(As,"Forwards",8);var Js;
As.Reverse=Js=w.p(As,"Reverse",9);var Gs;As.Ascending=Gs=w.p(As,"Ascending",10);var Hs;As.Descending=Hs=w.p(As,"Descending",11);var Es;As.Optimized=Es=w.p(As,"Optimized",12);var Fs;As.Pythagorean=Fs=w.p(As,"Pythagorean",13);var Qs;As.Circular=Qs=w.p(As,"Circular",14);function Cs(){this.Wp=-Infinity;this.Aq=this.co=null}
Cs.prototype.compare=function(a,b){if(0<a&&0>this.Wp||Math.abs(a)<Math.abs(this.Wp)&&!(0>a&&0<this.Wp)){this.Wp=a;this.co=[];this.Aq=[];for(var c=0;c<b.length;c++)this.co[c]=b[c].jb.x,this.Aq[c]=b[c].jb.y}};Cs.prototype.commit=function(a){if(null!==this.co&&null!==this.Aq)for(var b=0;b<this.co.length;b++){var c=a.da(b);c.x=this.co[b];c.y=this.Aq[b]}};function Rs(){qg.call(this)}w.La(Rs,qg);w.fa("CircularNetwork",Rs);Rs.prototype.createVertex=function(){return new Ss};Rs.prototype.createEdge=function(){return new et};
function Ss(){ks.call(this);this.actualAngle=this.diameter=NaN}w.La(Ss,ks);w.fa("CircularVertex",Ss);
function Ts(a,b){var c=a.network;if(null===c)return NaN;c=c.Rb;if(null===c)return NaN;if(c.Of===Ps)if(c.Ix===Qs)a.diameter=Math.max(a.width,a.height);else{var c=Math.abs(Math.sin(b)),d=Math.abs(Math.cos(b));if(0===c)return a.width;if(0===d)return a.height;a.diameter=Math.min(a.height/c,a.width/d)}else a.diameter=c.Ix===Qs?Math.max(a.width,a.height):Math.sqrt(a.width*a.width+a.height*a.height);return a.diameter}function et(){ls.call(this)}w.La(et,ls);w.fa("CircularEdge",et);
function ft(){0<arguments.length&&w.hd(ft);pg.call(this);this.Dg=null;this.Sr=0;this.hg=(new ha(100,100)).freeze();this.Lq=!1;this.Zh=!0;this.Ih=!1;this.ap=100;this.tr=1;this.Oh=1E3;this.Es=Math;this.zo=.05;this.yo=50;this.wo=150;this.xo=0;this.ir=10;this.hr=5}w.La(ft,pg);w.fa("ForceDirectedLayout",ft);
ft.prototype.cloneProtected=function(a){pg.prototype.cloneProtected.call(this,a);a.hg.assign(this.hg);a.Lq=this.Lq;a.Zh=this.Zh;a.Ih=this.Ih;a.ap=this.ap;a.tr=this.tr;a.Oh=this.Oh;a.Es=this.Es;a.zo=this.zo;a.yo=this.yo;a.wo=this.wo;a.xo=this.xo;a.ir=this.ir;a.hr=this.hr};ft.prototype.createNetwork=function(){return new gt};
ft.prototype.doLayout=function(a){null===a&&w.k("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));a=this.EA;if(0<this.network.vertexes.count){this.network.Zw();for(var b=this.network.vertexes.i;b.next();){var c=b.value;c.charge=this.electricalCharge(c);c.mass=this.gravitationalMass(c)}for(b=this.network.edges.i;b.next();)c=b.value,c.stiffness=this.springStiffness(c),c.length=this.springLength(c);
this.Nz();this.Sr=0;if(this.needsClusterLayout()){b=this.network;for(c=b.CJ().i;c.next();){this.network=c.value;for(var d=this.network.vertexes.i;d.next();){var e=d.value;e.eg=e.vertexes.count;e.Gk=1;e.nn=null;e.Dh=null}qt(this,0,a)}this.network=b;c.reset();for(var d=this.iE,f=c.count,h=!0,k=e=0,l=w.lb(),m=0;m<f+b.vertexes.count+2;m++)l[m]=null;f=0;c.reset();for(var n=w.Df();c.next();)if(m=c.value,this.sh(m,n),h)h=!1,e=n.x+n.width/2,k=n.y+n.height/2,l[0]=new z(n.x+n.width+d.width,n.y),l[1]=new z(n.x,
n.y+n.height+d.height),f=2;else{var p=Yt(l,f,e,k,n.width,n.height,d),q=l[p],r=new z(q.x+n.width+d.width,q.y),s=new z(q.x,q.y+n.height+d.height);p+1<f&&l.splice(p+1,0,null);l[p]=r;l[p+1]=s;f++;p=q.x-n.x;q=q.y-n.y;for(m=m.vertexes.i;m.next();)r=m.value,r.ja+=p,r.ra+=q}w.Gb(n);for(m=b.vertexes.i;m.next();)h=m.value,n=h.jb,2>f?(e=n.x+n.width/2,k=n.y+n.height/2,l[0]=new z(n.x+n.width+d.width,n.y),l[1]=new z(n.x,n.y+n.height+d.height),f=2):(p=Yt(l,f,e,k,n.width,n.height,d),q=l[p],r=new z(q.x+n.width+d.width,
q.y),s=new z(q.x,q.y+n.height+d.height),p+1<f&&l.splice(p+1,0,null),l[p]=r,l[p+1]=s,f++,h.ja=q.x+h.width/2,h.ra=q.y+h.height/2);w.va(l);for(c.reset();c.next();){d=c.value;for(e=d.vertexes.i;e.next();)b.Cl(e.value);for(d=d.edges.i;d.next();)b.Dp(d.value)}}Zt(this,a);this.updateParts()}this.ap=a;this.network=null;this.yf=!0};
ft.prototype.needsClusterLayout=function(){if(3>this.network.vertexes.count)return!1;for(var a=0,b=0,c=this.network.vertexes.first().jb,d=this.network.vertexes.i;d.next();){if(d.value.jb.Kg(c)&&(a++,2<a))return!0;if(10<b)break;b++}return!1};ft.prototype.sh=function(a,b){for(var c=!0,d=a.vertexes.i;d.next();){var e=d.value;c?(c=!1,b.set(e.jb)):b.Gh(e.jb)}return b};
function qt(a,b,c){if($t(a,b)){var d=a.Oh;a.Oh*=1+1/(b+1);var e=au(a,b),f=Math.max(0,Math.max(Math.min(a.network.vertexes.count,c*(b+1)/11),10));a.EA+=f;qt(a,b+1,c);Zt(a,f);bu(a,e);b=a.Dg;null===b?b=new I(cu):b.clear();b.Hc(e.vertexes);b.sort(function(a,b){return null===a||null===b||a===b?0:b.eg-a.eg});for(e=b.i;e.next();)du(a,e.value);a.Oh=d}}
function $t(a,b){if(10<b||3>a.network.vertexes.count)return!1;null===a.Dg?a.Dg=new I(cu):a.Dg.clear();a.Dg.Hc(a.network.vertexes);var c=a.Dg;c.sort(function(a,b){return null===a||null===b||a===b?0:b.eg-a.eg});for(var d=c.count-1;0<=d&&1>=c.da(d).eg;)d--;return 1<c.count-d}
function au(a,b){for(var c=a.network,d=new gt,e=a.Dg.i;e.next();){var f=e.value;if(1<f.eg){d.Cl(f);var h=new eu;h.qy=f.eg;h.sy=f.width;h.py=f.height;h.BB=f.T.x;h.CB=f.T.y;null===f.Dh&&(f.Dh=new I(eu));f.Dh.add(h);f.VA=f.Dh.count-1}else break}for(var k=c.edges.i;k.next();)if(h=k.value,e=h.fromVertex,f=h.toVertex,e.network===d&&f.network===d)d.Dp(h);else if(e.network===d){var l=e.nn;null===l&&(l=new I(cu),e.nn=l);l.add(f);e.eg--;e.Gk+=f.Gk}else f.network===d&&(l=f.nn,null===l&&(l=new I(cu),f.nn=l),
l.add(e),f.eg--,f.Gk+=e.Gk);for(e=d.edges.i;e.next();)f=e.value,f.length*=Math.max(1,Wd((f.fromVertex.Gk+f.toVertex.Gk)/(4*b+1)));for(e=d.vertexes.i;e.next();)if(f=e.value,l=f.nn,null!==l&&0<l.count&&(h=f.Dh.da(f.Dh.count-1),h=h.qy-f.eg,!(0>=h))){for(var m=0,n=0,p=l.count-h;p<l.count;p++){for(var q=l.da(p),r=null,k=q.edges.i;k.next();){var s=k.value;if(s.VH(q)===f){r=s;break}}null!==r&&(n+=r.length,m+=q.width*q.height)}k=f.ja;l=f.ra;p=f.width;q=f.height;r=f.T;s=p*q;1>s&&(s=1);m=Wd((m+s+n*n*4/(h*h))/
s);h=(m-1)*p/2;m=(m-1)*q/2;f.jb=new A(k-r.x-h,l-r.y-m,p+2*h,q+2*m);f.focus=new z(r.x+h,r.y+m)}a.network=d;return c}function bu(a,b){for(var c=a.network.vertexes.i;c.next();){var d=c.value;d.network=b;if(null!==d.Dh){var e=d.Dh.da(d.VA);d.eg=e.qy;var f=e.BB,h=e.CB;d.jb=new A(d.ja-f,d.ra-h,e.sy,e.py);d.focus=new z(f,h);d.VA--}}for(c=a.network.edges.i;c.next();)c.value.network=b;a.network=b}
function du(a,b){var c=b.nn;if(null!==c&&0!==c.count){var d=b.ja,e=b.ra,f=b.width,h=b.height;null!==b.Dh&&0<b.Dh.count&&(h=b.Dh.da(0),f=h.sy,h=h.py);for(var f=Wd(f*f+h*h)/2,k=!1,l=h=0,m=0,n=b.vertexes.i;n.next();){var p=n.value;1>=p.eg?l++:(k=!0,m++,h+=Math.atan2(b.ra-p.ra,b.ja-p.ja))}if(0!==l)for(0<m&&(h/=m),n=m=0,m=k?2*Math.PI/(l+1):2*Math.PI/l,0===l%2&&(n=m/2),1<c.count&&c.sort(function(a,b){return null===a||null===b||a===b?0:b.width*b.height-a.width*a.height}),k=0===l%2?0:1,c=c.i;c.next();)if(l=
c.value,!(1<l.eg||a.isFixed(l))){for(var p=null,q=l.edges.i;q.next();){p=q.value;break}var q=l.width,r=l.height,q=Wd(q*q+r*r)/2,p=f+p.length+q,q=h+(m*(k/2>>1)+n)*(0===k%2?1:-1);l.ja=d+p*Math.cos(q);l.ra=e+p*Math.sin(q);k++}}}function Yt(a,b,c,d,e,f,h){var k=9E19,l=-1,m=0;a:for(;m<b;m++){var n=a[m],p=n.x-c,q=n.y-d,p=p*p+q*q;if(p<k){for(q=m-1;0<=q;q--)if(a[q].y>n.y&&a[q].x-n.x<e+h.width)continue a;for(q=m+1;q<b;q++)if(a[q].x>n.x&&a[q].y-n.y<f+h.height)continue a;l=m;k=p}}return l}
ft.prototype.Nz=function(){if(this.comments)for(var a=this.network.vertexes.i;a.next();)this.addComments(a.value)};
ft.prototype.addComments=function(a){var b=a.Nc;if(null!==b)for(b=b.GE();b.next();){var c=b.value;if("Comment"===c.rd&&c.isVisible()){var d=this.network.wn(c);null===d&&(d=this.network.wt(c));d.charge=this.BH;for(var c=null,e=d.hc;e.next();){var f=e.value;if(f.toVertex===a){c=f;break}}if(null===c)for(e=d.kc;e.next();)if(f=e.value,f.fromVertex===a){c=f;break}null===c&&(c=this.network.gq(a,d,null));c.length=this.CH}}};
function fu(a,b){var c=a.M,d=c.x,e=c.y,f=c.width,c=c.height,h=b.M,k=h.x,l=h.y,m=h.width,h=h.height;return d+f<k?e>l+h?(d=d+f-k,e=e-l-h,Wd(d*d+e*e)):e+c<l?(d=d+f-k,e=e+c-l,Wd(d*d+e*e)):k-(d+f):d>k+m?e>l+h?(d=d-k-m,e=e-l-h,Wd(d*d+e*e)):e+c<l?(d=d-k-m,e=e+c-l,Wd(d*d+e*e)):d-(k+m):e>l+h?e-(l+h):e+c<l?l-(e+c):.1}function Zt(a,b){a.Dg=null;for(var c=a.Sr+b;a.Sr<c&&(a.Sr++,gu(a)););a.Dg=null}
function gu(a){null===a.Dg&&(a.Dg=new I(cu),a.Dg.Hc(a.network.vertexes));var b=a.Dg.n;if(0>=b.length)return!1;var c=b[0];c.forceX=0;c.forceY=0;for(var d=c.ja,e=d,f=c.ra,h=f,c=1;c<b.length;c++){var k=b[c];k.forceX=0;k.forceY=0;var l=k.ja,k=k.ra,d=Math.min(d,l),e=Math.max(e,l),f=Math.min(f,k),h=Math.max(h,k)}(f=e-d>h-f)?b.sort(function(a,b){return null===a||null===b||a===b?0:a.ja-b.ja}):b.sort(function(a,b){return null===a||null===b||a===b?0:a.ra-b.ra});for(var h=a.Oh,m=0,n=0,p=0,c=0;c<b.length;c++){var k=
b[c],l=k.M,q=k.T,d=l.x+q.x,l=l.y+q.y,n=k.charge*a.electricalFieldX(d,l),p=k.charge*a.electricalFieldY(d,l),n=n+k.mass*a.gravitationalFieldX(d,l),p=p+k.mass*a.gravitationalFieldY(d,l);k.forceX+=n;k.forceY+=p;for(q=c+1;q<b.length;q++)if(e=b[q],e!==k){var r=e.M,n=e.T,p=r.x+n.x,r=r.y+n.y;if(d-p>h||p-d>h){if(f)break}else if(l-r>h||r-l>h){if(!f)break}else{var s=fu(k,e);1>s?(n=a.Rx,null===n&&(a.Rx=n=new ta(0)),m=n.random(),s=n.random(),d>p?(n=Math.abs(e.M.right-k.M.x),n=(1+n)*m):d<p?(n=Math.abs(e.M.x-k.M.right),
n=-(1+n)*m):(n=Math.max(e.width,k.width),n=(1+n)*m-n/2),l>r?(p=Math.abs(e.M.bottom-k.M.y),p=(1+p)*s):d<p?(p=Math.abs(e.M.y-k.M.bottom),p=-(1+p)*s):(p=Math.max(e.height,k.height),p=(1+p)*s-p/2)):(m=-(k.charge*e.charge)/(s*s),n=(p-d)/s*m,p=(r-l)/s*m);k.forceX+=n;k.forceY+=p;e.forceX-=n;e.forceY-=p}}}for(c=a.network.edges.i;c.next();)f=c.value,k=f.fromVertex,e=f.toVertex,l=k.M,q=k.T,d=l.x+q.x,l=l.y+q.y,r=e.M,n=e.T,p=r.x+n.x,r=r.y+n.y,s=fu(k,e),1>s?(n=a.Rx,null===n&&(a.Rx=n=new ta(0)),m=n.random(),s=
n.random(),n=(d>p?1:-1)*(1+(e.width>k.width?e.width:k.width))*m,p=(l>r?1:-1)*(1+(e.height>k.height?e.height:k.height))*s):(m=f.stiffness*(s-f.length),n=(p-d)/s*m,p=(r-l)/s*m),k.forceX+=n,k.forceY+=p,e.forceX-=n,e.forceY-=p;c=0;d=Math.max(a.Oh/20,50);for(e=0;e<b.length;e++)k=b[e],a.isFixed(k)?a.moveFixedVertex(k):(f=k.forceX,h=k.forceY,f<-d?f=-d:f>d&&(f=d),h<-d?h=-d:h>d&&(h=d),k.ja+=f,k.ra+=h,c=Math.max(c,f*f+h*h));return c>a.DE*a.DE}ft.prototype.moveFixedVertex=function(){};
ft.prototype.commitLayout=function(){this.cB();this.commitNodes();this.eu&&this.commitLinks()};ft.prototype.cB=function(){if(this.uq)for(var a=this.network.edges.i;a.next();){var b=a.value.link;null!==b&&(b.Ab=oc,b.Bb=oc)}};ft.prototype.commitNodes=function(){var a=0,b=0;if(this.eH){var c=w.Df();this.sh(this.network,c);b=this.oe;a=b.x-c.x;b=b.y-c.y;w.Gb(c)}for(var c=w.Df(),d=this.network.vertexes.i;d.next();){var e=d.value;if(0!==a||0!==b)c.assign(e.jb),c.x+=a,c.y+=b,e.jb=c;e.commit()}w.Gb(c)};
ft.prototype.commitLinks=function(){for(var a=this.network.edges.i;a.next();)a.value.commit()};ft.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.zo:a};ft.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.yo:a};ft.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.wo:a};ft.prototype.electricalFieldX=function(){return 0};ft.prototype.electricalFieldY=function(){return 0};
ft.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.xo:a};ft.prototype.gravitationalFieldX=function(){return 0};ft.prototype.gravitationalFieldY=function(){return 0};ft.prototype.isFixed=function(a){return a.isFixed};w.u(ft,{yK:"currentIteration"},function(){return this.Sr});w.defineProperty(ft,{iE:"arrangementSpacing"},function(){return this.hg},function(a){w.G(a,ha,ft,"arrangementSpacing");this.hg.L(a)||(this.hg.assign(a),this.J())});
w.defineProperty(ft,{eH:"arrangesToOrigin"},function(){return this.Lq},function(a){this.Lq!==a&&(w.j(a,"boolean",ft,"arrangesToOrigin"),this.Lq=a,this.J())});w.defineProperty(ft,{uq:"setsPortSpots"},function(){return this.Zh},function(a){this.Zh!==a&&(w.j(a,"boolean",ft,"setsPortSpots"),this.Zh=a,this.J())});w.defineProperty(ft,{comments:"comments"},function(){return this.Ih},function(a){this.Ih!==a&&(w.j(a,"boolean",ft,"comments"),this.Ih=a,this.J())});
w.defineProperty(ft,{EA:"maxIterations"},function(){return this.ap},function(a){this.ap!==a&&(w.j(a,"number",ft,"maxIterations"),0<=a&&(this.ap=a,this.J()))});w.defineProperty(ft,{DE:"epsilonDistance"},function(){return this.tr},function(a){this.tr!==a&&(w.j(a,"number",ft,"epsilonDistance"),0<a&&(this.tr=a,this.J()))});w.defineProperty(ft,{RK:"infinityDistance"},function(){return this.Oh},function(a){this.Oh!==a&&(w.j(a,"number",ft,"infinityDistance"),1<a&&(this.Oh=a,this.J()))});
w.defineProperty(ft,{Rx:"randomNumberGenerator"},function(){return this.Es},function(a){this.Es!==a&&(null!==a&&"function"!==typeof a.random&&w.k('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+a),this.Es=a)});w.defineProperty(ft,{KK:"defaultSpringStiffness"},function(){return this.zo},function(a){this.zo!==a&&(w.j(a,"number",ft,"defaultSpringStiffness"),this.zo=a,this.J())});
w.defineProperty(ft,{JK:"defaultSpringLength"},function(){return this.yo},function(a){this.yo!==a&&(w.j(a,"number",ft,"defaultSpringLength"),this.yo=a,this.J())});w.defineProperty(ft,{DK:"defaultElectricalCharge"},function(){return this.wo},function(a){this.wo!==a&&(w.j(a,"number",ft,"defaultElectricalCharge"),this.wo=a,this.J())});w.defineProperty(ft,{EK:"defaultGravitationalMass"},function(){return this.xo},function(a){this.xo!==a&&(w.j(a,"number",ft,"defaultGravitationalMass"),this.xo=a,this.J())});
w.defineProperty(ft,{CH:"defaultCommentSpringLength"},function(){return this.ir},function(a){this.ir!==a&&(w.j(a,"number",ft,"defaultCommentSpringLength"),this.ir=a,this.J())});w.defineProperty(ft,{BH:"defaultCommentElectricalCharge"},function(){return this.hr},function(a){this.hr!==a&&(w.j(a,"number",ft,"defaultCommentElectricalCharge"),this.hr=a,this.J())});function eu(){this.CB=this.BB=this.py=this.sy=this.qy=0}function gt(){qg.call(this)}w.La(gt,qg);w.fa("ForceDirectedNetwork",gt);
gt.prototype.createVertex=function(){return new cu};gt.prototype.createEdge=function(){return new hu};function cu(){ks.call(this);this.isFixed=!1;this.mass=this.charge=NaN;this.Gk=this.eg=this.forceY=this.forceX=0;this.Dh=this.nn=null;this.VA=0}w.La(cu,ks);w.fa("ForceDirectedVertex",cu);function hu(){ls.call(this);this.length=this.stiffness=NaN}w.La(hu,ls);w.fa("ForceDirectedEdge",hu);
function iu(){0<arguments.length&&w.hd(iu);pg.call(this);this.Ud=this.Hm=25;this.aa=0;this.vo=ju;this.Xo=ku;this.Mo=lu;this.Fm=4;this.io=mu;this.Yi=nu;this.Zh=!0;this.Xr=4;this.Jb=this.Vv=this.pb=-1;this.Kf=this.fs=0;this.Nb=this.If=this.Jf=this.tg=this.he=null;this.os=0;this.ns=this.Mm=null;this.xg=0;this.ps=null;this.OB=new z;this.hh=[];this.hh.length=100}w.La(iu,pg);w.fa("LayeredDigraphLayout",iu);
iu.prototype.cloneProtected=function(a){pg.prototype.cloneProtected.call(this,a);a.Hm=this.Hm;a.Ud=this.Ud;a.aa=this.aa;a.vo=this.vo;a.Xo=this.Xo;a.Mo=this.Mo;a.Fm=this.Fm;a.io=this.io;a.Yi=this.Yi;a.Zh=this.Zh;a.Xr=this.Xr};iu.prototype.fc=function(a){a.De===iu?0===a.name.indexOf("Aggressive")?this.cH=a:0===a.name.indexOf("Cycle")?this.AH=a:0===a.name.indexOf("Init")?this.mI=a:0===a.name.indexOf("Layer")?this.zI=a:w.k("Unknown enum value: "+a):pg.prototype.fc.call(this,a)};
iu.prototype.createNetwork=function(){return new ou};
iu.prototype.doLayout=function(a){null===a&&w.k("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));this.oe=this.initialOrigin(this.oe);this.Vv=-1;this.Kf=this.fs=0;this.ps=this.ns=this.Mm=null;for(a=0;a<this.hh.length;a++)this.hh[a]=null;if(0<this.network.vertexes.count){this.network.Zw();for(a=this.network.edges.i;a.next();)a.value.rev=!1;switch(this.vo){default:case pu:a=this.network;var b=
0,c=a.vertexes.count-1,d=[];d.length=c+1;for(var e=a.vertexes.i;e.next();)e.value.valid=!0;for(;null!==qu(a);){for(e=ru(a);null!==e;)d[c]=e,c--,e.valid=!1,e=ru(a);for(e=su(a);null!==e;)d[b]=e,b++,e.valid=!1,e=su(a);for(var e=null,f=0,h=this.network.vertexes.i;h.next();){var k=h.value;if(k.valid){for(var l=0,m=k.hc;m.next();)m.value.toVertex.valid&&l++;for(var m=0,n=k.kc;n.next();)n.value.fromVertex.valid&&m++;if(null===e||f<l-m)e=k,f=l-m}}null!==e&&(d[b]=e,b++,e.valid=!1)}for(b=0;b<a.vertexes.count;b++)d[b].index=
b;for(d=a.edges.i;d.next();)b=d.value,b.fromVertex.index>b.toVertex.index&&(a.Yx(b),b.rev=!0);break;case ju:for(d=this.network.vertexes.i;d.next();)a=d.value,a.Rp=-1,a.finish=-1;for(a=this.network.edges.i;a.next();)a.value.forest=!1;this.os=0;for(d.reset();d.next();)b=d.value,0===b.kc.count&&tu(this,b);for(d.reset();d.next();)b=d.value,-1===b.Rp&&tu(this,b);for(a.reset();a.next();)d=a.value,d.forest||(b=d.fromVertex,c=b.finish,e=d.toVertex,f=e.finish,e.Rp<b.Rp&&c<f&&(this.network.Yx(d),d.rev=!0))}for(a=
this.network.vertexes.i;a.next();)a.value.layer=-1;this.pb=-1;this.assignLayers();for(a.reset();a.next();)this.pb=Math.max(this.pb,a.value.layer);a=this.network;d=[];for(c=a.edges.i;c.next();)b=c.value,b.valid=!1,d.push(b);for(c=0;c<d.length;c++)if(b=d[c],f=b.fromVertex,e=b.toVertex,!b.valid&&(null!==f.pd&&null!==e.pd||f.layer!==e.layer)){m=k=l=h=0;if(null!==b.link){l=b.link;if(null===l)continue;var p=f.pd,h=e.pd;if(null===p||null===h)continue;var q=l.W,k=l.$,r=l.ed,m=l.Sd;b.rev&&(l=q,n=r,q=k,r=m,
k=l,m=n);var s=f.T,l=e.T,u=b.rev?e.M:f.M,n=w.K();u.H()?(ar(q,r,Fb,n),n.H()||n.assign(s)):n.assign(s);p!==q&&u.H()&&q.isVisible()&&(p=f.M,p.H()&&(n.x+=u.x-p.x,n.y+=u.y-p.y));q=b.rev?f.M:e.M;p=w.K();q.H()?(ar(k,m,Fb,p),p.H()||p.assign(l)):p.assign(l);h!==k&&q.H()&&k.isVisible()&&(h=e.M,h.H()&&(p.x+=q.x-h.x,p.y+=q.y-h.y));90===this.aa||270===this.aa?(h=Math.round((n.x-s.x)/this.Ud),k=n.x,l=Math.round((p.x-l.x)/this.Ud),m=p.x):(h=Math.round((n.y-s.y)/this.Ud),k=n.y,l=Math.round((p.y-l.y)/this.Ud),m=p.y);
w.v(n);w.v(p);b.portFromColOffset=h;b.portFromPos=k;b.portToColOffset=l;b.portToPos=m}else b.portFromColOffset=0,b.portFromPos=0,b.portToColOffset=0,b.portToPos=0;n=f.layer;s=e.layer;a:if(p=b,q=0,u=p.link,null!==u){var t=u.ed,x=u.Sd;if(null!==t&&null!==x){var v=u.W,r=u.$;if(null!==v&&null!==r){var B=t.Ab,y=x.Bb;this.uq||(u.Ab.Uc()||(B=u.Ab),u.Bb.Uc()||(y=u.Bb));var H=u.ic,E=uu(this,!0);if(B.Uc()||B===sb)B=E;var V=uu(this,!1);if(y.Uc()||y===sb)y=V;if(B.sj()&&B.qj(V)&&y.sj()&&y.qj(E)){q=0;break a}E=
u.getLinkPoint(v,t,B,!0,H,r,x,w.K());B=u.getLinkDirection(v,t,E,B,!0,H,r,x);w.v(E);B===vu(this,p,!0)?q+=1:this.uq&&null!==v&&1===v.ports.count&&p.rev&&(q+=1);B=u.getLinkPoint(r,x,y,!1,H,v,t,w.K());u=u.getLinkDirection(r,x,B,y,!1,H,v,t);w.v(B);u===vu(this,p,!1)?q+=2:this.uq&&null!==r&&1===r.ports.count&&p.rev&&(q+=2)}}}p=1===q||3===q?!0:!1;if(q=2===q||3===q?!0:!1)r=a.createVertex(),r.pd=null,r.kn=1,r.layer=n,r.near=f,a.Cl(r),f=a.gq(f,r,b.link),f.valid=!1,f.rev=b.rev,f.portFromColOffset=h,f.portToColOffset=
0,f.portFromPos=k,f.portToPos=0,f=r;u=1;p&&u--;if(n-s>u&&0<n){b.valid=!1;r=a.createVertex();r.pd=null;r.kn=2;r.layer=n-1;a.Cl(r);f=a.gq(f,r,b.link);f.valid=!0;f.rev=b.rev;f.portFromColOffset=q?0:h;f.portToColOffset=0;f.portFromPos=q?0:k;f.portToPos=0;f=r;for(n--;n-s>u&&0<n;)r=a.createVertex(),r.pd=null,r.kn=3,r.layer=n-1,a.Cl(r),f=a.gq(f,r,b.link),f.valid=!0,f.rev=b.rev,f.portFromColOffset=0,f.portToColOffset=0,f.portFromPos=0,f.portToPos=0,f=r,n--;f=a.gq(r,e,b.link);f.valid=!p;p&&(r.near=e);f.rev=
b.rev;f.portFromColOffset=0;f.portToColOffset=l;f.portFromPos=0;f.portToPos=m}else b.valid=!0}d=this.he=[];for(b=0;b<=this.pb;b++)d[b]=0;for(a=this.network.vertexes.i;a.next();)a.value.index=-1;this.initializeIndices();this.Vv=-1;for(b=this.Kf=this.fs=0;b<=this.pb;b++)d[b]>d[this.Kf]&&(this.Vv=d[b]-1,this.Kf=b),d[b]<d[this.fs]&&(this.fs=b);this.ps=[];for(b=0;b<d.length;b++)this.ps[b]=[];for(a.reset();a.next();)d=a.value,this.ps[d.layer][d.index]=d;this.Jb=-1;for(a=0;a<=this.pb;a++){d=wu(this,a);b=
0;c=this.he[a];for(e=0;e<c;e++)f=d[e],b+=this.nodeMinColumnSpace(f,!0),f.column=b,b+=1,b+=this.nodeMinColumnSpace(f,!1);this.Jb=Math.max(this.Jb,b-1);xu(this,a,d)}this.reduceCrossings();this.straightenAndPack();this.updateParts()}this.network=null;this.yf=!0};iu.prototype.linkMinLength=function(){return 1};function yu(a){var b=a.fromVertex.pd;a=a.toVertex.pd;return null===b&&null===a?8:null===b||null===a?4:1}
iu.prototype.nodeMinLayerSpace=function(a,b){return null===a.pd?0:90===this.aa||270===this.aa?b?a.T.y+10:a.M.height-a.T.y+10:b?a.T.x+10:a.M.width-a.T.x+10};iu.prototype.nodeMinColumnSpace=function(a,b){if(null===a.pd)return 0;var c=b?a.LA:a.KA;if(null!==c)return c;c=this.aa;return 90===c||270===c?b?a.LA=a.T.x/this.Ud+1|0:a.KA=(a.M.width-a.T.x)/this.Ud+1|0:b?a.LA=a.T.y/this.Ud+1|0:a.KA=(a.M.height-a.T.y)/this.Ud+1|0};
function zu(a){null===a.Mm&&(a.Mm=[]);for(var b=0,c=a.network.vertexes.i;c.next();){var d=c.value;a.Mm[b]=d.layer;b++;a.Mm[b]=d.column;b++;a.Mm[b]=d.index;b++}return a.Mm}function Au(a,b){for(var c=0,d=a.network.vertexes.i;d.next();){var e=d.value;e.layer=b[c];c++;e.column=b[c];c++;e.index=b[c];c++}}
function Bu(a,b,c){var d=wu(a,b),e=a.he[b];if(null===a.ns||a.ns.length<e*e)a.ns=[];for(var f=a.ns,h=0;h<e;h++){var k=0,l=d[h],m=l.near,n=0;if(null!==m&&m.layer===l.layer)if(n=m.index,n>h)for(var p=h+1;p<n;p++)l=d[p],l.near===m&&l.kn===m.kn||k++;else for(p=h-1;p>n;p--)l=d[p],l.near===m&&l.kn===m.kn||k++;var m=0,q,r=q=p=l=0,s,u=0,t=0;s=0;var x;if(0<=c)for(n=d[h].Oe,m=0;m<n.count;m++)if(q=n.n[m],q.valid&&q.fromVertex.layer!==b)for(l=q.fromVertex.index,p=q.portToPos,q=q.portFromPos,r=m+1;r<n.count;r++)s=
n.n[r],s.valid&&s.fromVertex.layer!==b&&(u=s.fromVertex.index,t=s.portToPos,s=s.portFromPos,p<t&&(l>u||l===u&&q>s)&&k++,t<p&&(u>l||u===l&&s>q)&&k++);if(0>=c)for(n=d[h].He,m=0;m<n.count;m++)if(q=n.n[m],q.valid&&q.toVertex.layer!==b)for(l=q.toVertex.index,p=q.portToPos,q=q.portFromPos,r=m+1;r<n.count;r++)s=n.n[r],s.valid&&s.toVertex.layer!==b&&(u=s.toVertex.index,t=s.portToPos,s=s.portFromPos,q<s&&(l>u||l===u&&p>t)&&k++,s<q&&(u>l||u===l&&t>p)&&k++);f[h*e+h]=k;for(n=h+1;n<e;n++){var v=0,B=0;if(0<=c)for(k=
d[h].Oe,x=d[n].Oe,m=0;m<k.count;m++)if(q=k.n[m],q.valid&&q.fromVertex.layer!==b)for(l=q.fromVertex.index,q=q.portFromPos,r=0;r<x.count;r++)s=x.n[r],s.valid&&s.fromVertex.layer!==b&&(u=s.fromVertex.index,s=s.portFromPos,(l<u||l===u&&q<s)&&B++,(u<l||u===l&&s<q)&&v++);if(0>=c)for(k=d[h].He,x=d[n].He,m=0;m<k.count;m++)if(q=k.n[m],q.valid&&q.toVertex.layer!==b)for(l=q.toVertex.index,p=q.portToPos,r=0;r<x.count;r++)s=x.n[r],s.valid&&s.toVertex.layer!==b&&(u=s.toVertex.index,t=s.portToPos,(l<u||l===u&&p<
t)&&B++,(u<l||u===l&&t<p)&&v++);f[h*e+n]=v;f[n*e+h]=B}}xu(a,b,d);return f}iu.prototype.countCrossings=function(){for(var a=0,b=0;b<=this.pb;b++)for(var c=Bu(this,b,1),d=this.he[b],e=0;e<d;e++)for(var f=e;f<d;f++)a+=c[e*d+f];return a};
function Cu(a){for(var b=0,c=0;c<=a.pb;c++){for(var d=a,e=c,f=wu(d,e),h=d.he[e],k=0,l=0;l<h;l++){var m=null,m=f[l].He,n,p=0,q=0;if(null!==m)for(var r=0;r<m.count;r++)n=m.n[r],n.valid&&n.toVertex.layer!==e&&(p=n.fromVertex.column+n.portFromColOffset,q=n.toVertex.column+n.portToColOffset,k+=(Math.abs(p-q)+1)*yu(n))}xu(d,e,f);b+=k}return b}
iu.prototype.normalize=function(){var a=Infinity;this.Jb=-1;for(var b=this.network.vertexes.i;b.next();){var c=b.value,a=Math.min(a,c.column-this.nodeMinColumnSpace(c,!0));this.Jb=Math.max(this.Jb,c.column+this.nodeMinColumnSpace(c,!1))}for(b.reset();b.next();)b.value.column-=a;this.Jb-=a};
function Du(a,b,c){for(var d=wu(a,b),e=a.he[b],f=[],h=0;h<e;h++){var k=d[h],l=null;0>=c&&(l=k.Oe);var m=null;0<=c&&(m=k.He);var n=0,p=0,q=k.near;null!==q&&q.layer===k.layer&&(n+=q.column-1,p++);if(null!==l)for(q=0;q<l.count;q++){var k=l.n[q],r=k.fromVertex;k.valid&&!k.rev&&r.layer!==b&&(n+=r.column,p++)}if(null!==m)for(l=0;l<m.count;l++)k=m.n[l],q=k.toVertex,k.valid&&!k.rev&&q.layer!==b&&(n+=q.column,p++);f[h]=0===p?-1:n/p}xu(a,b,d);return f}
function Eu(a,b,c){for(var d=wu(a,b),e=a.he[b],f=[],h=0;h<e;h++){var k=d[h],l=null;0>=c&&(l=k.Oe);var m=null;0<=c&&(m=k.He);var n=0,p=[],q=k.near;null!==q&&q.layer===k.layer&&(p[n]=q.column-1,n++);if(null!==l)for(q=0;q<l.count;q++){var k=l.n[q],r=k.fromVertex;k.valid&&!k.rev&&r.layer!==b&&(p[n]=r.column+k.portFromColOffset,n++)}if(null!==m)for(l=0;l<m.count;l++)k=m.n[l],q=k.toVertex,k.valid&&!k.rev&&q.layer!==b&&(p[n]=q.column+k.portToColOffset,n++);0===n?f[h]=-1:(p.sort(function(a,b){return a-b}),
m=n>>1,f[h]=0!==(n&1)?p[m]:p[m-1]+p[m]>>1)}xu(a,b,d);return f}function Fu(a,b,c,d,e,f){if(b.component===d){b.component=c;var h=0,k=0;if(e)for(var l=b.hc;l.next();){var k=l.value,m=k.toVertex,h=b.layer-m.layer,k=a.linkMinLength(k);h===k&&Fu(a,m,c,d,e,f)}if(f)for(l=b.kc;l.next();)k=l.value,m=k.fromVertex,h=m.layer-b.layer,k=a.linkMinLength(k),h===k&&Fu(a,m,c,d,e,f)}}
function Gu(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var h=b.hc;h.next();)Gu(a,h.value.toVertex,c,d,e,f);if(f)for(b=b.kc;b.next();)Gu(a,b.value.fromVertex,c,d,e,f)}}function qu(a){for(a=a.vertexes.i;a.next();){var b=a.value;if(b.valid)return b}return null}function ru(a){for(a=a.vertexes.i;a.next();){var b=a.value;if(b.valid){for(var c=!0,d=b.hc;d.next();)if(d.value.toVertex.valid){c=!1;break}if(c)return b}}return null}
function su(a){for(a=a.vertexes.i;a.next();){var b=a.value;if(b.valid){for(var c=!0,d=b.kc;d.next();)if(d.value.fromVertex.valid){c=!1;break}if(c)return b}}return null}function tu(a,b){b.Rp=a.os;a.os++;for(var c=b.hc;c.next();){var d=c.value,e=d.toVertex;-1===e.Rp&&(d.forest=!0,tu(a,e))}b.finish=a.os;a.os++}
iu.prototype.assignLayers=function(){switch(this.Xo){case Hu:Iu(this);break;case Ju:for(var a=0,b=this.network.vertexes.i;b.next();)a=Ku(this,b.value),this.pb=Math.max(a,this.pb);for(b.reset();b.next();)a=b.value,a.layer=this.pb-a.layer;break;default:case ku:Iu(this);for(b=this.network.vertexes.i;b.next();)b.value.valid=!1;for(b.reset();b.next();)a=b.value,0===a.kc.count&&Lu(this,a);a=Infinity;for(b.reset();b.next();)a=Math.min(a,b.value.layer);this.pb=-1;for(b.reset();b.next();){var c=b.value;c.layer-=
a;this.pb=Math.max(this.pb,c.layer)}}};function Iu(a){for(var b=a.network.vertexes.i;b.next();){var c=Mu(a,b.value);a.pb=Math.max(c,a.pb)}}function Mu(a,b){var c=0;if(-1===b.layer){for(var d=b.hc;d.next();)var e=d.value,f=e.toVertex,e=a.linkMinLength(e),c=Math.max(c,Mu(a,f)+e);b.layer=c}else c=b.layer;return c}function Ku(a,b){var c=0;if(-1===b.layer){for(var d=b.kc;d.next();)var e=d.value,f=e.fromVertex,e=a.linkMinLength(e),c=Math.max(c,Ku(a,f)+e);b.layer=c}else c=b.layer;return c}
function Lu(a,b){if(!b.valid){b.valid=!0;for(var c=b.hc;c.next();)Lu(a,c.value.toVertex);for(c=a.network.vertexes.i;c.next();)c.value.component=-1;for(var d=b.Oe.n,e=d.length,f=0;f<e;f++){var h=d[f],k=h.fromVertex,l=h.toVertex,h=a.linkMinLength(h);k.layer-l.layer>h&&Fu(a,k,0,-1,!0,!1)}for(Fu(a,b,1,-1,!0,!0);0!==b.component;){for(var k=0,d=Infinity,l=0,m=null,n=a.network.vertexes.i;n.next();){var p=n.value;if(1===p.component){for(var q=0,r=!1,s=p.Oe.n,e=s.length,f=0;f<e;f++){var h=s[f],u=h.fromVertex,
q=q+1;1!==u.component&&(k+=1,u=u.layer-p.layer,h=a.linkMinLength(h),d=Math.min(d,u-h))}h=p.He.n;e=h.length;for(f=0;f<e;f++)s=h[f].toVertex,q-=1,1!==s.component?k-=1:r=!0;(null===m||q<l)&&!r&&(m=p,l=q)}}if(0<k){for(c.reset();c.next();)e=c.value,1===e.component&&(e.layer+=d);b.component=0}else m.component=0}for(c=a.network.vertexes.i;c.next();)c.value.component=-1;for(Fu(a,b,1,-1,!0,!1);0!==b.component;){f=0;e=Infinity;d=0;h=null;for(k=a.network.vertexes.i;k.next();)if(l=k.value,1===l.component){m=
0;n=!1;r=l.Oe.n;p=r.length;for(q=0;q<p;q++)s=r[q].fromVertex,m+=1,1!==s.component?f+=1:n=!0;r=l.He.n;p=r.length;for(q=0;q<p;q++)s=r[q],u=s.toVertex,m-=1,1!==u.component&&(f-=1,u=l.layer-u.layer,s=a.linkMinLength(s),e=Math.min(e,u-s));(null===h||m>d)&&!n&&(h=l,d=m)}if(0>f){for(c.reset();c.next();)f=c.value,1===f.component&&(f.layer-=e);b.component=0}else h.component=0}}}
function vu(a,b,c){return 90===a.aa?c&&!b.rev||!c&&b.rev?270:90:180===a.aa?c&&!b.rev||!c&&b.rev?0:180:270===a.aa?c&&!b.rev||!c&&b.rev?90:270:c&&!b.rev||!c&&b.rev?180:0}
iu.prototype.initializeIndices=function(){switch(this.Mo){default:case Nu:for(var a=this.network.vertexes.i;a.next();){var b=a.value,c=b.layer;b.index=this.he[c];this.he[c]++}break;case lu:a=this.network.vertexes.i;for(b=this.pb;0<=b;b--)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&Ou(this,c);break;case Pu:for(a=this.network.vertexes.i,b=0;b<=this.pb;b++)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&Qu(this,c)}};
function Ou(a,b){var c=b.layer;b.index=a.he[c];a.he[c]++;for(var c=b.He.dc(),d=!0;d;)for(var d=!1,e=0;e<c.length-1;e++){var f=c[e],h=c[e+1];f.portFromColOffset>h.portFromColOffset&&(d=!0,c[e]=h,c[e+1]=f)}for(e=0;e<c.length;e++)d=c[e],d.valid&&(d=d.toVertex,-1===d.index&&Ou(a,d))}
function Qu(a,b){var c=b.layer;b.index=a.he[c];a.he[c]++;for(var c=b.Oe.dc(),d=!0,e=0;d;)for(d=!1,e=0;e<c.length-1;e++){var f=c[e],h=c[e+1];f.portToColOffset>h.portToColOffset&&(d=!0,c[e]=h,c[e+1]=f)}for(e=0;e<c.length;e++)d=c[e],d.valid&&(d=d.fromVertex,-1===d.index&&Qu(a,d))}
iu.prototype.reduceCrossings=function(){for(var a=this.countCrossings(),b=zu(this),c=0,d=0,e=0,c=0;c<this.Fm;c++){for(d=0;d<=this.pb;d++)Ru(this,d,1),Su(this,d,1);e=this.countCrossings();e<a&&(a=e,b=zu(this));for(d=this.pb;0<=d;d--)Ru(this,d,-1),Su(this,d,-1);e=this.countCrossings();e<a&&(a=e,b=zu(this))}Au(this,b);for(c=0;c<this.Fm;c++){for(d=0;d<=this.pb;d++)Ru(this,d,0),Su(this,d,0);e=this.countCrossings();e<a&&(a=e,b=zu(this));for(d=this.pb;0<=d;d--)Ru(this,d,0),Su(this,d,0);e=this.countCrossings();
e<a&&(a=e,b=zu(this))}Au(this,b);var f=!1,h=c=0,k=0,d=0;switch(this.io){case Tu:break;case Uu:for(k=a+1;(d=this.countCrossings())<k;)for(k=d,c=this.pb;0<=c;c--)for(h=0;h<=c;h++){for(f=!0;f;)for(f=!1,d=c;d>=h;d--)f=Su(this,d,-1)||f;e=this.countCrossings();e>=a?Au(this,b):(a=e,b=zu(this));for(f=!0;f;)for(f=!1,d=c;d>=h;d--)f=Su(this,d,1)||f;e=this.countCrossings();e>=a?Au(this,b):(a=e,b=zu(this));for(f=!0;f;)for(f=!1,d=h;d<=c;d++)f=Su(this,d,1)||f;e>=a?Au(this,b):(a=e,b=zu(this));for(f=!0;f;)for(f=!1,
d=h;d<=c;d++)f=Su(this,d,-1)||f;e>=a?Au(this,b):(a=e,b=zu(this));for(f=!0;f;)for(f=!1,d=c;d>=h;d--)f=Su(this,d,0)||f;e>=a?Au(this,b):(a=e,b=zu(this));for(f=!0;f;)for(f=!1,d=h;d<=c;d++)f=Su(this,d,0)||f;e>=a?Au(this,b):(a=e,b=zu(this))}break;default:case mu:for(c=this.pb,h=0,k=a+1;(d=this.countCrossings())<k;){k=d;for(f=!0;f;)for(f=!1,d=c;d>=h;d--)f=Su(this,d,-1)||f;e=this.countCrossings();e>=a?Au(this,b):(a=e,b=zu(this));for(f=!0;f;)for(f=!1,d=c;d>=h;d--)f=Su(this,d,1)||f;e=this.countCrossings();
e>=a?Au(this,b):(a=e,b=zu(this));for(f=!0;f;)for(f=!1,d=h;d<=c;d++)f=Su(this,d,1)||f;e>=a?Au(this,b):(a=e,b=zu(this));for(f=!0;f;)for(f=!1,d=h;d<=c;d++)f=Su(this,d,-1)||f;e>=a?Au(this,b):(a=e,b=zu(this));for(f=!0;f;)for(f=!1,d=c;d>=h;d--)f=Su(this,d,0)||f;e>=a?Au(this,b):(a=e,b=zu(this));for(f=!0;f;)for(f=!1,d=h;d<=c;d++)f=Su(this,d,0)||f;e>=a?Au(this,b):(a=e,b=zu(this))}}Au(this,b)};
function Ru(a,b,c){var d=0,e=wu(a,b),f=a.he[b],h=Eu(a,b,c);c=Du(a,b,c);for(d=0;d<f;d++)-1===c[d]&&(c[d]=e[d].column),-1===h[d]&&(h[d]=e[d].column);for(var k=!0,l;k;)for(k=!1,d=0;d<f-1;d++)if(h[d+1]<h[d]||h[d+1]===h[d]&&c[d+1]<c[d])k=!0,l=h[d],h[d]=h[d+1],h[d+1]=l,l=c[d],c[d]=c[d+1],c[d+1]=l,l=e[d],e[d]=e[d+1],e[d+1]=l;for(d=h=0;d<f;d++)l=e[d],l.index=d,h+=a.nodeMinColumnSpace(l,!0),l.column=h,h+=1,h+=a.nodeMinColumnSpace(l,!1);xu(a,b,e)}
function Su(a,b,c){var d=wu(a,b),e=a.he[b];c=Bu(a,b,c);var f=0,h;h=[];for(f=0;f<e;f++)h[f]=-1;var k;k=[];for(f=0;f<e;f++)k[f]=-1;for(var l=!1,m=!0;m;)for(m=!1,f=0;f<e-1;f++){var n=c[d[f].index*e+d[f+1].index],p=c[d[f+1].index*e+d[f].index],q=0,r=0,s=d[f].column,u=d[f+1].column,t=a.nodeMinColumnSpace(d[f],!0),x=a.nodeMinColumnSpace(d[f],!1),v=a.nodeMinColumnSpace(d[f+1],!0),B=a.nodeMinColumnSpace(d[f+1],!1),t=s-t+v,x=u-x+B,v=v=0,y=d[f].kc.i;for(y.reset();y.next();)if(v=y.value,B=v.fromVertex,v.valid&&
B.layer===b){for(v=0;d[v]!==B;)v++;v<f&&(q+=2*(f-v),r+=2*(f+1-v));v===f+1&&(q+=1);v>f+1&&(q+=4*(v-f),r+=4*(v-(f+1)))}y=d[f].hc.i;for(y.reset();y.next();)if(v=y.value,B=v.toVertex,v.valid&&B.layer===b){for(v=0;d[v]!==B;)v++;v===f+1&&(r+=1)}y=d[f+1].kc.i;for(y.reset();y.next();)if(v=y.value,B=v.fromVertex,v.valid&&B.layer===b){for(v=0;d[v]!==B;)v++;v<f&&(q+=2*(f+1-v),r+=2*(f-v));v===f&&(r+=1);v>f+1&&(q+=4*(v-(f+1)),r+=4*(v-f))}y=d[f+1].hc.i;for(y.reset();y.next();)if(v=y.value,B=v.toVertex,v.valid&&
B.layer===b){for(v=0;d[v]!==B;)v++;v===f&&(q+=1)}var v=B=0,y=h[d[f].index],H=k[d[f].index],E=h[d[f+1].index],V=k[d[f+1].index];-1!==y&&(B+=Math.abs(y-s),v+=Math.abs(y-x));-1!==H&&(B+=Math.abs(H-s),v+=Math.abs(H-x));-1!==E&&(B+=Math.abs(E-u),v+=Math.abs(E-t));-1!==V&&(B+=Math.abs(V-u),v+=Math.abs(V-t));if(r<q-.5||r===q&&p<n-.5||r===q&&p===n&&v<B-.5)m=l=!0,d[f].column=x,d[f+1].column=t,n=d[f],d[f]=d[f+1],d[f+1]=n}for(f=0;f<e;f++)d[f].index=f;xu(a,b,d);return l}
iu.prototype.straightenAndPack=function(){var a=0,b=!1,c=0!==(this.Yi&Vu),a=this.Yi===nu;1E3<this.network.edges.count&&!a&&(c=!1);if(c){b=[];for(a=a=0;a<=this.pb;a++)b[a]=0;for(var d=0,e=this.network.vertexes.i;e.next();){var f=e.value,a=f.layer,d=f.column,f=this.nodeMinColumnSpace(f,!1);b[a]=Math.max(b[a],d+f)}for(e.reset();e.next();)f=e.value,a=f.layer,d=f.column,f.column=(8*(this.Jb-b[a])>>1)+8*d;this.Jb*=8}if(0!==(this.Yi&Wu))for(b=!0;b;){b=!1;for(a=this.Kf+1;a<=this.pb;a++)b=Xu(this,a,1)||b;
for(a=this.Kf-1;0<=a;a--)b=Xu(this,a,-1)||b;b=Xu(this,this.Kf,0)||b}if(0!==(this.Yi&Yu)){for(a=this.Kf+1;a<=this.pb;a++)Zu(this,a,1);for(a=this.Kf-1;0<=a;a--)Zu(this,a,-1);Zu(this,this.Kf,0)}c&&($u(this,-1),$u(this,1));if(0!==(this.Yi&Wu))for(b=!0;b;){b=!1;b=Xu(this,this.Kf,0)||b;for(a=this.Kf+1;a<=this.pb;a++)b=Xu(this,a,0)||b;for(a=this.Kf-1;0<=a;a--)b=Xu(this,a,0)||b}};function Xu(a,b,c){for(var d=!1;av(a,b,c);)d=!0;return d}
function av(a,b,c){var d=0,e=wu(a,b),f=a.he[b],h=Du(a,b,-1);if(0<c)for(d=0;d<f;d++)h[d]=-1;var k=Du(a,b,1);if(0>c)for(d=0;d<f;d++)k[d]=-1;for(var l=!1,m=!0;m;)for(m=!1,d=0;d<f;d++){var n=e[d].column,p=a.nodeMinColumnSpace(e[d],!0),q=a.nodeMinColumnSpace(e[d],!1),r=0,r=0>d-1||n-e[d-1].column-1>p+a.nodeMinColumnSpace(e[d-1],!1)?n-1:n,p=0,p=d+1>=f||e[d+1].column-n-1>q+a.nodeMinColumnSpace(e[d+1],!0)?n+1:n,s=q=0,u=0,t=0,x=0,v=0;if(0>=c)for(var B=e[d].kc.i;B.next();){var v=B.value,y=v.fromVertex;v.valid&&
y.layer!==b&&(t=yu(v),x=v.portFromColOffset,v=v.portToColOffset,y=y.column,q+=(Math.abs(n+v-(y+x))+1)*t,s+=(Math.abs(r+v-(y+x))+1)*t,u+=(Math.abs(p+v-(y+x))+1)*t)}if(0<=c)for(B=e[d].hc.i;B.next();)v=B.value,y=v.toVertex,v.valid&&y.layer!==b&&(t=yu(v),x=v.portFromColOffset,v=v.portToColOffset,y=y.column,q+=(Math.abs(n+x-(y+v))+1)*t,s+=(Math.abs(r+x-(y+v))+1)*t,u+=(Math.abs(p+x-(y+v))+1)*t);v=x=t=0;B=h[e[d].index];y=k[e[d].index];-1!==B&&(t+=Math.abs(B-n),x+=Math.abs(B-r),v+=Math.abs(B-p));-1!==y&&
(t+=Math.abs(y-n),x+=Math.abs(y-r),v+=Math.abs(y-p));if(s<q||s===q&&x<t)m=l=!0,e[d].column=r;else if(u<q||u===q&&v<t)m=l=!0,e[d].column=p}xu(a,b,e);a.normalize();return l}
function Zu(a,b,c){var d=0,e=wu(a,b),f=a.he[b],h=Eu(a,b,c);c=[];for(d=0;d<f;d++)c[d]=h[d];for(h=!0;h;)for(h=!1,d=0;d<f;d++){var k=e[d].column,l=a.nodeMinColumnSpace(e[d],!0),m=a.nodeMinColumnSpace(e[d],!1),n=0,p=0,q=0,q=p=0;-1===c[d]?0===d&&d===f-1?n=k:0===d?(p=e[d+1].column,n=p-k===m+a.nodeMinColumnSpace(e[d+1],!0)?k-1:k):d===f-1?(q=e[d-1].column,n=k-q===l+a.nodeMinColumnSpace(e[d-1],!1)?k+1:k):(q=e[d-1].column,q=q+a.nodeMinColumnSpace(e[d-1],!1)+l+1,p=e[d+1].column,p=p-a.nodeMinColumnSpace(e[d+
1],!0)-m-1,n=(q+p)/2|0):0===d&&d===f-1?n=c[d]:0===d?(p=e[d+1].column,p=p-a.nodeMinColumnSpace(e[d+1],!0)-m-1,n=Math.min(c[d],p)):d===f-1?(q=e[d-1].column,q=q+a.nodeMinColumnSpace(e[d-1],!1)+l+1,n=Math.max(c[d],q)):(q=e[d-1].column,q=q+a.nodeMinColumnSpace(e[d-1],!1)+l+1,p=e[d+1].column,p=p-a.nodeMinColumnSpace(e[d+1],!0)-m-1,q<c[d]&&c[d]<p?n=c[d]:q>=c[d]?n=q:p<=c[d]&&(n=p));n!==k&&(h=!0,e[d].column=n)}xu(a,b,e);a.normalize()}
function bv(a,b){for(var c=!0,d=a.network.vertexes.i;d.next();){var e=d.value,f=a.nodeMinColumnSpace(e,!0),h=a.nodeMinColumnSpace(e,!1);if(e.column-f<=b&&e.column+h>=b){c=!1;break}}e=!1;if(c)for(d.reset();d.next();)c=d.value,c.column>b&&(c.column-=1,e=!0);return e}
function cv(a,b){for(var c=b,c=b+1,d=0,e=[],f=[],d=0;d<=a.pb;d++)e[d]=!1,f[d]=!1;for(var h=a.network.vertexes.i;h.next();){var d=h.value,k=d.column-a.nodeMinColumnSpace(d,!0),l=d.column+a.nodeMinColumnSpace(d,!1);k<=b&&l>=b&&(e[d.layer]=!0);k<=c&&l>=c&&(f[d.layer]=!0)}k=!0;c=!1;for(d=0;d<=a.pb;d++)k=k&&!(e[d]&&f[d]);if(k)for(h.reset();h.next();)e=h.value,e.column>b&&(e.column-=1,c=!0);return c}
function $u(a,b){for(var c=0;c<=a.Jb;c++)for(;bv(a,c););a.normalize();for(c=0;c<a.Jb;c++)for(;cv(a,c););a.normalize();var c=0,d,e=0,f=0,h=0;if(0<b)for(c=0;c<=a.Jb;c++)for(d=zu(a),e=Cu(a),f=e+1;e<f;)f=e,dv(a,c,1),h=Cu(a),h>e?Au(a,d):h<e&&(e=h,d=zu(a));if(0>b)for(c=a.Jb;0<=c;c--)for(d=zu(a),e=Cu(a),f=e+1;e<f;)f=e,dv(a,c,-1),h=Cu(a),h>e?Au(a,d):h<e&&(e=h,d=zu(a));a.normalize()}
function dv(a,b,c){a.xg=0;for(var d=a.network.vertexes.i;d.next();)d.value.component=-1;if(0<c)for(d.reset();d.next();){var e=d.value;e.column-a.nodeMinColumnSpace(e,!0)<=b&&(e.component=a.xg)}if(0>c)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.xg);a.xg++;for(d.reset();d.next();)b=d.value,-1===b.component&&(Gu(a,b,a.xg,-1,!0,!0),a.xg++);var f=0;b=[];for(f=0;f<a.xg*a.xg;f++)b[f]=!1;e=[];for(f=0;f<(a.pb+1)*(a.Jb+1);f++)e[f]=-1;for(d.reset();d.next();)for(var f=
d.value,h=f.layer,k=Math.max(0,f.column-a.nodeMinColumnSpace(f,!0)),l=Math.min(a.Jb,f.column+a.nodeMinColumnSpace(f,!1));k<=l;k++)e[h*(a.Jb+1)+k]=f.component;for(f=0;f<=a.pb;f++){if(0<c)for(k=0;k<a.Jb;k++)-1!==e[f*(a.Jb+1)+k]&&-1!==e[f*(a.Jb+1)+k+1]&&e[f*(a.Jb+1)+k]!==e[f*(a.Jb+1)+k+1]&&(b[e[f*(a.Jb+1)+k]*a.xg+e[f*(a.Jb+1)+k+1]]=!0);if(0>c)for(k=a.Jb;0<k;k--)-1!==e[f*(a.Jb+1)+k]&&-1!==e[f*(a.Jb+1)+k-1]&&e[f*(a.Jb+1)+k]!==e[f*(a.Jb+1)+k-1]&&(b[e[f*(a.Jb+1)+k]*a.xg+e[f*(a.Jb+1)+k-1]]=!0)}e=[];for(f=
0;f<a.xg;f++)e[f]=!0;h=new I("number");h.add(0);for(l=0;0!==h.count;)if(l=h.n[h.count-1],h.Xc(h.count-1),e[l])for(e[l]=!1,f=0;f<a.xg;f++)b[l*a.xg+f]&&h.Ld(0,f);if(0<c)for(d.reset();d.next();)a=d.value,e[a.component]&&(a.column-=1);if(0>c)for(d.reset();d.next();)c=d.value,e[c.component]&&(c.column+=1)}
iu.prototype.commitLayout=function(){if(this.uq)for(var a=uu(this,!0),b=uu(this,!1),c=this.network.edges.i;c.next();){var d=c.value.link;null!==d&&(d.Ab=a,d.Bb=b)}this.commitNodes();this.Sz();this.eu&&this.commitLinks()};function uu(a,b){return 270===a.aa?b?Dc:Gc:90===a.aa?b?Gc:Dc:180===a.aa?b?Ec:Fc:b?Fc:Ec}
iu.prototype.commitNodes=function(){this.tg=[];this.Jf=[];this.If=[];this.Nb=[];for(var a=0;a<=this.pb;a++)this.tg[a]=0,this.Jf[a]=0,this.If[a]=0,this.Nb[a]=0;for(a=this.network.vertexes.i;a.next();){var b=a.value,c=b.layer;this.tg[c]=Math.max(this.tg[c],this.nodeMinLayerSpace(b,!0));this.Jf[c]=Math.max(this.Jf[c],this.nodeMinLayerSpace(b,!1))}for(var b=0,d=this.Hm,c=0;c<=this.pb;c++){var e=d;0>=this.tg[c]+this.Jf[c]&&(e=0);0<c&&(b+=e/2);90===this.aa||0===this.aa?(b+=this.Jf[c],this.If[c]=b,b+=this.tg[c]):
(b+=this.tg[c],this.If[c]=b,b+=this.Jf[c]);c<this.pb&&(b+=e/2);this.Nb[c]=b}d=b;b=this.oe;for(c=0;c<=this.pb;c++)270===this.aa?this.If[c]=b.y+this.If[c]:90===this.aa?(this.If[c]=b.y+d-this.If[c],this.Nb[c]=d-this.Nb[c]):180===this.aa?this.If[c]=b.x+this.If[c]:(this.If[c]=b.x+d-this.If[c],this.Nb[c]=d-this.Nb[c]);a.reset();for(d=e=Infinity;a.next();){var c=a.value,f=c.layer,h=c.column|0,k=0,l=0;270===this.aa||90===this.aa?(k=b.x+this.Ud*h,l=this.If[f]):(k=this.If[f],l=b.y+this.Ud*h);c.ja=k;c.ra=l;
e=Math.min(c.x,e);d=Math.min(c.y,d)}e=b.x-e;b=b.y-d;this.OB=new z(e,b);for(a.reset();a.next();)c=a.value,c.x+=e,c.y+=b,c.commit()};
iu.prototype.Sz=function(){for(var a=0,b=this.Hm,c=0;c<=this.pb;c++)a+=this.tg[c],a+=this.Jf[c];for(var a=a+this.pb*b,b=[],c=this.Ud*this.Jb,d=this.II;0<=d;d--)270===this.aa?0===d?b.push(new A(0,0,c,Math.abs(this.Nb[0]))):b.push(new A(0,this.Nb[d-1],c,Math.abs(this.Nb[d-1]-this.Nb[d]))):90===this.aa?0===d?b.push(new A(0,this.Nb[0],c,Math.abs(this.Nb[0]-a))):b.push(new A(0,this.Nb[d],c,Math.abs(this.Nb[d-1]-this.Nb[d]))):180===this.aa?0===d?b.push(new A(0,0,Math.abs(this.Nb[0]),c)):b.push(new A(this.Nb[d-
1],0,Math.abs(this.Nb[d-1]-this.Nb[d]),c)):0===d?b.push(new A(this.Nb[0],0,Math.abs(this.Nb[0]-a),c)):b.push(new A(this.Nb[d],0,Math.abs(this.Nb[d-1]-this.Nb[d]),c));this.commitLayers(b,this.OB)};iu.prototype.commitLayers=function(){};
iu.prototype.commitLinks=function(){for(var a=this.network.edges.i,b;a.next();)b=a.value.link,null!==b&&(b.fm(),b.Jp(),b.ij());for(a.reset();a.next();)b=a.value.link,null!==b&&b.ao();for(a.reset();a.next();){var c=a.value;b=c.link;if(null!==b){b.fm();var d=b,e=d.W,f=d.$,h=d.ed,k=d.Sd,l=c.fromVertex,m=c.toVertex;if(c.valid){if(b.Ye===sj&&4===b.qa){if(c.rev)var n=e,e=f,f=n,p=h,h=k,k=p;if(l.column===m.column){var q=b.getLinkPoint(e,h,b.computeSpot(!0),!0,!1,f,k),r=b.getLinkPoint(f,k,b.computeSpot(!1),
!1,!1,e,h);q.H()||q.set(e.Y.Gl);r.H()||r.set(f.Y.Gl);b.Jp();b.Bl(q.x,q.y);b.Bl((2*q.x+r.x)/3,(2*q.y+r.y)/3);b.Bl((q.x+2*r.x)/3,(q.y+2*r.y)/3);b.Bl(r.x,r.y)}else{var s=!1,u=!1;null!==h&&b.computeSpot(!0)===sb&&(s=!0);null!==k&&b.computeSpot(!1)===sb&&(u=!0);if(s||u){var t=b.m(0).x,x=b.m(0).y,v=b.m(1).x,B=b.m(1).y,y=b.m(2).x,H=b.m(2).y,E=b.m(3).x,V=b.m(3).y;if(s){90===this.aa||270===this.aa?(v=t,B=(x+V)/2):(v=(t+E)/2,B=x);b.ea(1,v,B);var ba=b.getLinkPoint(e,h,b.computeSpot(!0),!0,!1,f,k);ba.H()||ba.set(e.Y.Gl);
b.ea(0,ba.x,ba.y)}u&&(90===this.aa||270===this.aa?(y=E,H=(x+V)/2):(y=(t+E)/2,H=V),b.ea(2,y,H),ba=b.getLinkPoint(f,k,b.computeSpot(!1),!1,!1,e,h),ba.H()||ba.set(f.Y.Gl),b.ea(3,ba.x,ba.y))}}}b.ij()}else if(l.layer===m.layer)b.ij();else{var Q=!1,$=!1,ca=0,R=b.Ot+1;if(b.ic)$=!0,ca=b.qa,4<ca&&b.points.removeRange(2,ca-3);else if(b.Ye===sj)Q=!0,ca=b.qa,4<ca&&b.points.removeRange(2,ca-3),R=2;else{var ca=b.qa,Ra=b.computeSpot(!0)===sb,hb=b.computeSpot(!1)===sb;2<ca&&Ra&&hb?b.points.removeRange(1,ca-2):3<
ca&&Ra&&!hb?b.points.removeRange(1,ca-3):3<ca&&!Ra&&hb?b.points.removeRange(2,ca-2):4<ca&&!Ra&&!hb&&b.points.removeRange(2,ca-3)}var qa,Ja;if(c.rev){for(var za=0;null!==m&&l!==m;){Ja=qa=null;for(var Pb=m.kc.i;Pb.next();){var Lb=Pb.value;if(Lb.link===c.link&&(qa=Lb.fromVertex,Ja=Lb.toVertex,null===qa.pd))break}if(qa!==l)if(Wa=b.m(R-1).x,lb=b.m(R-1).y,na=qa.ja,la=qa.ra,$)180===this.aa||0===this.aa?2===R?(b.w(R++,Wa,lb),b.w(R++,Wa,la)):(se=null!==Ja?Ja.ra:lb,se!==la&&(ib=this.Nb[qa.layer-1],b.w(R++,
ib,lb),b.w(R++,ib,la))):2===R?(b.w(R++,Wa,lb),b.w(R++,na,lb)):(Ed=null!==Ja?Ja.ja:Wa,Ed!==na&&(ib=this.Nb[qa.layer-1],b.w(R++,Wa,ib),b.w(R++,na,ib)));else if(2===R)if(jb=Math.max(10,this.tg[m.layer]),fb=Math.max(10,this.Jf[m.layer]),Q)180===this.aa?na<=m.M.x?(za=m.M.x,b.w(R++,za-jb,la),b.w(R++,za,la),b.w(R++,za+fb,la)):(b.w(R++,na-jb,la),b.w(R++,na,la),b.w(R++,na+fb,la)):90===this.aa?la>=m.M.bottom?(za=m.M.y+m.M.height,b.w(R++,na,za+fb),b.w(R++,na,za),b.w(R++,na,za-jb)):(b.w(R++,na,la+fb),b.w(R++,
na,la),b.w(R++,na,la-jb)):270===this.aa?la<=m.M.y?(za=m.M.y,b.w(R++,na,za-jb),b.w(R++,na,za),b.w(R++,na,za+fb)):(b.w(R++,na,la-jb),b.w(R++,na,la),b.w(R++,na,la+fb)):0===this.aa&&(na>=m.M.right?(za=m.M.x+m.M.width,b.w(R++,za+fb,la),b.w(R++,za,la),b.w(R++,za-jb,la)):(b.w(R++,na+fb,la),b.w(R++,na,la),b.w(R++,na-jb,la)));else{b.w(R++,Wa,lb);var ae=0;if(180===this.aa||0===this.aa){if(180===this.aa?na>=m.M.right:na<=m.M.x)ae=(0===this.aa?-jb:fb)/2;b.w(R++,Wa+ae,la)}else{if(270===this.aa?la>=m.M.bottom:
la<=m.M.y)ae=(90===this.aa?-jb:fb)/2;b.w(R++,na,lb+ae)}b.w(R++,na,la)}else jb=Math.max(10,this.tg[qa.layer]),fb=Math.max(10,this.Jf[qa.layer]),180===this.aa?(Q&&b.w(R++,na-jb,la),b.w(R++,na,la),Q&&b.w(R++,na+fb,la)):90===this.aa?(Q&&b.w(R++,na,la+fb),b.w(R++,na,la),Q&&b.w(R++,na,la-jb)):270===this.aa?(Q&&b.w(R++,na,la-jb),b.w(R++,na,la),Q&&b.w(R++,na,la+fb)):(Q&&b.w(R++,na+fb,la),b.w(R++,na,la),Q&&b.w(R++,na-jb,la));m=qa}if(null===k||b.computeSpot(!1)!==sb||$)if(Wa=b.m(R-1).x,lb=b.m(R-1).y,na=b.m(R).x,
la=b.m(R).y,$){var pd=this.Jf[l.layer],rc=0;180===this.aa||0===this.aa?(rc=lb,rc>=l.M.y&&rc<=l.M.bottom&&(180===this.aa?na>=l.M.x:na<=l.M.right)&&(za=l.ja+(180===this.aa?-pd:pd),rc=rc<l.M.y+l.M.height/2?l.M.y-this.Ud/2:l.M.bottom+this.Ud/2,b.w(R++,za,lb),b.w(R++,za,rc)),b.w(R++,na,rc)):(rc=Wa,rc>=l.M.x&&rc<=l.M.right&&(270===this.aa?la>=l.M.y:la<=l.M.bottom)&&(za=l.ra+(270===this.aa?-pd:pd),rc=rc<l.M.x+l.M.width/2?l.M.x-this.Ud/2:l.M.right+this.Ud/2,b.w(R++,Wa,za),b.w(R++,rc,za)),b.w(R++,rc,la));
b.w(R++,na,la)}else if(Q)jb=Math.max(10,this.tg[l.layer]),fb=Math.max(10,this.Jf[l.layer]),180===this.aa&&na>=l.M.x?(za=l.M.x+l.M.width,b.ea(R-2,za,lb),b.ea(R-1,za+fb,lb)):90===this.aa&&la<=l.M.bottom?(za=l.M.y,b.ea(R-2,Wa,za),b.ea(R-1,Wa,za-jb)):270===this.aa&&la>=l.M.y?(za=l.M.y+l.M.height,b.ea(R-2,Wa,za),b.ea(R-1,Wa,za+fb)):0===this.aa&&na<=l.M.right&&(za=l.M.x,b.ea(R-2,za,lb),b.ea(R-1,za-jb,lb));else{jb=Math.max(10,this.tg[l.layer]);fb=Math.max(10,this.Jf[l.layer]);ae=0;if(180===this.aa||0===
this.aa){if(180===this.aa?na<=l.M.x:na>=l.M.right)ae=(0===this.aa?fb:-jb)/2;b.w(R++,na+ae,lb)}else{if(270===this.aa?la<=l.M.y:la>=l.M.bottom)ae=(90===this.aa?fb:-jb)/2;b.w(R++,Wa,la+ae)}b.w(R++,na,la)}}else{for(;null!==l&&l!==m;){Ja=qa=null;for(var xg=l.hc.i;xg.next();){var Df=xg.value;if(Df.link===c.link&&(qa=Df.toVertex,Ja=Df.fromVertex,null!==Ja.pd&&(Ja=null),null===qa.pd))break}var Wa=0,lb=0,na=0,la=0,ib=0,jb=0,fb=0;if(qa!==m)if(Wa=b.m(R-1).x,lb=b.m(R-1).y,na=qa.ja,la=qa.ra,$)if(180===this.aa||
0===this.aa){var se=null!==Ja?Ja.ra:lb;se!==la&&(ib=this.Nb[qa.layer],2===R&&(ib=0===this.aa?Math.max(ib,Wa):Math.min(ib,Wa)),b.w(R++,ib,lb),b.w(R++,ib,la))}else{var Ed=null!==Ja?Ja.ja:Wa;Ed!==na&&(ib=this.Nb[qa.layer],2===R&&(ib=90===this.aa?Math.max(ib,lb):Math.min(ib,lb)),b.w(R++,Wa,ib),b.w(R++,na,ib))}else jb=Math.max(10,this.tg[qa.layer]),fb=Math.max(10,this.Jf[qa.layer]),180===this.aa?(b.w(R++,na+fb,la),Q&&b.w(R++,na,la),b.w(R++,na-jb,la)):90===this.aa?(b.w(R++,na,la-jb),Q&&b.w(R++,na,la),b.w(R++,
na,la+fb)):270===this.aa?(b.w(R++,na,la+fb),Q&&b.w(R++,na,la),b.w(R++,na,la-jb)):(b.w(R++,na-jb,la),Q&&b.w(R++,na,la),b.w(R++,na+fb,la));l=qa}$&&(Wa=b.m(R-1).x,lb=b.m(R-1).y,na=b.m(R).x,la=b.m(R).y,180===this.aa||0===this.aa?lb!==la&&(ib=0===this.aa?Math.min(Math.max((na+Wa)/2,this.Nb[m.layer]),na):Math.max(Math.min((na+Wa)/2,this.Nb[m.layer]),na),b.w(R++,ib,lb),b.w(R++,ib,la)):Wa!==na&&(ib=90===this.aa?Math.min(Math.max((la+lb)/2,this.Nb[m.layer]),la):Math.max(Math.min((la+lb)/2,this.Nb[m.layer]),
la),b.w(R++,Wa,ib),b.w(R++,na,ib)))}if(null!==d&&Q){if(null!==h){if(b.computeSpot(!0)===sb){var tb=b.m(0),Le=b.m(2);tb.L(Le)||b.ea(1,(tb.x+Le.x)/2,(tb.y+Le.y)/2)}ba=b.getLinkPoint(e,h,sb,!0,!1,f,k);ba.H()||ba.set(e.Y.Gl);b.ea(0,ba.x,ba.y)}null!==k&&(b.computeSpot(!1)===sb&&(tb=b.m(b.qa-1),Le=b.m(b.qa-3),tb.L(Le)||b.ea(b.qa-2,(tb.x+Le.x)/2,(tb.y+Le.y)/2)),ba=b.getLinkPoint(f,k,sb,!1,!1,e,h),ba.H()||ba.set(f.Y.Gl),b.ea(b.qa-1,ba.x,ba.y))}b.ij();c.commit()}}}for(var ed=new I(W),ag=this.network.edges.i;ag.next();){var Ef=
ag.value.link;null!==Ef&&Ef.ic&&!ed.contains(Ef)&&ed.add(Ef)}if(0<ed.count)if(90===this.aa||270===this.aa){for(var yg=0,kb=new I(ev),wc,qd,bg=ed.i;bg.next();){var Bb=bg.value;if(null!==Bb&&Bb.ic)for(var Mb=2;Mb<Bb.qa-3;Mb++)if(wc=Bb.m(Mb),qd=Bb.m(Mb+1),fv(wc.y,qd.y)&&!fv(wc.x,qd.x)){var te=new ev;te.layer=Math.floor(wc.y/2);var zg=Bb.m(0),Fd=Bb.m(Bb.qa-1);te.first=zg.x*zg.x+zg.y;te.ee=Fd.x*Fd.x+Fd.y;te.We=Math.min(wc.x,qd.x);te.pe=Math.max(wc.x,qd.x);te.index=Mb;te.link=Bb;if(Mb+2<Bb.qa){var mb=Bb.m(Mb-
1),Jc=Bb.m(Mb+2),Ff=0;mb.y<wc.y?Ff=Jc.y<wc.y?3:wc.x<qd.x?2:1:mb.y>wc.y&&(Ff=Jc.y>wc.y?0:qd.x<wc.x?2:1);te.qi=Ff}kb.add(te)}}if(1<kb.count){kb.sort(this.ZF);for(var Me=0;Me<kb.count;){for(var Wh=kb.n[Me].layer,Sa=Me+1;Sa<kb.count&&kb.n[Sa].layer===Wh;)Sa++;if(1<Sa-Me)for(var cb=Me;cb<Sa;){for(var xc=kb.n[cb].pe,sc=Me+1;sc<Sa&&kb.n[sc].We<xc;)xc=Math.max(xc,kb.n[sc].pe),sc++;var Vc=sc-cb;if(1<Vc){kb.xq(this.$x,cb,cb+Vc);for(var jh=1,Ya=kb.n[cb].ee,Mb=cb;Mb<sc;Mb++){var xb=kb.n[Mb];xb.ee!==Ya&&(jh++,
Ya=xb.ee)}kb.xq(this.YF,cb,cb+Vc);for(var ub=1,Ya=kb.n[cb].first,Mb=cb;Mb<sc;Mb++)xb=kb.n[Mb],xb.first!==Ya&&(ub++,Ya=xb.first);var yc=!0,yb=ub;jh<ub?(yc=!1,yb=jh,Ya=kb.n[cb].ee,kb.xq(this.$x,cb,cb+Vc)):Ya=kb.n[cb].first;for(var ob=0,Mb=cb;Mb<sc;Mb++){xb=kb.n[Mb];(yc?xb.first:xb.ee)!==Ya&&(ob++,Ya=yc?xb.first:xb.ee);Bb=xb.link;wc=Bb.m(xb.index);qd=Bb.m(xb.index+1);var Gb=this.sF*(ob-(yb-1)/2);yg++;Bb.fm();Bb.ea(xb.index,wc.x,wc.y+Gb);Bb.ea(xb.index+1,qd.x,qd.y+Gb);Bb.ij()}}cb=sc}Me=Sa}}}else{for(var be=
0,Cb=new I(ev),Qb,fd,Xh=ed.i;Xh.next();){var Nb=Xh.value;if(null!==Nb&&Nb.ic)for(var Ob=2;Ob<Nb.qa-3;Ob++)if(Qb=Nb.m(Ob),fd=Nb.m(Ob+1),fv(Qb.x,fd.x)&&!fv(Qb.y,fd.y)){var zc=new ev;zc.layer=Math.floor(Qb.x/2);var Wc=Nb.m(0),rd=Nb.m(Nb.qa-1);zc.first=Wc.x+Wc.y*Wc.y;zc.ee=rd.x+rd.y*rd.y;zc.We=Math.min(Qb.y,fd.y);zc.pe=Math.max(Qb.y,fd.y);zc.index=Ob;zc.link=Nb;if(Ob+2<Nb.qa){var Ag=Nb.m(Ob-1),Yh=Nb.m(Ob+2),pb=0;Ag.x<Qb.x?pb=Yh.x<Qb.x?3:Qb.y<fd.y?2:1:Ag.x>Qb.x&&(pb=Yh.x>Qb.x?0:fd.y<Qb.y?2:1);zc.qi=pb}Cb.add(zc)}}if(1<
Cb.count){Cb.sort(this.ZF);for(var Xc=0;Xc<Cb.count;){for(var Zh=Cb.n[Xc].layer,Ne=Xc+1;Ne<Cb.count&&Cb.n[Ne].layer===Zh;)Ne++;if(1<Ne-Xc)for(var ec=Xc;ec<Ne;){for(var ue=Cb.n[ec].pe,Wb=Xc+1;Wb<Ne&&Cb.n[Wb].We<ue;)ue=Math.max(ue,Cb.n[Wb].pe),Wb++;var Ac=Wb-ec;if(1<Ac){Cb.xq(this.$x,ec,ec+Ac);for(var sd=1,fc=Cb.n[ec].ee,Ob=ec;Ob<Wb;Ob++){var Ta=Cb.n[Ob];Ta.ee!==fc&&(sd++,fc=Ta.ee)}Cb.xq(this.YF,ec,ec+Ac);for(var gc=1,fc=Cb.n[ec].first,Ob=ec;Ob<Wb;Ob++)Ta=Cb.n[Ob],Ta.first!==fc&&(gc++,fc=Ta.first);
var $h=!0,bf=gc;sd<gc?($h=!1,bf=sd,fc=Cb.n[ec].ee,Cb.xq(this.$x,ec,ec+Ac)):fc=Cb.n[ec].first;for(var Gd=0,Ob=ec;Ob<Wb;Ob++){Ta=Cb.n[Ob];($h?Ta.first:Ta.ee)!==fc&&(Gd++,fc=$h?Ta.first:Ta.ee);Nb=Ta.link;Qb=Nb.m(Ta.index);fd=Nb.m(Ta.index+1);var Oe=this.sF*(Gd-(bf-1)/2);be++;Nb.fm();Nb.ea(Ta.index,Qb.x+Oe,Qb.y);Nb.ea(Ta.index+1,fd.x+Oe,fd.y);Nb.ij()}}ec=Wb}Xc=Ne}}}};
iu.prototype.ZF=function(a,b){return a instanceof ev&&b instanceof ev&&a!==b?a.layer<b.layer?-1:a.layer>b.layer?1:a.We<b.We?-1:a.We>b.We?1:a.pe<b.pe?-1:a.pe>b.pe?1:0:0};iu.prototype.YF=function(a,b){return a instanceof ev&&b instanceof ev&&a!==b?a.first<b.first?-1:a.first>b.first||a.qi<b.qi?1:a.qi>b.qi||a.We<b.We?-1:a.We>b.We?1:a.pe<b.pe?-1:a.pe>b.pe?1:0:0};
iu.prototype.$x=function(a,b){return a instanceof ev&&b instanceof ev&&a!==b?a.ee<b.ee?-1:a.ee>b.ee||a.qi<b.qi?1:a.qi>b.qi||a.We<b.We?-1:a.We>b.We?1:a.pe<b.pe?-1:a.pe>b.pe?1:0:0};function fv(a,b){var c=a-b;return-1<c&&1>c}function wu(a,b){var c,d=a.he[b];if(d>=a.hh.length){c=[];for(var e=0;e<a.hh.length;e++)c[e]=a.hh[e];a.hh=c}void 0===a.hh[d]||null===a.hh[d]?c=[]:(c=a.hh[d],a.hh[d]=null);d=a.ps[b];for(e=0;e<d.length;e++){var f=d[e];c[f.index]=f}return c}function xu(a,b,c){a.hh[a.he[b]]=c}
w.defineProperty(iu,{layerSpacing:"layerSpacing"},function(){return this.Hm},function(a){this.Hm!==a&&(w.j(a,"number",iu,"layerSpacing"),0<=a&&(this.Hm=a,this.J()))});w.defineProperty(iu,{vK:"columnSpacing"},function(){return this.Ud},function(a){this.Ud!==a&&(w.j(a,"number",iu,"columnSpacing"),0<a&&(this.Ud=a,this.J()))});
w.defineProperty(iu,{direction:"direction"},function(){return this.aa},function(a){this.aa!==a&&(w.j(a,"number",iu,"direction"),0===a||90===a||180===a||270===a?(this.aa=a,this.J()):w.k("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))});w.defineProperty(iu,{angle:"angle"},function(){return this.direction},function(a){this.direction=a});
w.defineProperty(iu,{AH:"cycleRemoveOption"},function(){return this.vo},function(a){this.vo!==a&&(w.mb(a,iu,iu,"cycleRemoveOption"),a===pu||a===ju)&&(this.vo=a,this.J())});w.defineProperty(iu,{zI:"layeringOption"},function(){return this.Xo},function(a){this.Xo!==a&&(w.mb(a,iu,iu,"layeringOption"),a===ku||a===Hu||a===Ju)&&(this.Xo=a,this.J())});
w.defineProperty(iu,{mI:"initializeOption"},function(){return this.Mo},function(a){this.Mo!==a&&(w.mb(a,iu,iu,"initializeOption"),a===lu||a===Pu||a===Nu)&&(this.Mo=a,this.J())});w.defineProperty(iu,{$K:"iterations"},function(){return this.Fm},function(a){this.Fm!==a&&(w.Ed(a,ou,"iterations"),0<=a&&(this.Fm=a,this.J()))});w.defineProperty(iu,{cH:"aggressiveOption"},function(){return this.io},function(a){this.io!==a&&(w.mb(a,iu,iu,"aggressiveOption"),a===Tu||a===mu||a===Uu)&&(this.io=a,this.J())});
w.defineProperty(iu,{uL:"packOption"},function(){return this.Yi},function(a){this.Yi!==a&&(w.j(a,"number",iu,"packOption"),0<=a&&8>a&&(this.Yi=a,this.J()))});w.defineProperty(iu,{uq:"setsPortSpots"},function(){return this.Zh},function(a){this.Zh!==a&&(w.j(a,"boolean",iu,"setsPortSpots"),this.Zh=a,this.J())});w.defineProperty(iu,{sF:"linkSpacing"},function(){return this.Xr},function(a){this.Xr!==a&&(w.j(a,"number",iu,"linkSpacing"),0<=a&&(this.Xr=a,this.J()))});w.u(iu,{II:"maxLayer"},function(){return this.pb});
w.u(iu,{fL:"maxIndex"},function(){return this.Vv});w.u(iu,{eL:"maxColumn"},function(){return this.Jb});w.u(iu,{kL:"minIndexLayer"},function(){return this.fs});w.u(iu,{gL:"maxIndexLayer"},function(){return this.Kf});var ju;iu.CycleDepthFirst=ju=w.p(iu,"CycleDepthFirst",0);var pu;iu.CycleGreedy=pu=w.p(iu,"CycleGreedy",1);var ku;iu.LayerOptimalLinkLength=ku=w.p(iu,"LayerOptimalLinkLength",0);var Hu;iu.LayerLongestPathSink=Hu=w.p(iu,"LayerLongestPathSink",1);var Ju;
iu.LayerLongestPathSource=Ju=w.p(iu,"LayerLongestPathSource",2);var lu;iu.InitDepthFirstOut=lu=w.p(iu,"InitDepthFirstOut",0);var Pu;iu.InitDepthFirstIn=Pu=w.p(iu,"InitDepthFirstIn",1);var Nu;iu.InitNaive=Nu=w.p(iu,"InitNaive",2);var Tu;iu.AggressiveNone=Tu=w.p(iu,"AggressiveNone",0);var mu;iu.AggressiveLess=mu=w.p(iu,"AggressiveLess",1);var Uu;iu.AggressiveMore=Uu=w.p(iu,"AggressiveMore",2);iu.PackNone=0;var Vu;iu.PackExpand=Vu=1;var Wu;iu.PackStraighten=Wu=2;var Yu;iu.PackMedian=Yu=4;var nu;
iu.PackAll=nu=7;function ev(){this.index=this.pe=this.We=this.ee=this.first=this.layer=0;this.link=null;this.qi=0}w.$d(ev,{layer:!0,first:!0,ee:!0,We:!0,pe:!0,index:!0,link:!0,qi:!0});function ou(){qg.call(this)}w.La(ou,qg);w.fa("LayeredDigraphNetwork",ou);ou.prototype.createVertex=function(){return new gv};ou.prototype.createEdge=function(){return new hv};
function gv(){ks.call(this);this.index=this.column=this.layer=-1;this.component=NaN;this.near=null;this.valid=!1;this.finish=this.Rp=NaN;this.kn=0;this.KA=this.LA=null}w.La(gv,ks);w.fa("LayeredDigraphVertex",gv);function hv(){ls.call(this);this.forest=this.rev=this.valid=!1;this.portToPos=this.portFromPos=NaN;this.portToColOffset=this.portFromColOffset=0}w.La(hv,ls);w.fa("LayeredDigraphEdge",hv);
function Y(){0<arguments.length&&w.hd(Y);pg.call(this);this.qd=new J(Object);this.ys=iv;this.Hf=jv;this.pt=kv;this.Sv=lv;this.JB=null;this.Ih=!0;this.kd=mv;this.hg=(new ha(10,10)).freeze();this.ta=new nv;this.ua=new nv;this.Az=[]}w.La(Y,pg);w.fa("TreeLayout",Y);Y.prototype.cloneProtected=function(a){pg.prototype.cloneProtected.call(this,a);a.ys=this.ys;a.pt=this.pt;a.Sv=this.Sv;a.Ih=this.Ih;a.kd=this.kd;a.hg.assign(this.hg);a.ta.copyInheritedPropertiesFrom(this.ta);a.ua.copyInheritedPropertiesFrom(this.ua)};
Y.prototype.fc=function(a){a.De===Y?0===a.name.indexOf("Alignment")?this.alignment=a:0===a.name.indexOf("Arrangement")?this.Of=a:0===a.name.indexOf("Compaction")?this.compaction=a:0===a.name.indexOf("Path")?this.path=a:0===a.name.indexOf("Sorting")?this.sorting=a:0===a.name.indexOf("Style")?this.NJ=a:w.k("Unknown enum value: "+a):pg.prototype.fc.call(this,a)};Y.prototype.createNetwork=function(){return new ov};
Y.prototype.makeNetwork=function(a){function b(a){if(a instanceof T)return!a.lf&&"Comment"!==a.rd;if(a instanceof W){var b=a.W;if(null===b||b.lf||"Comment"===b.rd)return!1;a=a.$;return null===a||a.lf||"Comment"===a.rd?!1:!0}return!1}var c=this.createNetwork();c.Rb=this;a instanceof D?(c.rk(a.dg,!0,b),c.rk(a.links,!0,b)):a instanceof U?c.rk(a.Mc,!1,b):c.rk(a.i,!1,b);return c};
Y.prototype.doLayout=function(a){null===a&&w.k("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));this.Of!==pv&&(this.oe=this.initialOrigin(this.oe));var b=this.g;null===b&&a instanceof D&&(b=a);this.Hf=this.path===iv&&null!==b?b.Od?jv:qv:this.path===iv?jv:this.path;if(0<this.network.vertexes.count){this.network.Zw();for(a=this.network.vertexes.i;a.next();)b=a.value,b.initialized=!1,b.level=
0,b.parent=null,b.children=[];if(0<this.qd.count){a=new J(nv);for(b=this.qd.i;b.next();){var c=b.value;c instanceof T?(c=this.network.wn(c),null!==c&&a.add(c)):c instanceof nv&&a.add(c)}this.qd=a}0===this.qd.count&&this.findRoots();for(a=this.qd.copy().i;a.next();)b=a.value,b.initialized||(b.initialized=!0,rv(this,b));b=this.network.vertexes;for(a=null;a=sv(b),0<a.count;)b=tv(this,a),null!==b&&this.qd.add(b),b.initialized=!0,rv(this,b),b=a;for(a=this.qd.i;a.next();)b=a.value,b instanceof nv&&uv(this,
b);for(a=this.qd.i;a.next();)b=a.value,b instanceof nv&&vv(this,b);for(a=this.qd.i;a.next();)b=a.value,b instanceof nv&&wv(this,b);this.Nz();if(this.yA===xv){c=[];for(a=this.network.vertexes.i;a.next();){var d=a.value,b=d.parent;null===b&&(b=d);var b=0===b.angle||180===b.angle,e=c[d.level];void 0===e&&(e=0);c[d.level]=Math.max(e,b?d.width:d.height)}for(d=0;d<c.length;d++)void 0===c[d]&&(c[d]=0);this.JB=c;for(a=this.network.vertexes.i;a.next();)d=a.value,b=d.parent,null===b&&(b=d),0===b.angle||180===
b.angle?(180===b.angle&&(d.Qt+=c[d.level]-d.width),d.width=c[d.level]):(270===b.angle&&(d.Rt+=c[d.level]-d.height),d.height=c[d.level])}else if(this.yA===yv)for(a=this.network.vertexes.i;a.next();){c=a.value;b=0===c.angle||180===c.angle;e=-1;for(d=0;d<c.children.length;d++)var f=c.children[d],e=Math.max(e,b?f.width:f.height);if(0<=e)for(d=0;d<c.children.length;d++)f=c.children[d],b?(180===c.angle&&(f.Qt+=e-f.width),f.width=e):(270===c.angle&&(f.Rt+=e-f.height),f.height=e)}for(a=this.qd.i;a.next();)b=
a.value,b instanceof nv&&this.layoutTree(b);this.arrangeTrees();this.updateParts()}this.network=null;this.qd=new J(Object);this.yf=!0};function sv(a){var b=new J(nv);for(a=a.i;a.next();){var c=a.value;c.initialized||b.add(c)}return b}
Y.prototype.findRoots=function(){for(var a=this.network.vertexes,b=a.i;b.next();){var c=b.value;switch(this.Hf){case jv:0===c.kc.count&&this.qd.add(c);break;case qv:0===c.hc.count&&this.qd.add(c);break;default:w.k("Unhandled path value "+this.Hf.toString())}}0===this.qd.count&&(a=tv(this,a),null!==a&&this.qd.add(a))};
function tv(a,b){for(var c=999999,d=null,e=b.i;e.next();){var f=e.value;switch(a.Hf){case jv:f.kc.count<c&&(c=f.kc.count,d=f);break;case qv:f.hc.count<c&&(c=f.hc.count,d=f);break;default:w.k("Unhandled path value "+a.Hf.toString())}}return d}
function rv(a,b){if(null!==b){switch(a.Hf){case jv:if(0<b.hc.count){for(var c=new I(nv),d=b.GH;d.next();){var e=d.value;zv(a,b,e)&&c.add(e)}0<c.count&&(b.children=c.dc())}break;case qv:if(0<b.kc.count){c=new I(nv);for(d=b.BJ;d.next();)e=d.value,zv(a,b,e)&&c.add(e);0<c.count&&(b.children=c.dc())}break;default:w.k("Unhandled path value"+a.Hf.toString())}c=b.children;d=c.length;for(e=0;e<d;e++){var f=c[e];f.initialized=!0;f.level=b.level+1;f.parent=b;a.qd.remove(f)}for(e=0;e<d;e++)f=c[e],rv(a,f)}}
function zv(a,b,c){if(c.initialized){var d;if(null===b)d=!1;else{for(d=b.parent;null!==d&&d!==c;)d=d.parent;d=d===c}if(d||c.level>b.level)return!1;a.removeChild(c.parent,c)}return!0}Y.prototype.removeChild=function(a,b){if(null!==a&&null!==b){for(var c=a.children,d=0,e=0;e<c.length;e++)c[e]===b&&d++;if(0<d){for(var d=Array(c.length-d),f=0,e=0;e<c.length;e++)c[e]!==b&&(d[f++]=c[e]);a.children=d}}};
function uv(a,b){if(null!==b){a.initializeTreeVertexValues(b);b.alignment===Av&&a.sortTreeVertexChildren(b);for(var c=0,d=b.mn,e=0,f=b.children,h=f.length,k=0;k<h;k++){var l=f[k];uv(a,l);c+=l.descendantCount+1;d=Math.max(d,l.maxChildrenCount);e=Math.max(e,l.maxGenerationCount)}b.descendantCount=c;b.maxChildrenCount=d;b.maxGenerationCount=0<d?e+1:0}}
function Bv(a,b){switch(a.pt){default:case kv:return null!==b.parent?b.parent:a.ta;case Cv:return null===b.parent?a.ta:null===b.parent.parent?a.ua:b.parent;case Dv:return null!==b.parent?null!==b.parent.parent?b.parent.parent:a.ua:a.ta;case Ev:var c=!0;if(0===b.mn)c=!1;else for(var d=b.children,e=d.length,f=0;f<e;f++)if(0<d[f].mn){c=!1;break}return c&&null!==b.parent?a.ua:null!==b.parent?b.parent:a.ta}}
Y.prototype.initializeTreeVertexValues=function(a){var b=Bv(this,a);a.copyInheritedPropertiesFrom(b);if(null!==a.parent&&a.parent.alignment===Av){for(var b=a.angle,c=a.parent.children,d=0;d<c.length&&a!==c[d];)d++;0===d%2?d!==c.length-1&&(b=90===b?180:180===b?270:270===b?180:270):b=90===b?0:180===b?90:270===b?0:90;a.angle=b}a.initialized=!0};function vv(a,b){if(null!==b){a.assignTreeVertexValues(b);for(var c=b.children,d=c.length,e=0;e<d;e++)vv(a,c[e])}}Y.prototype.assignTreeVertexValues=function(){};
function wv(a,b){if(null!==b){b.alignment!==Av&&a.sortTreeVertexChildren(b);for(var c=b.children,d=c.length,e=0;e<d;e++)wv(a,c[e])}}Y.prototype.sortTreeVertexChildren=function(a){switch(a.sorting){case Fv:break;case Gv:a.children.reverse();break;case Hv:a.children.sort(a.comparer);break;case Iv:a.children.sort(a.comparer);a.children.reverse();break;default:w.k("Unhandled sorting value "+a.sorting.toString())}};Y.prototype.Nz=function(){if(this.comments)for(var a=this.network.vertexes.i;a.next();)this.addComments(a.value)};
Y.prototype.addComments=function(a){var b=a.angle,c=a.parent,d=0,e=Jv,e=!1;null!==c&&(d=c.angle,e=c.alignment,e=Kv(e));var b=90===b||270===b,d=90===d||270===d,c=0===a.mn,f=0,h=0,k=0,l=a.commentSpacing;if(null!==a.Nc)for(var m=a.Nc.GE();m.next();){var n=m.value;"Comment"===n.rd&&n.canLayout()&&(null===a.comments&&(a.comments=[]),a.comments.push(n),n.Ze(),n=n.za,b&&!c||!e&&!d&&c||e&&d&&c?(f=Math.max(f,n.width),h+=n.height+Math.abs(k)):(f+=n.width+Math.abs(k),h=Math.max(h,n.height)),k=l)}null!==a.comments&&
(b&&!c||!e&&!d&&c||e&&d&&c?(f+=Math.abs(a.commentMargin),h=Math.max(0,h-a.height)):(h+=Math.abs(a.commentMargin),f=Math.max(0,f-a.width)),e=w.Vg(0,0,a.M.width+f,a.M.height+h),a.jb=e,w.Gb(e))};function Kv(a){return a===Lv||a===Av||a===Mv||a===Nv}function Ov(a){return a===Lv||a===Av}function Pv(a){var b=a.parent;if(null!==b){var c=b.alignment;if(Kv(c)){if(Ov(c)){b=b.children;for(c=0;c<b.length&&a!==b[c];)c++;return 0===c%2}if(c===Mv)return!0}}return!1}
Y.prototype.layoutComments=function(a){if(null!==a.comments){var b=a.Nc.za,c=a.parent,d=a.angle,e=0,f=Jv,f=!1;null!==c&&(e=c.angle,f=c.alignment,f=Kv(f));for(var c=90===d||270===d,d=90===e||270===e,h=0===a.mn,k=Pv(a),l=0,m=a.comments,n=m.length,p=w.K(),q=0;q<n;q++){var r=m[q],s=r.za;if(c&&!h||!f&&!d&&h||f&&d&&h){if(135<e&&!f||d&&k)if(0<=a.commentMargin)for(p.l(a.M.x-a.commentMargin-s.width,a.M.y+l),r.move(p),r=r.Ig();r.next();){var u=r.value;u.Ab=Ec;u.Bb=Fc}else for(p.l(a.M.x+2*a.T.x-a.commentMargin,
a.M.y+l),r.move(p),r=r.Ig();r.next();)u=r.value,u.Ab=Fc,u.Bb=Ec;else if(0<=a.commentMargin)for(p.l(a.M.x+2*a.T.x+a.commentMargin,a.M.y+l),r.move(p),r=r.Ig();r.next();)u=r.value,u.Ab=Fc,u.Bb=Ec;else for(p.l(a.M.x+a.commentMargin-s.width,a.M.y+l),r.move(p),r=r.Ig();r.next();)u=r.value,u.Ab=Ec,u.Bb=Fc;l=0<=a.commentSpacing?l+(s.height+a.commentSpacing):l+(a.commentSpacing-s.height)}else{if(135<e&&!f||!d&&k)if(0<=a.commentMargin)for(p.l(a.M.x+l,a.M.y-a.commentMargin-s.height),r.move(p),r=r.Ig();r.next();)u=
r.value,u.Ab=Dc,u.Bb=Gc;else for(p.l(a.M.x+l,a.M.y+2*a.T.y-a.commentMargin),r.move(p),r=r.Ig();r.next();)u=r.value,u.Ab=Gc,u.Bb=Dc;else if(0<=a.commentMargin)for(p.l(a.M.x+l,a.M.y+2*a.T.y+a.commentMargin),r.move(p),r=r.Ig();r.next();)u=r.value,u.Ab=Gc,u.Bb=Dc;else for(p.l(a.M.x+l,a.M.y+a.commentMargin-s.height),r.move(p),r=r.Ig();r.next();)u=r.value,u.Ab=Dc,u.Bb=Gc;l=0<=a.commentSpacing?l+(s.width+a.commentSpacing):l+(a.commentSpacing-s.width)}}w.v(p);b=l-a.commentSpacing-(c?b.height:b.width);if(this.Hf===
jv)for(e=a.hc;e.next();)a=e.value.link,null===a||a.Dk||(a.Rl=0<b?b:NaN);else for(e=a.kc;e.next();)a=e.value.link,null===a||a.Dk||(a.jm=0<b?b:NaN)}};
Y.prototype.layoutTree=function(a){if(null!==a){for(var b=a.children,c=b.length,d=0;d<c;d++)this.layoutTree(b[d]);switch(a.compaction){case Qv:Rv(this,a);break;case Sv:if(a.alignment===Av)Rv(this,a);else if(0===a.mn){var d=a.parent,b=!1,c=0,e=Jv;null!==d&&(c=d.angle,e=d.alignment,b=Kv(e));d=Pv(a);a.pa.l(0,0);a.ib.l(a.width,a.height);null===a.parent||null===a.comments||(180!==c&&270!==c||b)&&!d?a.Oa.l(0,0):180===c&&!b||(90===c||270===c)&&d?a.Oa.l(a.width-2*a.T.x,0):a.Oa.l(0,a.height-2*a.T.y);a.gu=
null;a.Bu=null}else{for(var f=Tv(a),b=90===f||270===f,h=0,k=a.children,l=k.length,m=0;m<l;m++)var n=k[m],h=Math.max(h,b?n.ib.width:n.ib.height);var p=a.alignment,d=p===Uv,q=p===Vv,r=Kv(p),s=Math.max(0,a.breadthLimit),c=Wv(a),u=a.nodeSpacing,t=Xv(a),x=a.rowSpacing,v=0;if(d||q||a.oq||a.pq&&1===a.maxGenerationCount)v=Math.max(0,a.rowIndent);var d=a.width,e=a.height,B=0,y=0,H=0,E=null,V=null,ba=0,Q=0,$=0,ca=0,R=0,Ra=0,hb=0,qa=0,n=0;r&&!Ov(p)&&135<f&&k.reverse();if(Ov(p))if(1<l)for(m=0;m<l;m++)0===m%2&&
m!==l-1?qa=Math.max(qa,b?k[m].ib.width:k[m].ib.height):0!==m%2&&(n=Math.max(n,b?k[m].ib.width:k[m].ib.height));else 1===l&&(qa=b?k[0].ib.width:k[0].ib.height);if(r){switch(p){case Lv:y=135>f?Yv(a,k,qa,B,y):Zv(a,k,qa,B,y);qa=y.x;B=y.width;y=y.height;break;case Mv:for(m=0;m<l;m++){var n=k[m],Ja=n.ib,E=0===Ra?0:x;b?(n.pa.l(h-Ja.width,ca+E),B=Math.max(B,Ja.width),y=Math.max(y,ca+E+Ja.height),ca+=E+Ja.height):(n.pa.l($+E,h-Ja.height),B=Math.max(B,$+E+Ja.width),y=Math.max(y,Ja.height),$+=E+Ja.width);Ra++}break;
case Nv:for(m=0;m<l;m++)n=k[m],Ja=n.ib,E=0===Ra?0:x,b?(n.pa.l(u/2+a.T.x,ca+E),B=Math.max(B,Ja.width),y=Math.max(y,ca+E+Ja.height),ca+=E+Ja.height):(n.pa.l($+E,u/2+a.T.y),B=Math.max(B,$+E+Ja.width),y=Math.max(y,Ja.height),$+=E+Ja.width),Ra++}E=$v(this,2);V=$v(this,2);b?(E[0].l(0,0),E[1].l(0,y),V[0].l(B,0)):(E[0].l(0,0),E[1].l(B,0),V[0].l(0,y));V[1].l(B,y)}else for(m=0;m<l;m++){n=k[m];Ja=n.ib;if(b){0<s&&0<Ra&&$+u+Ja.width>s&&($<h&&Fw(a,p,h-$,0,hb,m-1),R++,Ra=0,hb=m,H=y,$=0,ca=135<f?-y-x:y+x);Gw(this,
n,0,ca);var za=0;if(0===Ra){if(E=n.gu,V=n.Bu,ba=Ja.width,Q=Ja.height,null===E||null===V||f!==Tv(n))E=$v(this,2),V=$v(this,2),E[0].l(0,0),E[1].l(0,Q),V[0].l(ba,0),V[1].l(ba,Q)}else{var Pb=w.lb(),Q=Hw(this,a,n,E,V,ba,Q,Pb),za=Q.x,E=Pb[0],V=Pb[1],ba=Q.width,Q=Q.height;w.va(Pb);$<Ja.width&&0>za&&(Iw(a,-za,0,hb,m-1),Jw(E,-za,0),Jw(V,-za,0),za=0)}n.pa.l(za,ca);B=Math.max(B,ba);y=Math.max(y,H+(0===R?0:x)+Ja.height);$=ba}else{0<s&&0<Ra&&ca+u+Ja.height>s&&(ca<h&&Fw(a,p,0,h-ca,hb,m-1),R++,Ra=0,hb=m,H=B,ca=
0,$=135<f?-B-x:B+x);Gw(this,n,$,0);za=0;if(0===Ra){if(E=n.gu,V=n.Bu,ba=Ja.width,Q=Ja.height,null===E||null===V||f!==Tv(n))E=$v(this,2),V=$v(this,2),E[0].l(0,0),E[1].l(ba,0),V[0].l(0,Q),V[1].l(ba,Q)}else Pb=w.lb(),Q=Hw(this,a,n,E,V,ba,Q,Pb),za=Q.x,E=Pb[0],V=Pb[1],ba=Q.width,Q=Q.height,w.va(Pb),ca<Ja.height&&0>za&&(Iw(a,0,-za,hb,m-1),Jw(E,0,-za),Jw(V,0,-za),za=0);n.pa.l($,za);y=Math.max(y,Q);B=Math.max(B,H+(0===R?0:x)+Ja.width);ca=Q}Ra++}0<R&&(b?(y+=Math.max(0,c),$<B&&Fw(a,p,B-$,0,hb,l-1),0<v&&(q||
Iw(a,v,0,0,l-1),B+=v)):(B+=Math.max(0,c),ca<y&&Fw(a,p,0,y-ca,hb,l-1),0<v&&(q||Iw(a,0,v,0,l-1),y+=v)));v=q=0;switch(p){case Kw:b?q+=B/2-a.T.x-t/2:v+=y/2-a.T.y-t/2;break;case Jv:0<R?b?q+=B/2-a.T.x-t/2:v+=y/2-a.T.y-t/2:b?(qa=k[0].pa.x+k[0].Oa.x,m=k[l-1].pa.x+k[l-1].Oa.x+2*k[l-1].T.x,q+=qa+(m-qa)/2-a.T.x-t/2):(qa=k[0].pa.y+k[0].Oa.y,m=k[l-1].pa.y+k[l-1].Oa.y+2*k[l-1].T.y,v+=qa+(m-qa)/2-a.T.y-t/2);break;case Uv:b?(q-=t,B+=t):(v-=t,y+=t);break;case Vv:b?(q+=B-a.width+t,B+=t):(v+=y-a.height+t,y+=t);break;
case Lv:b?q=1<l?q+(qa+u/2-a.T.x):q+(k[0].T.x-a.T.x+k[0].Oa.x):v=1<l?v+(qa+u/2-a.T.y):v+(k[0].T.y-a.T.y+k[0].Oa.y);break;case Mv:b?q+=B+u/2-a.T.x:v+=y+u/2-a.T.y;break;case Nv:break;default:w.k("Unhandled alignment value "+p.toString())}for(m=0;m<l;m++)n=k[m],b?n.pa.l(n.pa.x+n.Oa.x-q,n.pa.y+(135<f?(r?-y:-n.ib.height)+n.Oa.y-c:e+c+n.Oa.y)):n.pa.l(n.pa.x+(135<f?(r?-B:-n.ib.width)+n.Oa.x-c:d+c+n.Oa.x),n.pa.y+n.Oa.y-v);l=k=0;r?b?(B=Lw(a,B,q),0>q&&(q=0),135<f&&(v+=y+c),y+=e+c,p===Nv&&(k+=u/2+a.T.x),l+=e+
c):(135<f&&(q+=B+c),B+=d+c,y=Mw(a,y,v),0>v&&(v=0),p===Nv&&(l+=u/2+a.T.y),k+=d+c):b?(null===a.comments?d>B&&(p=Nw(p,d-B,0),k=p.x,l=p.y,B=d,q=0):B=Lw(a,B,q),0>q&&(k-=q,q=0),135<f&&(v+=y+c),y=Math.max(Math.max(y,e),y+e+c),l+=e+c):(135<f&&(q+=B+c),B=Math.max(Math.max(B,d),B+d+c),null===a.comments?e>y&&(p=Nw(p,0,e-y),k=p.x,l=p.y,y=e,v=0):y=Mw(a,y,v),0>v&&(l-=v,v=0),k+=d+c);if(0<R)f=$v(this,4),p=$v(this,4),b?(f[2].l(0,e+c),f[3].l(f[2].x,y),p[2].l(B,f[2].y),p[3].l(p[2].x,f[3].y)):(f[2].l(d+c,0),f[3].l(B,
f[2].y),p[2].l(f[2].x,y),p[3].l(f[3].x,p[2].y));else{f=$v(this,E.length+2);p=$v(this,V.length+2);for(m=0;m<E.length;m++)r=E[m],f[m+2].l(r.x+k,r.y+l);for(m=0;m<V.length;m++)r=V[m],p[m+2].l(r.x+k,r.y+l)}b?(f[0].l(q,0),f[1].l(f[0].x,e),f[2].y<f[1].y&&(f[2].x>f[0].x?f[2].assign(f[1]):f[1].assign(f[2])),f[3].y<f[2].y&&(f[3].x>f[0].x?f[3].assign(f[2]):f[2].assign(f[3])),p[0].l(q+d,0),p[1].l(p[0].x,e),p[2].y<p[1].y&&(p[2].x<p[0].x?p[2].assign(p[1]):p[1].assign(p[2])),p[3].y<p[2].y&&(p[3].x<p[0].x?p[3].assign(p[2]):
p[2].assign(p[3])),f[2].y-=c/2,p[2].y-=c/2):(f[0].l(0,v),f[1].l(d,f[0].y),f[2].x<f[1].x&&(f[2].y>f[0].y?f[2].assign(f[1]):f[1].assign(f[2])),f[3].x<f[2].x&&(f[3].y>f[0].y?f[3].assign(f[2]):f[2].assign(f[3])),p[0].l(0,v+e),p[1].l(d,p[0].y),p[2].x<p[1].x&&(p[2].y<p[0].y?p[2].assign(p[1]):p[1].assign(p[2])),p[3].x<p[2].x&&(p[3].y<p[0].y?p[3].assign(p[2]):p[2].assign(p[3])),f[2].x-=c/2,p[2].x-=c/2);Ow(this,E);Ow(this,V);a.gu=f;a.Bu=p;a.Oa.l(q,v);a.ib.l(B,y)}break;default:w.k("Unhandled compaction value "+
a.compaction.toString())}}};
function Rv(a,b){if(0===b.mn){var c=!1,d=0,e=Jv;null!==b.parent&&(d=b.parent.angle,e=b.parent.alignment,c=Kv(e));e=Pv(b);b.pa.l(0,0);b.ib.l(b.width,b.height);null===b.parent||null===b.comments||(180!==d&&270!==d||c)&&!e?b.Oa.l(0,0):180===d&&!c||(90===d||270===d)&&e?b.Oa.l(b.width-2*b.T.x,0):b.Oa.l(0,b.height-2*b.T.y)}else{for(var c=Tv(b),d=90===c||270===c,f=0,e=b.children,h=e.length,k=0;k<h;k++)var l=e[k],f=Math.max(f,d?l.ib.width:l.ib.height);var m=b.alignment,n=m===Uv,p=m===Vv,q=Kv(m),r=Math.max(0,
b.breadthLimit),s=Wv(b),u=b.nodeSpacing,t=Xv(b),x=n||p?0:t/2,v=b.rowSpacing,B=0;if(n||p||b.oq||b.pq&&1===b.maxGenerationCount)B=Math.max(0,b.rowIndent);var n=b.width,y=b.height,H=0,E=0,V=0,ba=0,Q=0,$=0,ca=0,R=0,Ra=0,hb=0;q&&!Ov(m)&&135<c&&e.reverse();if(Ov(m))if(1<h)for(k=0;k<h;k++){var l=e[k],qa=l.ib;0===k%2&&k!==h-1?Ra=Math.max(Ra,(d?qa.width:qa.height)+Pw(l)-u):0!==k%2&&(hb=Math.max(hb,(d?qa.width:qa.height)+Pw(l)-u))}else 1===h&&(Ra=d?e[0].ib.width:e[0].ib.height);if(q)switch(m){case Lv:case Av:E=
135>c?Yv(b,e,Ra,H,E):Zv(b,e,Ra,H,E);Ra=E.x;H=E.width;E=E.height;break;case Mv:for(k=0;k<h;k++)l=e[k],qa=l.ib,r=0===ca?0:v,d?(l.pa.l(f-qa.width,Q+r),H=Math.max(H,qa.width),E=Math.max(E,Q+r+qa.height),Q+=r+qa.height):(l.pa.l(ba+r,f-qa.height),H=Math.max(H,ba+r+qa.width),E=Math.max(E,qa.height),ba+=r+qa.width),ca++;break;case Nv:for(f=0;f<h;f++)l=e[f],qa=l.ib,r=0===ca?0:v,d?(l.pa.l(u/2+b.T.x,Q+r),H=Math.max(H,qa.width),E=Math.max(E,Q+r+qa.height),Q+=r+qa.height):(l.pa.l(ba+r,u/2+b.T.y),H=Math.max(H,
ba+r+qa.width),E=Math.max(E,qa.height),ba+=r+qa.width),ca++}else for(k=0;k<h;k++)l=e[k],qa=l.ib,d?(0<r&&0<ca&&ba+u+qa.width>r&&(ba<f&&Fw(b,m,f-ba,0,R,k-1),$++,ca=0,R=k,V=E,ba=0,Q=135<c?-E-v:E+v),hb=0===ca?x:u,Gw(a,l,0,Q),l.pa.l(ba+hb,Q),H=Math.max(H,ba+hb+qa.width),E=Math.max(E,V+(0===$?0:v)+qa.height),ba+=hb+qa.width):(0<r&&0<ca&&Q+u+qa.height>r&&(Q<f&&Fw(b,m,0,f-Q,R,k-1),$++,ca=0,R=k,V=H,Q=0,ba=135<c?-H-v:H+v),hb=0===ca?x:u,Gw(a,l,ba,0),l.pa.l(ba,Q+hb),E=Math.max(E,Q+hb+qa.height),H=Math.max(H,
V+(0===$?0:v)+qa.width),Q+=hb+qa.height),ca++;0<$&&(d?(E+=Math.max(0,s),ba<H&&Fw(b,m,H-ba,0,R,h-1),0<B&&(p||Iw(b,B,0,0,h-1),H+=B)):(H+=Math.max(0,s),Q<E&&Fw(b,m,0,E-Q,R,h-1),0<B&&(p||Iw(b,0,B,0,h-1),E+=B)));B=p=0;switch(m){case Kw:d?p+=H/2-b.T.x-t/2:B+=E/2-b.T.y-t/2;break;case Jv:0<$?d?p+=H/2-b.T.x-t/2:B+=E/2-b.T.y-t/2:d?(m=e[0].pa.x+e[0].Oa.x,u=e[h-1].pa.x+e[h-1].Oa.x+2*e[h-1].T.x,p+=m+(u-m)/2-b.T.x-t/2):(m=e[0].pa.y+e[0].Oa.y,u=e[h-1].pa.y+e[h-1].Oa.y+2*e[h-1].T.y,B+=m+(u-m)/2-b.T.y-t/2);break;
case Uv:d?(p-=t,H+=t):(B-=t,E+=t);break;case Vv:d?(p+=H-b.width+t,H+=t):(B+=E-b.height+t,E+=t);break;case Lv:case Av:d?p=1<h?p+(Ra+u/2-b.T.x):p+(e[0].T.x-b.T.x+e[0].Oa.x):B=1<h?B+(Ra+u/2-b.T.y):B+(e[0].T.y-b.T.y+e[0].Oa.y);break;case Mv:d?p+=H+u/2-b.T.x:B+=E+u/2-b.T.y;break;case Nv:break;default:w.k("Unhandled alignment value "+m.toString())}for(k=0;k<h;k++)l=e[k],d?l.pa.l(l.pa.x+l.Oa.x-p,l.pa.y+(135<c?(q?-E:-l.ib.height)+l.Oa.y-s:y+s+l.Oa.y)):l.pa.l(l.pa.x+(135<c?(q?-H:-l.ib.width)+l.Oa.x-s:n+s+
l.Oa.x),l.pa.y+l.Oa.y-B);d?(H=Lw(b,H,p),0>p&&(p=0),135<c&&(B+=E+s),E+=y+s):(135<c&&(p+=H+s),H+=n+s,E=Mw(b,E,B),0>B&&(B=0));b.Oa.l(p,B);b.ib.l(H,E)}}
function Yv(a,b,c,d,e){var f=b.length;if(0===f)return new A(c,0,d,e);if(1===f){var h=b[0];d=h.ib.width;e=h.ib.height;return new A(c,0,d,e)}for(var k=a.nodeSpacing,l=a.rowSpacing,m=90===Tv(a),n=0,p=0,q=0,r=0;r<f;r++)if(!(0!==r%2||1<f&&r===f-1)){var h=b[r],s=h.ib,u=0===n?0:l;if(m){var t=Pw(h)-k;h.pa.l(c-(s.width+t),q+u);d=Math.max(d,s.width+t);e=Math.max(e,q+u+s.height);q+=u+s.height}else t=Pw(h)-k,h.pa.l(p+u,c-(s.height+t)),e=Math.max(e,s.height+t),d=Math.max(d,p+u+s.width),p+=u+s.width;n++}var n=
0,x=p,v=q;m?(p=c+k,q=0):(p=0,q=c+k);for(r=0;r<f;r++)0!==r%2&&(h=b[r],s=h.ib,u=0===n?0:l,m?(t=Pw(h)-k,h.pa.l(p+t,q+u),d=Math.max(d,p+s.width+t),e=Math.max(e,q+u+s.height),q+=u+s.height):(t=Pw(h)-k,h.pa.l(p+u,q+t),d=Math.max(d,p+u+s.width),e=Math.max(e,q+s.height+t),p+=u+s.width),n++);1<f&&1===f%2&&(h=b[f-1],s=h.ib,b=Qw(h,m?Math.max(Math.abs(v),Math.abs(q)):Math.max(Math.abs(x),Math.abs(p))),m?(h.pa.l(c+k/2-h.T.x-h.Oa.x,e+b),m=c+k/2-h.T.x-h.Oa.x,d=Math.max(d,m+s.width),0>m&&(d-=m),e=Math.max(e,Math.max(v,
q)+b+s.height),0>h.pa.x&&(c=Rw(a,h.pa.x,!1,c,k))):(h.pa.l(d+b,c+k/2-h.T.y-h.Oa.y),d=Math.max(d,Math.max(x,p)+b+s.width),m=c+k/2-h.T.y-h.Oa.y,e=Math.max(e,m+s.height),0>m&&(e-=m),0>h.pa.y&&(c=Rw(a,h.pa.y,!0,c,k))));return new A(c,0,d,e)}
function Zv(a,b,c,d,e){var f=b.length;if(0===f)return new A(c,0,d,e);if(1===f){var h=b[0];d=h.ib.width;e=h.ib.height;return new A(c,0,d,e)}for(var k=a.nodeSpacing,l=a.rowSpacing,m=270===Tv(a),n=0,p=0,q=0,r=0;r<f;r++)if(!(0!==r%2||1<f&&r===f-1)){var h=b[r],s=h.ib,u=0===n?0:l;if(m){var t=Pw(h)-k,q=q-(u+s.height);h.pa.l(c-(s.width+t),q);d=Math.max(d,s.width+t);e=Math.max(e,Math.abs(q))}else t=Pw(h)-k,p-=u+s.width,h.pa.l(p,c-(s.height+t)),e=Math.max(e,s.height+t),d=Math.max(d,Math.abs(p));n++}var n=0,
x=p,v=q;m?(p=c+k,q=0):(p=0,q=c+k);for(r=0;r<f;r++)0!==r%2&&(h=b[r],s=h.ib,u=0===n?0:l,m?(t=Pw(h)-k,q-=u+s.height,h.pa.l(p+t,q),d=Math.max(d,p+s.width+t),e=Math.max(e,Math.abs(q))):(t=Pw(h)-k,p-=u+s.width,h.pa.l(p,q+t),e=Math.max(e,q+s.height+t),d=Math.max(d,Math.abs(p))),n++);1<f&&1===f%2&&(h=b[f-1],s=h.ib,l=Qw(h,m?Math.max(Math.abs(v),Math.abs(q)):Math.max(Math.abs(x),Math.abs(p))),m?(h.pa.l(c+k/2-h.T.x-h.Oa.x,-e-s.height-l),p=c+k/2-h.T.x-h.Oa.x,d=Math.max(d,p+s.width),0>p&&(d-=p),e=Math.max(e,Math.abs(Math.min(v,
q))+l+s.height),0>h.pa.x&&(c=Rw(a,h.pa.x,!1,c,k))):(h.pa.l(-d-s.width-l,c+k/2-h.T.y-h.Oa.y),d=Math.max(d,Math.abs(Math.min(x,p))+l+s.width),p=c+k/2-h.T.y-h.Oa.y,e=Math.max(e,p+s.height),0>p&&(e-=p),0>h.pa.y&&(c=Rw(a,h.pa.y,!0,c,k))));for(r=0;r<f;r++)h=b[r],m?h.pa.l(h.pa.x,h.pa.y+e):h.pa.l(h.pa.x+d,h.pa.y);return new A(c,0,d,e)}function Pw(a){return null===a.parent?0:a.parent.nodeSpacing}function Qw(a){return null===a.parent?0:a.parent.rowSpacing}
function Rw(a,b,c,d,e){a=a.children;for(var f=a.length,h=0;h<f;h++)c?a[h].pa.l(a[h].pa.x,a[h].pa.y-b):a[h].pa.l(a[h].pa.x-b,a[h].pa.y);b=a[f-1];return Math.max(d,c?b.Oa.y+b.T.y-e/2:b.Oa.x+b.T.x-e/2)}
function Lw(a,b,c){switch(a.alignment){case Jv:case Kw:var d=b;c+a.width>d&&(d=c+a.width);0>c&&(d-=c);return d;case Uv:return a.width>b?a.width:b;case Vv:return 2*a.T.x>b?a.width:b+a.width-2*a.T.x;case Lv:case Av:return d=Math.min(0,c),c=Math.max(b,c+a.width),Math.max(a.width,c-d);case Mv:return a.width-a.T.x+a.nodeSpacing/2+b;case Nv:return Math.max(a.width,a.T.x+a.nodeSpacing/2+b);default:return b}}
function Mw(a,b,c){switch(a.alignment){case Jv:case Kw:var d=b;c+a.height>d&&(d=c+a.height);0>c&&(d-=c);return d;case Uv:return a.height>b?a.height:b;case Vv:return 2*a.T.y>b?a.height:b+a.height-2*a.T.y;case Lv:case Av:return d=Math.min(0,c),c=Math.max(b,c+a.height),Math.max(a.height,c-d);case Mv:return a.height-a.T.y+a.nodeSpacing/2+b;case Nv:return Math.max(a.height,a.T.y+a.nodeSpacing/2+b);default:return b}}
function Nw(a,b,c){switch(a){case Kw:b/=2;c/=2;break;case Jv:b/=2;c/=2;break;case Uv:c=b=0;break;case Vv:break;default:w.k("Unhandled alignment value "+a.toString())}return new z(b,c)}function Fw(a,b,c,d,e,f){b=Nw(b,c,d);Iw(a,b.x,b.y,e,f)}function Iw(a,b,c,d,e){if(0!==b||0!==c)for(a=a.children;d<=e;d++){var f=a[d].pa;f.x+=b;f.y+=c}}
function Gw(a,b,c,d){var e=b.parent;switch(a.Hf){case jv:for(a=b.kc;a.next();)b=a.value,b.fromVertex===e&&b.Fs.l(c,d);break;case qv:for(a=b.hc;a.next();)b=a.value,b.toVertex===e&&b.Fs.l(c,d);break;default:w.k("Unhandled path value "+a.Hf.toString())}}function Jw(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];e.x+=b;e.y+=c}}
function Hw(a,b,c,d,e,f,h,k){var l=Tv(b),m=90===l||270===l,n=b.nodeSpacing;b=d;var p=e;d=f;e=h;var q=c.gu,r=c.Bu;h=c.ib;var s=m?Math.max(e,h.height):Math.max(d,h.width);if(null===q||l!==Tv(c))q=$v(a,2),r=$v(a,2),m?(q[0].l(0,0),q[1].l(0,h.height),r[0].l(h.width,0),r[1].l(r[0].x,q[1].y)):(q[0].l(0,0),q[1].l(h.width,0),r[0].l(0,h.height),r[1].l(q[1].x,r[0].y));if(m){c=d;d=9999999;if(!(null===p||2>p.length||null===q||2>q.length))for(m=l=0;l<p.length&&m<q.length;){e=p[l];var u=q[m];f=u.x;var t=u.y;f+=
c;var x=e;l+1<p.length&&(x=p[l+1]);var v=u,u=v.x,v=v.y;m+1<q.length&&(v=q[m+1],u=v.x,v=v.y,u+=c);var B=d;e.y===t?B=f-e.x:e.y>t&&e.y<v?B=f+(e.y-t)/(v-t)*(u-f)-e.x:t>e.y&&t<x.y&&(B=f-(e.x+(t-e.y)/(x.y-e.y)*(x.x-e.x)));B<d&&(d=B);x.y<=e.y?l++:v<=t?m++:(x.y<=v&&l++,v<=x.y&&m++)}c-=d;c+=n;l=q;m=c;if(null===b||2>b.length||null===l||2>l.length)d=null;else{n=$v(a,b.length+l.length);for(d=f=e=0;f<l.length&&l[f].y<b[0].y;)t=l[f++],n[d++].l(t.x+m,t.y);for(;e<b.length;)t=b[e++],n[d++].l(t.x,t.y);for(e=b[b.length-
1].y;f<l.length&&l[f].y<=e;)f++;for(;f<l.length&&l[f].y>e;)t=l[f++],n[d++].l(t.x+m,t.y);l=$v(a,d);for(e=0;e<d;e++)l[e].assign(n[e]);Ow(a,n);d=l}f=r;t=c;if(null===p||2>p.length||null===f||2>f.length)e=null;else{n=$v(a,p.length+f.length);for(m=x=l=0;l<p.length&&p[l].y<f[0].y;)e=p[l++],n[m++].l(e.x,e.y);for(;x<f.length;)e=f[x++],n[m++].l(e.x+t,e.y);for(f=f[f.length-1].y;l<p.length&&p[l].y<=f;)l++;for(;l<p.length&&p[l].y>f;)e=p[l++],n[m++].l(e.x,e.y);e=$v(a,m);for(l=0;l<m;l++)e[l].assign(n[l]);Ow(a,n)}f=
Math.max(0,c)+h.width;h=s}else{c=e;d=9999999;if(!(null===p||2>p.length||null===q||2>q.length))for(m=l=0;l<p.length&&m<q.length;)e=p[l],u=q[m],f=u.x,t=u.y,t+=c,x=e,l+1<p.length&&(x=p[l+1]),v=u,u=v.x,v=v.y,m+1<q.length&&(v=q[m+1],u=v.x,v=v.y,v+=c),B=d,e.x===f?B=t-e.y:e.x>f&&e.x<u?B=t+(e.x-f)/(u-f)*(v-t)-e.y:f>e.x&&f<x.x&&(B=t-(e.y+(f-e.x)/(x.x-e.x)*(x.y-e.y))),B<d&&(d=B),x.x<=e.x?l++:u<=f?m++:(x.x<=u&&l++,u<=x.x&&m++);c-=d;c+=n;l=q;m=c;if(null===b||2>b.length||null===l||2>l.length)d=null;else{n=$v(a,
b.length+l.length);for(d=f=e=0;f<l.length&&l[f].x<b[0].x;)t=l[f++],n[d++].l(t.x,t.y+m);for(;e<b.length;)t=b[e++],n[d++].l(t.x,t.y);for(e=b[b.length-1].x;f<l.length&&l[f].x<=e;)f++;for(;f<l.length&&l[f].x>e;)t=l[f++],n[d++].l(t.x,t.y+m);l=$v(a,d);for(e=0;e<d;e++)l[e].assign(n[e]);Ow(a,n);d=l}f=r;t=c;if(null===p||2>p.length||null===f||2>f.length)e=null;else{n=$v(a,p.length+f.length);for(m=x=l=0;l<p.length&&p[l].x<f[0].x;)e=p[l++],n[m++].l(e.x,e.y);for(;x<f.length;)e=f[x++],n[m++].l(e.x,e.y+t);for(f=
f[f.length-1].x;l<p.length&&p[l].x<=f;)l++;for(;l<p.length&&p[l].x>f;)e=p[l++],n[m++].l(e.x,e.y);e=$v(a,m);for(l=0;l<m;l++)e[l].assign(n[l]);Ow(a,n)}f=s;h=Math.max(0,c)+h.height}Ow(a,b);Ow(a,q);Ow(a,p);Ow(a,r);k[0]=d;k[1]=e;return new A(c,0,f,h)}function $v(a,b){var c=a.Az[b];if(void 0!==c&&(c=c.pop(),void 0!==c))return c;for(var c=[],d=0;d<b;d++)c[d]=new z;return c}function Ow(a,b){var c=b.length,d=a.Az[c];void 0===d&&(d=[],a.Az[c]=d);d.push(b)}
Y.prototype.arrangeTrees=function(){if(this.kd===pv)for(var a=this.qd.i;a.next();){var b=a.value;if(b instanceof nv){var c=b.Nc;if(null!==c){var d=c.position,c=d.x,d=d.y;isFinite(c)||(c=0);isFinite(d)||(d=0);Sw(this,b,c,d)}}}else{c=[];for(a=this.qd.i;a.next();)b=a.value,b instanceof nv&&c.push(b);switch(this.sorting){case Fv:break;case Gv:c.reverse();break;case Hv:c.sort(this.comparer);break;case Iv:c.sort(this.comparer);c.reverse();break;default:w.k("Unhandled sorting value "+this.sorting.toString())}b=
this.oe;a=b.x;b=b.y;for(d=0;d<c.length;d++){var e=c[d];Sw(this,e,a+e.Oa.x,b+e.Oa.y);switch(this.kd){case mv:b+=e.ib.height+this.hg.height;break;case Tw:a+=e.ib.width+this.hg.width;break;default:w.k("Unhandled arrangement value "+this.kd.toString())}}}};function Sw(a,b,c,d){if(null!==b){b.x=c;b.y=d;b=b.children;for(var e=b.length,f=0;f<e;f++){var h=b[f];Sw(a,h,c+h.pa.x,d+h.pa.y)}}}Y.prototype.commitLayout=function(){this.cB();this.commitNodes();this.Sz();this.eu&&this.commitLinks()};
Y.prototype.commitNodes=function(){for(var a=this.network.vertexes.i;a.next();)a.value.commit();for(a.reset();a.next();)this.layoutComments(a.value)};
Y.prototype.Sz=function(){if(this.yA===xv){for(var a=this.JB,b=[],c=null,d=this.network.vertexes.i;d.next();){var e=d.value;null===c?c=e.jb.copy():c.Gh(e.jb);var f=b[e.level],f=void 0===f?Wv(e):Math.max(f,Wv(e));b[e.level]=f}for(d=0;d<b.length;d++)void 0===b[d]&&(b[d]=0);90===this.angle||270===this.angle?(c.Sf(this.nodeSpacing/2,this.layerSpacing),e=new z(-this.nodeSpacing/2,-this.layerSpacing/2)):(c.Sf(this.layerSpacing,this.nodeSpacing/2),e=new z(-this.layerSpacing/2,-this.nodeSpacing/2));var f=
[],c=90===this.angle||270===this.angle?c.width:c.height,h=0;if(180===this.angle||270===this.angle)for(d=0;d<a.length;d++)h+=a[d]+b[d];for(d=0;d<a.length;d++){var k=a[d]+b[d];270===this.angle?(h-=k,f.push(new A(0,h,c,k))):90===this.angle?(f.push(new A(0,h,c,k)),h+=k):180===this.angle?(h-=k,f.push(new A(h,0,k,c))):(f.push(new A(h,0,k,c)),h+=k)}this.commitLayers(f,e)}};Y.prototype.commitLayers=function(){};Y.prototype.commitLinks=function(){for(var a=this.network.edges.i;a.next();)a.value.commit()};
Y.prototype.cB=function(){for(var a=this.qd.i;a.next();){var b=a.value;b instanceof nv&&Uw(this,b)}};function Uw(a,b){if(null!==b){a.setPortSpots(b);for(var c=b.children,d=c.length,e=0;e<d;e++)Uw(a,c[e])}}
Y.prototype.setPortSpots=function(a){var b=a.alignment;if(Kv(b)){var c=this.Hf===jv,d=Tv(a),e;switch(d){case 0:e=Fc;break;case 90:e=Gc;break;case 180:e=Ec;break;default:e=Dc}var f=a.children,h=f.length;switch(b){case Lv:case Av:for(b=0;b<h;b++){var k=f[b],k=(c?k.kc:k.hc).first();if(null!==k&&(k=k.link,null!==k)){var l=90===d||270===d?Ec:Dc;if(1===h||b===h-1&&1===h%2)switch(d){case 0:l=Ec;break;case 90:l=Dc;break;case 180:l=Fc;break;default:l=Gc}else 0===b%2&&(l=90===d||270===d?Fc:Gc);c?(a.setsPortSpot&&
(k.Ab=e),a.setsChildPortSpot&&(k.Bb=l)):(a.setsPortSpot&&(k.Ab=l),a.setsChildPortSpot&&(k.Bb=e))}}break;case Mv:l=90===d||270===d?Fc:Gc;for(d=c?a.hc:a.kc;d.next();)k=d.value.link,null!==k&&(c?(a.setsPortSpot&&(k.Ab=e),a.setsChildPortSpot&&(k.Bb=l)):(a.setsPortSpot&&(k.Ab=l),a.setsChildPortSpot&&(k.Bb=e)));break;case Nv:for(l=90===d||270===d?Ec:Dc,d=c?a.hc:a.kc;d.next();)k=d.value.link,null!==k&&(c?(a.setsPortSpot&&(k.Ab=e),a.setsChildPortSpot&&(k.Bb=l)):(a.setsPortSpot&&(k.Ab=l),a.setsChildPortSpot&&
(k.Bb=e)))}}else if(c=Tv(a),this.Hf===jv)for(e=a.hc;e.next();){if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Uc())switch(c){case 0:d.Ab=Fc;break;case 90:d.Ab=Gc;break;case 180:d.Ab=Ec;break;default:d.Ab=Dc}else d.Ab=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Uc())switch(c){case 0:d.Bb=Ec;break;case 90:d.Bb=Dc;break;case 180:d.Bb=Fc;break;default:d.Bb=Gc}else d.Bb=a.childPortSpot}}else for(e=a.kc;e.next();)if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Uc())switch(c){case 0:d.Bb=
Fc;break;case 90:d.Bb=Gc;break;case 180:d.Bb=Ec;break;default:d.Bb=Dc}else d.Bb=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Uc())switch(c){case 0:d.Ab=Ec;break;case 90:d.Ab=Dc;break;case 180:d.Ab=Fc;break;default:d.Ab=Gc}else d.Ab=a.childPortSpot}};function Tv(a){a=a.angle;return 45>=a?0:135>=a?90:225>=a?180:315>=a?270:0}
function Wv(a){var b=Tv(a),b=90===b||270===b,c=a.layerSpacing;if(0<a.layerSpacingParentOverlap)var d=Math.min(1,a.layerSpacingParentOverlap),c=c-(b?a.height*d:a.width*d);c<(b?-a.height:-a.width)&&(c=b?-a.height:-a.width);return c}function Xv(a){var b=Tv(a),b=90===b||270===b,c=a.nodeIndent;if(0<a.nodeIndentPastParent)var d=Math.min(1,a.nodeIndentPastParent),c=c+(b?a.width*d:a.height*d);return c=Math.max(0,c)}
w.defineProperty(Y,{BL:"roots"},function(){return this.qd},function(a){this.qd!==a&&(w.G(a,J,Y,"roots"),this.qd=a,this.J())});w.defineProperty(Y,{path:"path"},function(){return this.ys},function(a){this.ys!==a&&(w.mb(a,Y,Y,"path"),this.ys=a,this.J())});w.defineProperty(Y,{NJ:"treeStyle"},function(){return this.pt},function(a){this.kd!==a&&(w.mb(a,Y,Y,"treeStyle"),a===kv||a===Dv||a===Ev||a===Cv)&&(this.pt=a,this.J())});
w.defineProperty(Y,{yA:"layerStyle"},function(){return this.Sv},function(a){this.kd!==a&&(w.mb(a,Y,Y,"layerStyle"),a===lv||a===yv||a===xv)&&(this.Sv=a,this.J())});w.defineProperty(Y,{comments:"comments"},function(){return this.Ih},function(a){this.Ih!==a&&(w.j(a,"boolean",Y,"comments"),this.Ih=a,this.J())});w.defineProperty(Y,{Of:"arrangement"},function(){return this.kd},function(a){this.kd!==a&&(w.mb(a,Y,Y,"arrangement"),a===mv||a===Tw||a===pv)&&(this.kd=a,this.J())});
w.defineProperty(Y,{iE:"arrangementSpacing"},function(){return this.hg},function(a){w.G(a,ha,Y,"arrangementSpacing");this.hg.L(a)||(this.hg.assign(a),this.J())});w.defineProperty(Y,{AL:"rootDefaults"},function(){return this.ta},function(a){this.ta!==a&&(w.G(a,nv,Y,"rootDefaults"),this.ta=a,this.J())});w.defineProperty(Y,{dK:"alternateDefaults"},function(){return this.ua},function(a){this.ua!==a&&(w.G(a,nv,Y,"alternateDefaults"),this.ua=a,this.J())});
w.defineProperty(Y,{sorting:"sorting"},function(){return this.ta.sorting},function(a){this.ta.sorting!==a&&(w.mb(a,Y,Y,"sorting"),a===Fv||a===Gv||a===Hv||Iv)&&(this.ta.sorting=a,this.J())});w.defineProperty(Y,{comparer:"comparer"},function(){return this.ta.comparer},function(a){this.ta.comparer!==a&&(w.j(a,"function",Y,"comparer"),this.ta.comparer=a,this.J())});
w.defineProperty(Y,{angle:"angle"},function(){return this.ta.angle},function(a){this.ta.angle!==a&&(w.j(a,"number",Y,"angle"),0===a||90===a||180===a||270===a?(this.ta.angle=a,this.J()):w.k("TreeLayout.angle must be 0, 90, 180, or 270"))});w.defineProperty(Y,{alignment:"alignment"},function(){return this.ta.alignment},function(a){this.ta.alignment!==a&&(w.mb(a,Y,Y,"alignment"),this.ta.alignment=a,this.J())});
w.defineProperty(Y,{nodeIndent:"nodeIndent"},function(){return this.ta.nodeIndent},function(a){this.ta.nodeIndent!==a&&(w.j(a,"number",Y,"nodeIndent"),0<=a&&(this.ta.nodeIndent=a,this.J()))});w.defineProperty(Y,{nodeIndentPastParent:"nodeIndentPastParent"},function(){return this.ta.nodeIndentPastParent},function(a){this.ta.nodeIndentPastParent!==a&&(w.j(a,"number",Y,"nodeIndentPastParent"),0<=a&&1>=a&&(this.ta.nodeIndentPastParent=a,this.J()))});
w.defineProperty(Y,{nodeSpacing:"nodeSpacing"},function(){return this.ta.nodeSpacing},function(a){this.ta.nodeSpacing!==a&&(w.j(a,"number",Y,"nodeSpacing"),this.ta.nodeSpacing=a,this.J())});w.defineProperty(Y,{layerSpacing:"layerSpacing"},function(){return this.ta.layerSpacing},function(a){this.ta.layerSpacing!==a&&(w.j(a,"number",Y,"layerSpacing"),this.ta.layerSpacing=a,this.J())});
w.defineProperty(Y,{layerSpacingParentOverlap:"layerSpacingParentOverlap"},function(){return this.ta.layerSpacingParentOverlap},function(a){this.ta.layerSpacingParentOverlap!==a&&(w.j(a,"number",Y,"layerSpacingParentOverlap"),0<=a&&1>=a&&(this.ta.layerSpacingParentOverlap=a,this.J()))});w.defineProperty(Y,{compaction:"compaction"},function(){return this.ta.compaction},function(a){this.ta.compaction!==a&&(w.mb(a,Y,Y,"compaction"),a===Qv||a===Sv)&&(this.ta.compaction=a,this.J())});
w.defineProperty(Y,{breadthLimit:"breadthLimit"},function(){return this.ta.breadthLimit},function(a){this.ta.breadthLimit!==a&&(w.j(a,"number",Y,"breadthLimit"),0<=a&&(this.ta.breadthLimit=a,this.J()))});w.defineProperty(Y,{rowSpacing:"rowSpacing"},function(){return this.ta.rowSpacing},function(a){this.ta.rowSpacing!==a&&(w.j(a,"number",Y,"rowSpacing"),this.ta.rowSpacing=a,this.J())});
w.defineProperty(Y,{rowIndent:"rowIndent"},function(){return this.ta.rowIndent},function(a){this.ta.rowIndent!==a&&(w.j(a,"number",Y,"rowIndent"),0<=a&&(this.ta.rowIndent=a,this.J()))});w.defineProperty(Y,{commentSpacing:"commentSpacing"},function(){return this.ta.commentSpacing},function(a){this.ta.commentSpacing!==a&&(w.j(a,"number",Y,"commentSpacing"),this.ta.commentSpacing=a,this.J())});
w.defineProperty(Y,{commentMargin:"commentMargin"},function(){return this.ta.commentMargin},function(a){this.ta.commentMargin!==a&&(w.j(a,"number",Y,"commentMargin"),this.ta.commentMargin=a,this.J())});w.defineProperty(Y,{setsPortSpot:"setsPortSpot"},function(){return this.ta.setsPortSpot},function(a){this.ta.setsPortSpot!==a&&(w.j(a,"boolean",Y,"setsPortSpot"),this.ta.setsPortSpot=a,this.J())});
w.defineProperty(Y,{portSpot:"portSpot"},function(){return this.ta.portSpot},function(a){w.G(a,L,Y,"portSpot");this.ta.portSpot.L(a)||(this.ta.portSpot=a,this.J())});w.defineProperty(Y,{setsChildPortSpot:"setsChildPortSpot"},function(){return this.ta.setsChildPortSpot},function(a){this.ta.setsChildPortSpot!==a&&(w.j(a,"boolean",Y,"setsChildPortSpot"),this.ta.setsChildPortSpot=a,this.J())});
w.defineProperty(Y,{childPortSpot:"childPortSpot"},function(){return this.ta.childPortSpot},function(a){w.G(a,L,Y,"childPortSpot");this.ta.childPortSpot.L(a)||(this.ta.childPortSpot=a,this.J())});w.defineProperty(Y,{oK:"alternateSorting"},function(){return this.ua.sorting},function(a){this.ua.sorting!==a&&(w.mb(a,Y,Y,"alternateSorting"),a===Fv||a===Gv||a===Hv||Iv)&&(this.ua.sorting=a,this.J())});
w.defineProperty(Y,{cK:"alternateComparer"},function(){return this.ua.comparer},function(a){this.ua.comparer!==a&&(w.j(a,"function",Y,"alternateComparer"),this.ua.comparer=a,this.J())});w.defineProperty(Y,{XJ:"alternateAngle"},function(){return this.ua.angle},function(a){this.ua.angle!==a&&(w.j(a,"number",Y,"alternateAngle"),0===a||90===a||180===a||270===a)&&(this.ua.angle=a,this.J())});
w.defineProperty(Y,{WJ:"alternateAlignment"},function(){return this.ua.alignment},function(a){this.ua.alignment!==a&&(w.mb(a,Y,Y,"alternateAlignment"),this.ua.alignment=a,this.J())});w.defineProperty(Y,{gK:"alternateNodeIndent"},function(){return this.ua.nodeIndent},function(a){this.ua.nodeIndent!==a&&(w.j(a,"number",Y,"alternateNodeIndent"),0<=a&&(this.ua.nodeIndent=a,this.J()))});
w.defineProperty(Y,{hK:"alternateNodeIndentPastParent"},function(){return this.ua.nodeIndentPastParent},function(a){this.ua.nodeIndentPastParent!==a&&(w.j(a,"number",Y,"alternateNodeIndentPastParent"),0<=a&&1>=a&&(this.ua.nodeIndentPastParent=a,this.J()))});w.defineProperty(Y,{iK:"alternateNodeSpacing"},function(){return this.ua.nodeSpacing},function(a){this.ua.nodeSpacing!==a&&(w.j(a,"number",Y,"alternateNodeSpacing"),this.ua.nodeSpacing=a,this.J())});
w.defineProperty(Y,{eK:"alternateLayerSpacing"},function(){return this.ua.layerSpacing},function(a){this.ua.layerSpacing!==a&&(w.j(a,"number",Y,"alternateLayerSpacing"),this.ua.layerSpacing=a,this.J())});w.defineProperty(Y,{fK:"alternateLayerSpacingParentOverlap"},function(){return this.ua.layerSpacingParentOverlap},function(a){this.ua.layerSpacingParentOverlap!==a&&(w.j(a,"number",Y,"alternateLayerSpacingParentOverlap"),0<=a&&1>=a&&(this.ua.layerSpacingParentOverlap=a,this.J()))});
w.defineProperty(Y,{bK:"alternateCompaction"},function(){return this.ua.compaction},function(a){this.ua.compaction!==a&&(w.mb(a,Y,Y,"alternateCompaction"),a===Qv||a===Sv)&&(this.ua.compaction=a,this.J())});w.defineProperty(Y,{YJ:"alternateBreadthLimit"},function(){return this.ua.breadthLimit},function(a){this.ua.breadthLimit!==a&&(w.j(a,"number",Y,"alternateBreadthLimit"),0<=a&&(this.ua.breadthLimit=a,this.J()))});
w.defineProperty(Y,{lK:"alternateRowSpacing"},function(){return this.ua.rowSpacing},function(a){this.ua.rowSpacing!==a&&(w.j(a,"number",Y,"alternateRowSpacing"),this.ua.rowSpacing=a,this.J())});w.defineProperty(Y,{kK:"alternateRowIndent"},function(){return this.ua.rowIndent},function(a){this.ua.rowIndent!==a&&(w.j(a,"number",Y,"alternateRowIndent"),0<=a&&(this.ua.rowIndent=a,this.J()))});
w.defineProperty(Y,{aK:"alternateCommentSpacing"},function(){return this.ua.commentSpacing},function(a){this.ua.commentSpacing!==a&&(w.j(a,"number",Y,"alternateCommentSpacing"),this.ua.commentSpacing=a,this.J())});w.defineProperty(Y,{$J:"alternateCommentMargin"},function(){return this.ua.commentMargin},function(a){this.ua.commentMargin!==a&&(w.j(a,"number",Y,"alternateCommentMargin"),this.ua.commentMargin=a,this.J())});
w.defineProperty(Y,{nK:"alternateSetsPortSpot"},function(){return this.ua.setsPortSpot},function(a){this.ua.setsPortSpot!==a&&(w.j(a,"boolean",Y,"alternateSetsPortSpot"),this.ua.setsPortSpot=a,this.J())});w.defineProperty(Y,{jK:"alternatePortSpot"},function(){return this.ua.portSpot},function(a){w.G(a,L,Y,"alternatePortSpot");this.ua.portSpot.L(a)||(this.ua.portSpot=a,this.J())});
w.defineProperty(Y,{mK:"alternateSetsChildPortSpot"},function(){return this.ua.setsChildPortSpot},function(a){this.ua.setsChildPortSpot!==a&&(w.j(a,"boolean",Y,"alternateSetsChildPortSpot"),this.ua.setsChildPortSpot=a,this.J())});w.defineProperty(Y,{ZJ:"alternateChildPortSpot"},function(){return this.ua.childPortSpot},function(a){w.G(a,L,Y,"alternateChildPortSpot");this.ua.childPortSpot.L(a)||(this.ua.childPortSpot=a,this.J())});var iv;Y.PathDefault=iv=w.p(Y,"PathDefault",-1);var jv;
Y.PathDestination=jv=w.p(Y,"PathDestination",0);var qv;Y.PathSource=qv=w.p(Y,"PathSource",1);var Fv;Y.SortingForwards=Fv=w.p(Y,"SortingForwards",10);var Gv;Y.SortingReverse=Gv=w.p(Y,"SortingReverse",11);var Hv;Y.SortingAscending=Hv=w.p(Y,"SortingAscending",12);var Iv;Y.SortingDescending=Iv=w.p(Y,"SortingDescending",13);var Kw;Y.AlignmentCenterSubtrees=Kw=w.p(Y,"AlignmentCenterSubtrees",20);var Jv;Y.AlignmentCenterChildren=Jv=w.p(Y,"AlignmentCenterChildren",21);var Uv;
Y.AlignmentStart=Uv=w.p(Y,"AlignmentStart",22);var Vv;Y.AlignmentEnd=Vv=w.p(Y,"AlignmentEnd",23);var Lv;Y.AlignmentBus=Lv=w.p(Y,"AlignmentBus",24);var Av;Y.AlignmentBusBranching=Av=w.p(Y,"AlignmentBusBranching",25);var Mv;Y.AlignmentTopLeftBus=Mv=w.p(Y,"AlignmentTopLeftBus",26);var Nv;Y.AlignmentBottomRightBus=Nv=w.p(Y,"AlignmentBottomRightBus",27);var Qv;Y.CompactionNone=Qv=w.p(Y,"CompactionNone",30);var Sv;Y.CompactionBlock=Sv=w.p(Y,"CompactionBlock",31);var kv;
Y.StyleLayered=kv=w.p(Y,"StyleLayered",40);var Ev;Y.StyleLastParents=Ev=w.p(Y,"StyleLastParents",41);var Dv;Y.StyleAlternating=Dv=w.p(Y,"StyleAlternating",42);var Cv;Y.StyleRootOnly=Cv=w.p(Y,"StyleRootOnly",43);var mv;Y.ArrangementVertical=mv=w.p(Y,"ArrangementVertical",50);var Tw;Y.ArrangementHorizontal=Tw=w.p(Y,"ArrangementHorizontal",51);var pv;Y.ArrangementFixedRoots=pv=w.p(Y,"ArrangementFixedRoots",52);var lv;Y.LayerIndividual=lv=w.p(Y,"LayerIndividual",60);var yv;
Y.LayerSiblings=yv=w.p(Y,"LayerSiblings",61);var xv;Y.LayerUniform=xv=w.p(Y,"LayerUniform",62);function ov(){qg.call(this)}w.La(ov,qg);w.fa("TreeNetwork",ov);ov.prototype.createVertex=function(){return new nv};ov.prototype.createEdge=function(){return new Vw};
function nv(){ks.call(this);this.initialized=!1;this.parent=null;this.children=[];this.maxGenerationCount=this.maxChildrenCount=this.descendantCount=this.level=0;this.comments=null;this.pa=new z(0,0);this.ib=new ha(0,0);this.Oa=new z(0,0);this.pq=this.oq=this.qJ=!1;this.Bu=this.gu=null;this.sorting=Fv;this.comparer=qs;this.angle=0;this.alignment=Jv;this.nodeIndentPastParent=this.nodeIndent=0;this.nodeSpacing=20;this.layerSpacing=50;this.layerSpacingParentOverlap=0;this.compaction=Sv;this.breadthLimit=
0;this.rowSpacing=25;this.commentSpacing=this.rowIndent=10;this.commentMargin=20;this.setsPortSpot=!0;this.portSpot=oc;this.setsChildPortSpot=!0;this.childPortSpot=oc}w.La(nv,ks);w.fa("TreeVertex",nv);
nv.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.sorting=a.sorting,this.comparer=a.comparer,this.angle=a.angle,this.alignment=a.alignment,this.nodeIndent=a.nodeIndent,this.nodeIndentPastParent=a.nodeIndentPastParent,this.nodeSpacing=a.nodeSpacing,this.layerSpacing=a.layerSpacing,this.layerSpacingParentOverlap=a.layerSpacingParentOverlap,this.compaction=a.compaction,this.breadthLimit=a.breadthLimit,this.rowSpacing=a.rowSpacing,this.rowIndent=a.rowIndent,this.commentSpacing=a.commentSpacing,
this.commentMargin=a.commentMargin,this.setsPortSpot=a.setsPortSpot,this.portSpot=a.portSpot,this.setsChildPortSpot=a.setsChildPortSpot,this.childPortSpot=a.childPortSpot)};w.u(nv,{mn:"childrenCount"},function(){return this.children.length});w.defineProperty(nv,{zL:"relativePosition"},function(){return this.pa},function(a){this.pa.set(a)});w.defineProperty(nv,{ML:"subtreeSize"},function(){return this.ib},function(a){this.ib.set(a)});
w.defineProperty(nv,{LL:"subtreeOffset"},function(){return this.Oa},function(a){this.Oa.set(a)});function Vw(){ls.call(this);this.Fs=new z(0,0)}w.La(Vw,ls);w.fa("TreeEdge",Vw);
Vw.prototype.commit=function(){var a=this.link;if(null!==a&&!a.Dk){var b=this.network.Rb,c=null,d=null;switch(b.Hf){case jv:c=this.fromVertex;d=this.toVertex;break;case qv:c=this.toVertex;d=this.fromVertex;break;default:w.k("Unhandled path value "+b.Hf.toString())}if(null!==c&&null!==d)if(b=this.Fs,0!==b.x||0!==b.y||c.qJ){var d=c.jb,e=Tv(c),f=Wv(c),h=c.rowSpacing;a.ao();var k=a.Ye===sj,l=a.ic,m=0,n,p;a.fm();if(l||k){for(m=2;4<a.qa;)a.NF(2);n=a.m(1);p=a.m(2)}else{for(m=1;3<a.qa;)a.NF(1);n=a.m(0);p=
a.m(a.qa-1)}var q=a.m(a.qa-1),r=0;0===e?(c.alignment===Vv?(r=d.bottom+b.y,0===b.y&&n.y>q.y+c.rowIndent&&(r=Math.min(r,Math.max(n.y,r-Xv(c))))):c.alignment===Uv?(r=d.top+b.y,0===b.y&&n.y<q.y-c.rowIndent&&(r=Math.max(r,Math.min(n.y,r+Xv(c))))):r=c.oq||c.pq&&1===c.maxGenerationCount?d.top-c.Oa.y+b.y:d.y+d.height/2+b.y,k?(a.w(m,n.x,r),m++,a.w(m,d.right+f,r),m++,a.w(m,d.right+f+(b.x-h)/3,r),m++,a.w(m,d.right+f+2*(b.x-h)/3,r),m++,a.w(m,d.right+f+(b.x-h),r),m++,a.w(m,p.x,r)):(l&&(a.w(m,d.right+f/2,n.y),
m++),a.w(m,d.right+f/2,r),m++,a.w(m,d.right+f+b.x-(l?h/2:h),r),m++,l&&a.w(m,a.m(m-1).x,p.y))):90===e?(c.alignment===Vv?(r=d.right+b.x,0===b.x&&n.x>q.x+c.rowIndent&&(r=Math.min(r,Math.max(n.x,r-Xv(c))))):c.alignment===Uv?(r=d.left+b.x,0===b.x&&n.x<q.x-c.rowIndent&&(r=Math.max(r,Math.min(n.x,r+Xv(c))))):r=c.oq||c.pq&&1===c.maxGenerationCount?d.left-c.Oa.x+b.x:d.x+d.width/2+b.x,k?(a.w(m,r,n.y),m++,a.w(m,r,d.bottom+f),m++,a.w(m,r,d.bottom+f+(b.y-h)/3),m++,a.w(m,r,d.bottom+f+2*(b.y-h)/3),m++,a.w(m,r,d.bottom+
f+(b.y-h)),m++,a.w(m,r,p.y)):(l&&(a.w(m,n.x,d.bottom+f/2),m++),a.w(m,r,d.bottom+f/2),m++,a.w(m,r,d.bottom+f+b.y-(l?h/2:h)),m++,l&&a.w(m,p.x,a.m(m-1).y))):180===e?(c.alignment===Vv?(r=d.bottom+b.y,0===b.y&&n.y>q.y+c.rowIndent&&(r=Math.min(r,Math.max(n.y,r-Xv(c))))):c.alignment===Uv?(r=d.top+b.y,0===b.y&&n.y<q.y-c.rowIndent&&(r=Math.max(r,Math.min(n.y,r+Xv(c))))):r=c.oq||c.pq&&1===c.maxGenerationCount?d.top-c.Oa.y+b.y:d.y+d.height/2+b.y,k?(a.w(m,n.x,r),m++,a.w(m,d.left-f,r),m++,a.w(m,d.left-f+(b.x+
h)/3,r),m++,a.w(m,d.left-f+2*(b.x+h)/3,r),m++,a.w(m,d.left-f+(b.x+h),r),m++,a.w(m,p.x,r)):(l&&(a.w(m,d.left-f/2,n.y),m++),a.w(m,d.left-f/2,r),m++,a.w(m,d.left-f+b.x+(l?h/2:h),r),m++,l&&a.w(m,a.m(m-1).x,p.y))):270===e?(c.alignment===Vv?(r=d.right+b.x,0===b.x&&n.x>q.x+c.rowIndent&&(r=Math.min(r,Math.max(n.x,r-Xv(c))))):c.alignment===Uv?(r=d.left+b.x,0===b.x&&n.x<q.x-c.rowIndent&&(r=Math.max(r,Math.min(n.x,r+Xv(c))))):r=c.oq||c.pq&&1===c.maxGenerationCount?d.left-c.Oa.x+b.x:d.x+d.width/2+b.x,k?(a.w(m,
r,n.y),m++,a.w(m,r,d.top-f),m++,a.w(m,r,d.top-f+(b.y+h)/3),m++,a.w(m,r,d.top-f+2*(b.y+h)/3),m++,a.w(m,r,d.top-f+(b.y+h)),m++,a.w(m,r,p.y)):(l&&(a.w(m,n.x,d.top-f/2),m++),a.w(m,r,d.top-f/2),m++,a.w(m,r,d.top-f+b.y+(l?h/2:h)),m++,l&&a.w(m,p.x,a.m(m-1).y))):w.k("Invalid angle "+e);a.ij()}else e=c,f=d,a=this.link,c=Tv(e),c!==Tv(f)&&(b=Wv(e),d=e.jb,e=f.jb,0===c&&e.left-d.right<b+1||90===c&&e.top-d.bottom<b+1||180===c&&d.left-e.right<b+1||270===c&&d.top-e.bottom<b+1||(a.ao(),e=a.Ye===sj,f=a.ic,h=Kv(this.fromVertex.alignment),
a.fm(),0===c?(c=d.right+b/2,e?4===a.qa&&(b=a.m(3).y,a.ea(1,c-20,a.m(1).y),a.w(2,c-20,b),a.w(3,c,b),a.w(4,c+20,b),a.ea(5,a.m(5).x,b)):f?h?a.ea(3,a.m(2).x,a.m(4).y):6===a.qa&&(a.ea(2,c,a.m(2).y),a.ea(3,c,a.m(3).y)):4===a.qa?a.w(2,c,a.m(2).y):3===a.qa?a.ea(1,c,a.m(2).y):2===a.qa&&a.w(1,c,a.m(1).y)):90===c?(b=d.bottom+b/2,e?4===a.qa&&(c=a.m(3).x,a.ea(1,a.m(1).x,b-20),a.w(2,c,b-20),a.w(3,c,b),a.w(4,c,b+20),a.ea(5,c,a.m(5).y)):f?h?a.ea(3,a.m(2).x,a.m(4).y):6===a.qa&&(a.ea(2,a.m(2).x,b),a.ea(3,a.m(3).x,
b)):4===a.qa?a.w(2,a.m(2).x,b):3===a.qa?a.ea(1,a.m(2).x,b):2===a.qa&&a.w(1,a.m(1).x,b)):180===c?(c=d.left-b/2,e?4===a.qa&&(b=a.m(3).y,a.ea(1,c+20,a.m(1).y),a.w(2,c+20,b),a.w(3,c,b),a.w(4,c-20,b),a.ea(5,a.m(5).x,b)):f?h?a.ea(3,a.m(2).x,a.m(4).y):6===a.qa&&(a.ea(2,c,a.m(2).y),a.ea(3,c,a.m(3).y)):4===a.qa?a.w(2,c,a.m(2).y):3===a.qa?a.ea(1,c,a.m(2).y):2===a.qa&&a.w(1,c,a.m(1).y)):270===c&&(b=d.top-b/2,e?4===a.qa&&(c=a.m(3).x,a.ea(1,a.m(1).x,b+20),a.w(2,c,b+20),a.w(3,c,b),a.w(4,c,b-20),a.ea(5,c,a.m(5).y)):
f?h?a.ea(3,a.m(2).x,a.m(4).y):6===a.qa&&(a.ea(2,a.m(2).x,b),a.ea(3,a.m(3).x,b)):4===a.qa?a.w(2,a.m(2).x,b):3===a.qa?a.ea(1,a.m(2).x,b):2===a.qa&&a.w(1,a.m(1).x,b)),a.ij()))}};w.defineProperty(Vw,{yL:"relativePoint"},function(){return this.Fs},function(a){this.Fs.set(a)});function Ww(){G.call(this);this.Se=null}w.La(Ww,G);Ww.prototype.cloneProtected=function(a){G.prototype.cloneProtected.call(this,a);a.element=this.Se.cloneNode(!0)};
Ww.prototype.toString=function(){return"HTMLHost("+this.Se.toString()+")#"+w.Jd(this)};Ww.prototype.xk=function(a,b){var c=this.Se;if(null!==c){var d=this.Wa(Fb);d.x-=this.Y.width/2;d.y-=this.Y.height/2;d.x-=this.Y.x;d.y-=this.Y.y;var d=b.rG(d),e=b.lj;null===e||e.contains(c)||e.appendChild(c);e=this.transform;c.style.transform="matrix("+e.m11+","+e.m12+","+e.m21+","+e.m22+","+e.dx+","+e.dy+")";c.style.transformOrigin="0 0";e=d.y;c.style.left=d.x+"px";c.style.top=e+"px"}};
Ww.prototype.Ln=function(a,b,c,d){var e=this.Aa;isFinite(e.width)&&(a=e.width);isFinite(e.height)&&(b=e.height);var e=this.Af,f=this.zh;c=Math.max(c,f.width);d=Math.max(d,f.height);a=Math.min(e.width,a);b=Math.min(e.height,b);a=Math.max(c,a);b=Math.max(d,b);c=this.Se;null!==c&&(b=c.getBoundingClientRect(),a=b.width,b=b.height);Pa(this.Sc,a,b);yo(this,0,0,a,b)};Ww.prototype.hj=function(a,b,c,d){Do(this,a,b,c,d)};w.u(Ww,{Ia:"naturalBounds"},function(){return this.Sc});
w.defineProperty(Ww,{element:"element"},function(){return this.Se},function(a){var b=this.Se;b!==a&&(a instanceof HTMLElement||w.k("HTMLHost.element must be an instance of Element."),this.Se=a,a.className="HTMLHost",this.h("element",b,a),this.na())});da.version="1.7.7";
window&&(window.module&&"object"===typeof window.module&&"object"===typeof window.module.exports?window.module.exports=da:window.define&&"function"===typeof window.define&&window.define.amd?(window.go=da,window.define(da)):window.go=da);"undefined"!==typeof module&&"object"===typeof module.exports&&(module.exports=da); })(window);
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/samples/

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/samples/

Statements: 100% (187 / 187)      Branches: 100% (0 / 0)      Functions: 100% (0 / 0)      Lines: 100% (187 / 187)      Ignored: none     

All files » node-npmtest-gojs/node_modules/gojs/samples/
File Statements Branches Functions Lines
icons.js 100% (1 / 1) 100% (0 / 0) 100% (0 / 0) 100% (1 / 1)
indexList.js 100% (186 / 186) 100% (0 / 0) 100% (0 / 0) 100% (186 / 186)
Code coverage report for node-npmtest-gojs/node_modules/gojs/samples/icons.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/samples/icons.js

Statements: 100% (1 / 1)      Branches: 100% (0 / 0)      Functions: 100% (0 / 0)      Lines: 100% (1 / 1)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162      1                                                                                                                                                                                                                                                                                                                            
// a selection of free icons from http://icomoon.io/
// the following paths are all pure SVG path strings that GoJS parses as Geometry strings.
 
var icons = {
  "home":
  "M32 18.451l-16-12.42-16 12.42v-5.064l16-12.42 16 12.42zM28 18v12h-8v-8h-8v8h-8v-12l12-9z",
 
  "droplet":
  "M27.998 19.797c-0-0.022-0.001-0.044-0.001-0.066-0.001-0.045-0.002-0.089-0.004-0.134-0.313-9.864-11.993-19.597-11.993-19.597s-11.68 9.733-11.993 19.598c-0.001 0.045-0.003 0.089-0.004 0.134-0 0.022-0.001 0.044-0.001 0.066-0.001 0.067-0.002 0.135-0.002 0.203 0 0.074 0.001 0.148 0.002 0.221 0 0.006 0 0.012 0 0.018 0.127 6.517 5.45 11.76 11.997 11.76s11.87-5.244 11.997-11.761c0-0.006 0-0.012 0-0.018 0.001-0.074 0.002-0.147 0.002-0.221 0-0.068-0.001-0.136-0.002-0.203zM23.998 20.148l-0 0.013c-0.041 2.103-0.892 4.073-2.395 5.548-1.504 1.477-3.495 2.291-5.604 2.291-0.389 0-0.775-0.028-1.154-0.082 4.346-2.589 7.257-7.335 7.257-12.76 0-0.608-0.037-1.207-0.108-1.796 1.259 2.311 1.939 4.462 2 6.363l0 0.005c0.001 0.030 0.002 0.059 0.002 0.089l0.001 0.045c0.001 0.046 0.002 0.091 0.002 0.137 0 0.049-0.001 0.099-0.002 0.148z",
 
  "camera":
  "M9.5 19c0 3.59 2.91 6.5 6.5 6.5s6.5-2.91 6.5-6.5-2.91-6.5-6.5-6.5-6.5 2.91-6.5 6.5zM30 8h-7c-0.5-2-1-4-3-4h-8c-2 0-2.5 2-3 4h-7c-1.1 0-2 0.9-2 2v18c0 1.1 0.9 2 2 2h28c1.1 0 2-0.9 2-2v-18c0-1.1-0.9-2-2-2zM16 27.875c-4.902 0-8.875-3.973-8.875-8.875s3.973-8.875 8.875-8.875c4.902 0 8.875 3.973 8.875 8.875s-3.973 8.875-8.875 8.875zM30 14h-4v-2h4v2z",
 
  "pacman":
  "M30.148 5.588c-2.934-3.42-7.288-5.588-12.148-5.588-8.837 0-16 7.163-16 16s7.163 16 16 16c4.86 0 9.213-2.167 12.148-5.588l-10.148-10.412 10.148-10.412zM22 3.769c1.232 0 2.231 0.999 2.231 2.231s-0.999 2.231-2.231 2.231-2.231-0.999-2.231-2.231c0-1.232 0.999-2.231 2.231-2.231z",
 
  "spades":
  "M25.549 10.88c-6.049-4.496-8.133-8.094-9.549-10.88v0c-0 0-0-0-0-0v0c-1.415 2.785-3.5 6.384-9.549 10.88-10.314 7.665-0.606 18.365 7.93 12.476-0.556 3.654-2.454 6.318-4.381 7.465v1.179h12.001v-1.179c-1.928-1.147-3.825-3.811-4.382-7.465 8.535 5.889 18.244-4.811 7.93-12.476z",
 
  "clubs":
  "M24.588 12.274c-1.845 0-3.503 0.769-4.683 2.022-0.5 0.531-1.368 1.16-2.306 1.713 0.441-1.683 1.834-3.803 2.801-4.733 1.239-1.193 2-2.87 2-4.734 0-3.59-2.859-6.503-6.4-6.541-3.541 0.038-6.4 2.951-6.4 6.541 0 1.865 0.761 3.542 2 4.734 0.967 0.93 2.36 3.050 2.801 4.733-0.939-0.553-1.806-1.182-2.306-1.713-1.18-1.253-2.838-2.022-4.683-2.022-3.575 0-6.471 2.927-6.471 6.541s2.897 6.542 6.471 6.542c1.845 0 3.503-0.792 4.683-2.045 0.525-0.558 1.451-1.254 2.447-1.832-0.094 4.615-2.298 8.005-4.541 9.341v1.179h12v-1.179c-2.244-1.335-4.448-4.726-4.541-9.341 0.995 0.578 1.922 1.274 2.447 1.832 1.18 1.253 2.838 2.045 4.683 2.045 3.575 0 6.471-2.928 6.471-6.542s-2.897-6.541-6.471-6.541z",
 
  "diamonds":
  "M16 0l-10 16 10 16 10-16z",
 
  "connection":
  "M20 18c3.308 0 6.308 1.346 8.481 3.519l-2.827 2.827c-1.449-1.449-3.449-2.346-5.654-2.346s-4.206 0.897-5.654 2.346l-2.827-2.827c2.173-2.173 5.173-3.519 8.481-3.519zM5.858 15.858c3.777-3.777 8.8-5.858 14.142-5.858s10.365 2.080 14.142 5.858l-2.828 2.828c-3.022-3.022-7.040-4.686-11.314-4.686s-8.292 1.664-11.314 4.686l-2.828-2.828zM30.899 4.201c3.334 1.41 6.329 3.429 8.899 6v0l-2.828 2.828c-4.533-4.533-10.56-7.029-16.971-7.029s-12.438 2.496-16.971 7.029l-2.828-2.828c2.571-2.571 5.565-4.589 8.899-6 3.453-1.461 7.12-2.201 10.899-2.201s7.446 0.741 10.899 2.201zM18 28c0-1.105 0.895-2 2-2s2 0.895 2 2c0 1.105-0.895 2-2 2s-2-0.895-2-2z",
 
  "feed":
  "M12 16c0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.209-1.791 4-4 4s-4-1.791-4-4zM20.761 7.204c3.12 1.692 5.239 4.997 5.239 8.796s-2.119 7.104-5.239 8.796c1.377-2.191 2.239-5.321 2.239-8.796s-0.862-6.605-2.239-8.796zM9 16c0 3.475 0.862 6.605 2.239 8.796-3.12-1.692-5.239-4.997-5.239-8.796s2.119-7.104 5.239-8.796c-1.377 2.191-2.239 5.321-2.239 8.796zM3 16c0 5.372 1.7 10.193 4.395 13.491-4.447-2.842-7.395-7.822-7.395-13.491s2.948-10.649 7.395-13.491c-2.695 3.298-4.395 8.119-4.395 13.491zM24.605 2.509c4.447 2.842 7.395 7.822 7.395 13.491s-2.948 10.649-7.395 13.491c2.695-3.298 4.395-8.119 4.395-13.491s-1.7-10.193-4.395-13.491z",
 
  "file":
  "M27.879 5.879l-3.757-3.757c-1.167-1.167-3.471-2.121-5.121-2.121h-14c-1.65 0-3 1.35-3 3v26c0 1.65 1.35 3 3 3h22c1.65 0 3-1.35 3-3v-18c0-1.65-0.955-3.955-2.121-5.121zM20 4.236c0.069 0.025 0.139 0.053 0.211 0.082 0.564 0.234 0.956 0.505 1.082 0.631l3.757 3.757c0.126 0.126 0.397 0.517 0.631 1.082 0.030 0.072 0.057 0.143 0.082 0.211h-5.764v-5.764zM26 28h-20v-24h12v8h8v16zM8 16h16v2h-16zM8 20h16v2h-16zM8 24h16v2h-16z",
 
  "history":
  "M18 2c7.732 0 14 6.268 14 14s-6.268 14-14 14v-3c2.938 0 5.701-1.144 7.778-3.222s3.222-4.84 3.222-7.778c0-2.938-1.144-5.701-3.222-7.778s-4.84-3.222-7.778-3.222c-2.938 0-5.701 1.144-7.778 3.222-1.598 1.598-2.643 3.601-3.041 5.778h5.819l-7 8-7-8h5.143c0.971-6.784 6.804-12 13.857-12zM24 14v4h-8v-10h4v6z",
 
  "alarm":
  "M16 4c-7.732 0-14 6.268-14 14s6.268 14 14 14 14-6.268 14-14-6.268-14-14-14zM16 29.25c-6.213 0-11.25-5.037-11.25-11.25s5.037-11.25 11.25-11.25c6.213 0 11.25 5.037 11.25 11.25s-5.037 11.25-11.25 11.25zM29.212 8.974c0.501-0.877 0.788-1.892 0.788-2.974 0-3.314-2.686-6-6-6-1.932 0-3.65 0.913-4.747 2.331 4.121 0.851 7.663 3.287 9.96 6.643zM12.748 2.331c-1.097-1.418-2.816-2.331-4.748-2.331-3.314 0-6 2.686-6 6 0 1.082 0.287 2.098 0.788 2.974 2.297-3.356 5.838-5.792 9.96-6.643zM14 10h2v10h-2v-10zM16 18h6v2h-6v-2z",
 
  "box-add":
  "M26 2h-20l-6 6v21c0 0.552 0.448 1 1 1h30c0.552 0 1-0.448 1-1v-21l-6-6zM16 26l-10-8h6v-6h8v6h6l-10 8zM4.828 6l2-2h18.343l2 2h-22.343z",
 
  "box-remove":
  "M26 2h-20l-6 6v21c0 0.552 0.448 1 1 1h30c0.552 0 1-0.448 1-1v-21l-6-6zM20 20v6h-8v-6h-6l10-8 10 8h-6zM4.828 6l2-2h18.343l2 2h-22.343z",
 
  "user":
  "M8 10c0-4.418 3.582-8 8-8s8 3.582 8 8c0 4.418-3.582 8-8 8s-8-3.582-8-8zM24 20h-16c-4.418 0-8 3.582-8 8v2h32v-2c0-4.418-3.582-8-8-8z",
 
  "zoomin":
  "M31.008 27.231l-7.58-6.447c-0.784-0.705-1.622-1.029-2.299-0.998 1.789-2.096 2.87-4.815 2.87-7.787 0-6.627-5.373-12-12-12s-12 5.373-12 12c0 6.627 5.373 12 12 12 2.972 0 5.691-1.081 7.787-2.87-0.031 0.677 0.293 1.515 0.998 2.299l6.447 7.58c1.104 1.226 2.907 1.33 4.007 0.23s0.997-2.903-0.23-4.007zM12 20c-4.418 0-8-3.582-8-8s3.582-8 8-8 8 3.582 8 8-3.582 8-8 8zM14 6h-4v4h-4v4h4v4h4v-4h4v-4h-4z",
 
  "zoomout":
  "M31.008 27.231l-7.58-6.447c-0.784-0.705-1.622-1.029-2.299-0.998 1.789-2.096 2.87-4.815 2.87-7.787 0-6.627-5.373-12-12-12s-12 5.373-12 12c0 6.627 5.373 12 12 12 2.972 0 5.691-1.081 7.787-2.87-0.031 0.677 0.293 1.515 0.998 2.299l6.447 7.58c1.104 1.226 2.907 1.33 4.007 0.23s0.997-2.903-0.23-4.007zM12 20c-4.418 0-8-3.582-8-8s3.582-8 8-8 8 3.582 8 8-3.582 8-8 8zM6 10h12v4h-12z",
 
  "cog":
  "M29.181 19.070c-1.679-2.908-0.669-6.634 2.255-8.328l-3.145-5.447c-0.898 0.527-1.943 0.829-3.058 0.829-3.361 0-6.085-2.742-6.085-6.125h-6.289c0.008 1.044-0.252 2.103-0.811 3.070-1.679 2.908-5.411 3.897-8.339 2.211l-3.144 5.447c0.905 0.515 1.689 1.268 2.246 2.234 1.676 2.903 0.672 6.623-2.241 8.319l3.145 5.447c0.895-0.522 1.935-0.82 3.044-0.82 3.35 0 6.067 2.725 6.084 6.092h6.289c-0.003-1.034 0.259-2.080 0.811-3.038 1.676-2.903 5.399-3.894 8.325-2.219l3.145-5.447c-0.899-0.515-1.678-1.266-2.232-2.226zM16 22.479c-3.578 0-6.479-2.901-6.479-6.479s2.901-6.479 6.479-6.479c3.578 0 6.479 2.901 6.479 6.479s-2.901 6.479-6.479 6.479z",
 
  "cogs":
  "M11.366 22.564l1.291-1.807-1.414-1.414-1.807 1.291c-0.335-0.187-0.694-0.337-1.071-0.444l-0.365-2.19h-2l-0.365 2.19c-0.377 0.107-0.736 0.256-1.071 0.444l-1.807-1.291-1.414 1.414 1.291 1.807c-0.187 0.335-0.337 0.694-0.443 1.071l-2.19 0.365v2l2.19 0.365c0.107 0.377 0.256 0.736 0.444 1.071l-1.291 1.807 1.414 1.414 1.807-1.291c0.335 0.187 0.694 0.337 1.071 0.444l0.365 2.19h2l0.365-2.19c0.377-0.107 0.736-0.256 1.071-0.444l1.807 1.291 1.414-1.414-1.291-1.807c0.187-0.335 0.337-0.694 0.444-1.071l2.19-0.365v-2l-2.19-0.365c-0.107-0.377-0.256-0.736-0.444-1.071zM7 27c-1.105 0-2-0.895-2-2s0.895-2 2-2 2 0.895 2 2-0.895 2-2 2zM32 12v-2l-2.106-0.383c-0.039-0.251-0.088-0.499-0.148-0.743l1.799-1.159-0.765-1.848-2.092 0.452c-0.132-0.216-0.273-0.426-0.422-0.629l1.219-1.761-1.414-1.414-1.761 1.219c-0.203-0.149-0.413-0.29-0.629-0.422l0.452-2.092-1.848-0.765-1.159 1.799c-0.244-0.059-0.492-0.109-0.743-0.148l-0.383-2.106h-2l-0.383 2.106c-0.251 0.039-0.499 0.088-0.743 0.148l-1.159-1.799-1.848 0.765 0.452 2.092c-0.216 0.132-0.426 0.273-0.629 0.422l-1.761-1.219-1.414 1.414 1.219 1.761c-0.149 0.203-0.29 0.413-0.422 0.629l-2.092-0.452-0.765 1.848 1.799 1.159c-0.059 0.244-0.109 0.492-0.148 0.743l-2.106 0.383v2l2.106 0.383c0.039 0.251 0.088 0.499 0.148 0.743l-1.799 1.159 0.765 1.848 2.092-0.452c0.132 0.216 0.273 0.426 0.422 0.629l-1.219 1.761 1.414 1.414 1.761-1.219c0.203 0.149 0.413 0.29 0.629 0.422l-0.452 2.092 1.848 0.765 1.159-1.799c0.244 0.059 0.492 0.109 0.743 0.148l0.383 2.106h2l0.383-2.106c0.251-0.039 0.499-0.088 0.743-0.148l1.159 1.799 1.848-0.765-0.452-2.092c0.216-0.132 0.426-0.273 0.629-0.422l1.761 1.219 1.414-1.414-1.219-1.761c0.149-0.203 0.29-0.413 0.422-0.629l2.092 0.452 0.765-1.848-1.799-1.159c0.059-0.244 0.109-0.492 0.148-0.743l2.106-0.383zM21 15.35c-2.402 0-4.35-1.948-4.35-4.35s1.948-4.35 4.35-4.35 4.35 1.948 4.35 4.35c0 2.402-1.948 4.35-4.35 4.35z",
 
  "stats":
  "M4 28h28v4h-32v-32h4zM9 26c-1.657 0-3-1.343-3-3s1.343-3 3-3c0.088 0 0.176 0.005 0.262 0.012l3.225-5.375c-0.307-0.471-0.487-1.033-0.487-1.638 0-1.657 1.343-3 3-3s3 1.343 3 3c0 0.604-0.179 1.167-0.487 1.638l3.225 5.375c0.086-0.007 0.174-0.012 0.262-0.012 0.067 0 0.133 0.003 0.198 0.007l5.324-9.316c-0.329-0.482-0.522-1.064-0.522-1.691 0-1.657 1.343-3 3-3s3 1.343 3 3c0 1.657-1.343 3-3 3-0.067 0-0.133-0.003-0.198-0.007l-5.324 9.316c0.329 0.481 0.522 1.064 0.522 1.691 0 1.657-1.343 3-3 3s-3-1.343-3-3c0-0.604 0.179-1.167 0.487-1.638l-3.225-5.375c-0.086 0.007-0.174 0.012-0.262 0.012s-0.176-0.005-0.262-0.012l-3.225 5.375c0.307 0.471 0.487 1.033 0.487 1.637 0 1.657-1.343 3-3 3z",
 
  "bars":
  "M0 26h32v4h-32zM4 18h4v6h-4zM10 10h4v14h-4zM16 16h4v8h-4zM22 4h4v20h-4z",
 
  "bars2":
  "M9 12h-6c-0.55 0-1 0.45-1 1v18c0 0.55 0.45 1 1 1h6c0.55 0 1-0.45 1-1v-18c0-0.55-0.45-1-1-1zM9 30h-6v-8h6v8zM19 8h-6c-0.55 0-1 0.45-1 1v22c0 0.55 0.45 1 1 1h6c0.55 0 1-0.45 1-1v-22c0-0.55-0.45-1-1-1zM19 30h-6v-10h6v10zM29 4h-6c-0.55 0-1 0.45-1 1v26c0 0.55 0.45 1 1 1h6c0.55 0 1-0.45 1-1v-26c0-0.55-0.45-1-1-1zM29 30h-6v-12h6v12z",
 
  "lab":
  "M29.884 25.14l-9.884-16.47v-6.671h1c0.55 0 1-0.45 1-1s-0.45-1-1-1h-10c-0.55 0-1 0.45-1 1s0.45 1 1 1h1v6.671l-9.884 16.47c-2.264 3.773-0.516 6.86 3.884 6.86h20c4.4 0 6.148-3.087 3.884-6.86zM7.532 20l6.468-10.779v-7.221h4v7.221l6.468 10.779h-16.935z",
 
  "remove":
  "M6 32h20l2-22h-24zM20 4v-4h-8v4h-10v6l2-2h24l2 2v-6h-10zM18 4h-4v-2h4v2z",
 
  "switch":
  "M20 4.581v4.249c1.131 0.494 2.172 1.2 3.071 2.099 1.889 1.889 2.929 4.4 2.929 7.071s-1.040 5.182-2.929 7.071c-1.889 1.889-4.4 2.929-7.071 2.929s-5.182-1.040-7.071-2.929c-1.889-1.889-2.929-4.4-2.929-7.071s1.040-5.182 2.929-7.071c0.899-0.899 1.94-1.606 3.071-2.099v-4.249c-5.783 1.721-10 7.077-10 13.419 0 7.732 6.268 14 14 14s14-6.268 14-14c0-6.342-4.217-11.698-10-13.419zM14 0h4v16h-4z",
 
  "tree":
  "M30.5 24h-0.5v-6.5c0-1.93-1.57-3.5-3.5-3.5h-8.5v-4h0.5c0.825 0 1.5-0.675 1.5-1.5v-5c0-0.825-0.675-1.5-1.5-1.5h-5c-0.825 0-1.5 0.675-1.5 1.5v5c0 0.825 0.675 1.5 1.5 1.5h0.5v4h-8.5c-1.93 0-3.5 1.57-3.5 3.5v6.5h-0.5c-0.825 0-1.5 0.675-1.5 1.5v5c0 0.825 0.675 1.5 1.5 1.5h5c0.825 0 1.5-0.675 1.5-1.5v-5c0-0.825-0.675-1.5-1.5-1.5h-0.5v-6h8v6h-0.5c-0.825 0-1.5 0.675-1.5 1.5v5c0 0.825 0.675 1.5 1.5 1.5h5c0.825 0 1.5-0.675 1.5-1.5v-5c0-0.825-0.675-1.5-1.5-1.5h-0.5v-6h8v6h-0.5c-0.825 0-1.5 0.675-1.5 1.5v5c0 0.825 0.675 1.5 1.5 1.5h5c0.825 0 1.5-0.675 1.5-1.5v-5c0-0.825-0.675-1.5-1.5-1.5zM6 30h-4v-4h4v4zM18 30h-4v-4h4v4zM14 8v-4h4v4h-4zM30 30h-4v-4h4v4z",
 
  "cloud":
  "M32 20.548c0-2.565-1.771-4.716-4.156-5.296-0.101-4.022-3.389-7.252-7.433-7.252-2.369 0-4.477 1.109-5.839 2.835-0.764-0.987-1.959-1.624-3.303-1.624-2.307 0-4.176 1.871-4.176 4.179 0 0.201 0.015 0.399 0.043 0.592-0.351-0.063-0.711-0.098-1.080-0.098-3.344-0-6.054 2.712-6.054 6.058s2.71 6.058 6.054 6.058l20.508-0c3.004-0.006 5.438-2.444 5.438-5.451z",
 
  "download":
  "M23 14l-8 8-8-8h5v-12h6v12zM15 22h-15v8h30v-8h-15zM28 26h-4v-2h4v2z",
 
  "earth":
  "M27.314 4.686c3.022 3.022 4.686 7.040 4.686 11.314s-1.664 8.292-4.686 11.314c-3.022 3.022-7.040 4.686-11.314 4.686s-8.292-1.664-11.314-4.686c-3.022-3.022-4.686-7.040-4.686-11.314s1.664-8.292 4.686-11.314c3.022-3.022 7.040-4.686 11.314-4.686s8.292 1.664 11.314 4.686zM25.899 25.9c1.971-1.971 3.281-4.425 3.821-7.096-0.421 0.62-0.824 0.85-1.073-0.538-0.257-2.262-2.335-0.817-3.641-1.621-1.375 0.927-4.466-1.802-3.941 1.276 0.81 1.388 4.375-1.858 2.598 1.079-1.134 2.050-4.145 6.592-3.753 8.946 0.049 3.43-3.504 0.715-4.729-0.422-0.824-2.279-0.281-6.262-2.434-7.378-2.338-0.102-4.344-0.314-5.25-2.927-0.545-1.87 0.58-4.653 2.584-5.083 2.933-1.843 3.98 2.158 6.731 2.232 0.854-0.894 3.182-1.178 3.375-2.18-1.805-0.318 2.29-1.517-0.173-2.199-1.358 0.16-2.234 1.409-1.512 2.467-2.632 0.614-2.717-3.809-5.247-2.414-0.064 2.206-4.132 0.715-1.407 0.268 0.936-0.409-1.527-1.594-0.196-1.379 0.654-0.036 2.854-0.807 2.259-1.325 1.225-0.761 2.255 1.822 3.454-0.059 0.866-1.446-0.363-1.713-1.448-0.98-0.612-0.685 1.080-2.165 2.573-2.804 0.497-0.213 0.973-0.329 1.336-0.296 0.752 0.868 2.142 1.019 2.215-0.104-1.862-0.892-3.915-1.363-6.040-1.363-3.051 0-5.952 0.969-8.353 2.762 0.645 0.296 1.012 0.664 0.39 1.134-0.483 1.439-2.443 3.371-4.163 3.098-0.893 1.54-1.482 3.238-1.733 5.017 1.441 0.477 1.773 1.42 1.464 1.736-0.734 0.64-1.185 1.548-1.418 2.541 0.469 2.87 1.818 5.515 3.915 7.612 2.644 2.644 6.16 4.1 9.899 4.1s7.255-1.456 9.899-4.1z",
 
  "heart":
  "M32 11.192c0 2.699-1.163 5.126-3.015 6.808h0.015l-10 10c-1 1-2 2-3 2s-2-1-3-2l-9.985-10c-1.852-1.682-3.015-4.109-3.015-6.808 0-5.077 4.116-9.192 9.192-9.192 2.699 0 5.126 1.163 6.808 3.015 1.682-1.852 4.109-3.015 6.808-3.015 5.077 0 9.192 4.116 9.192 9.192z",
 
  "smiley":
  "M16 32c8.837 0 16-7.163 16-16s-7.163-16-16-16-16 7.163-16 16 7.163 16 16 16zM16 3c7.18 0 13 5.82 13 13s-5.82 13-13 13-13-5.82-13-13 5.82-13 13-13zM8 10c0-1.105 0.895-2 2-2s2 0.895 2 2c0 1.105-0.895 2-2 2s-2-0.895-2-2zM20 10c0-1.105 0.895-2 2-2s2 0.895 2 2c0 1.105-0.895 2-2 2s-2-0.895-2-2zM22.003 19.602l2.573 1.544c-1.749 2.908-4.935 4.855-8.576 4.855s-6.827-1.946-8.576-4.855l2.573-1.544c1.224 2.036 3.454 3.398 6.003 3.398s4.779-1.362 6.003-3.398z",
 
  "close":
  "M31.708 25.708c-0-0-0-0-0-0l-9.708-9.708 9.708-9.708c0-0 0-0 0-0 0.105-0.105 0.18-0.227 0.229-0.357 0.133-0.356 0.057-0.771-0.229-1.057l-4.586-4.586c-0.286-0.286-0.702-0.361-1.057-0.229-0.13 0.048-0.252 0.124-0.357 0.228 0 0-0 0-0 0l-9.708 9.708-9.708-9.708c-0-0-0-0-0-0-0.105-0.104-0.227-0.18-0.357-0.228-0.356-0.133-0.771-0.057-1.057 0.229l-4.586 4.586c-0.286 0.286-0.361 0.702-0.229 1.057 0.049 0.13 0.124 0.252 0.229 0.357 0 0 0 0 0 0l9.708 9.708-9.708 9.708c-0 0-0 0-0 0-0.104 0.105-0.18 0.227-0.229 0.357-0.133 0.355-0.057 0.771 0.229 1.057l4.586 4.586c0.286 0.286 0.702 0.361 1.057 0.229 0.13-0.049 0.252-0.124 0.357-0.229 0-0 0-0 0-0l9.708-9.708 9.708 9.708c0 0 0 0 0 0 0.105 0.105 0.227 0.18 0.357 0.229 0.356 0.133 0.771 0.057 1.057-0.229l4.586-4.586c0.286-0.286 0.362-0.702 0.229-1.057-0.049-0.13-0.124-0.252-0.229-0.357z",
 
  "checkmark":
  "M27 4l-15 15-7-7-5 5 12 12 20-20z",
 
  "play":
  "M6 4l20 12-20 12z",
 
  "pause":
  "M4 4h10v24h-10zM18 4h10v24h-10z",
 
  "stop":
  "M4 4h24v24h-24z",
 
  "shuffle":
  "M32 8l-8-8v6c-4.087 0-7.211 0.975-9.552 2.982-0.164 0.141-0.321 0.284-0.474 0.43 0.86 1.193 1.522 2.422 2.118 3.597 1.51-1.825 3.689-3.008 7.907-3.008v12c-6.764 0-8.285-3.043-10.211-6.894-1.072-2.144-2.181-4.361-4.237-6.124-2.341-2.006-5.465-2.982-9.552-2.982v4c6.764 0 8.285 3.043 10.211 6.894 1.072 2.144 2.181 4.361 4.237 6.124 2.341 2.006 5.465 2.982 9.552 2.982v6l8-8-8-8 8-8zM0 22v4c4.087 0 7.211-0.975 9.552-2.982 0.164-0.141 0.321-0.284 0.474-0.43-0.86-1.193-1.522-2.422-2.118-3.597-1.51 1.825-3.689 3.009-7.907 3.009z",
 
  "arrow-up-right":
  "M16 0c-8.837 0-16 7.163-16 16s7.163 16 16 16 16-7.163 16-16-7.163-16-16-16zM16 29c-7.18 0-13-5.82-13-13s5.82-13 13-13 13 5.82 13 13-5.82 13-13 13zM12 8c-1.105 0-2 0.895-2 2s0.895 2 2 2h5.172l-8.586 8.586c-0.781 0.781-0.781 2.047 0 2.829 0.39 0.39 0.902 0.586 1.414 0.586s1.024-0.195 1.414-0.586l8.586-8.586v5.172c0 1.105 0.895 2 2 2s2-0.895 2-2v-12h-12z",
 
  "googleplus":
  "M0.025 27.177c-0.008-0.079-0.014-0.158-0.018-0.238 0.004 0.080 0.011 0.159 0.018 0.238zM7.372 17.661c2.875 0.086 4.804-2.897 4.308-6.662s-3.231-6.787-6.106-6.873c-2.876-0.085-4.804 2.796-4.308 6.562 0.496 3.765 3.23 6.887 6.106 6.973zM32 8v-2.666c0-2.934-2.399-5.334-5.333-5.334h-21.333c-2.884 0-5.25 2.32-5.33 5.185 1.824-1.606 4.354-2.947 6.965-2.947 2.791 0 11.164 0 11.164 0l-2.498 2.113h-3.54c2.348 0.9 3.599 3.629 3.599 6.429 0 2.351-1.307 4.374-3.153 5.812-1.801 1.403-2.143 1.991-2.143 3.184 0 1.018 1.93 2.75 2.938 3.462 2.949 2.079 3.904 4.010 3.904 7.233 0 0.513-0.064 1.026-0.19 1.53h9.617c2.934 0 5.333-2.398 5.333-5.334v-16.666h-6v6h-2v-6h-6v-2h6v-6h2v6h6zM5.809 23.936c0.675 0 1.294-0.018 1.936-0.018-0.848-0.823-1.52-1.831-1.52-3.074 0-0.738 0.236-1.448 0.567-2.079-0.337 0.024-0.681 0.031-1.035 0.031-2.324 0-4.297-0.752-5.756-1.995v2.101l0 6.304c1.67-0.793 3.653-1.269 5.809-1.269zM0.107 27.727c-0.035-0.171-0.061-0.344-0.079-0.52 0.018 0.176 0.045 0.349 0.079 0.52zM14.233 29.776c-0.471-1.838-2.139-2.749-4.465-4.361-0.846-0.273-1.778-0.434-2.778-0.444-2.801-0.030-5.41 1.092-6.882 2.762 0.498 2.428 2.657 4.267 5.226 4.267h8.951c0.057-0.348 0.084-0.707 0.084-1.076 0-0.392-0.048-0.775-0.137-1.148z",
 
  "facebook":
  "M17.996 32h-5.996v-16h-4v-5.514l4-0.002-0.007-3.248c0-4.498 1.22-7.236 6.519-7.236h4.412v5.515h-2.757c-2.064 0-2.163 0.771-2.163 2.209l-0.008 2.76h4.959l-0.584 5.514-4.37 0.002-0.004 16z",
 
  "twitter":
  "M26.667 0h-21.333c-2.934 0-5.334 2.4-5.334 5.334v21.332c0 2.936 2.4 5.334 5.334 5.334h21.333c2.934 0 5.333-2.398 5.333-5.334v-21.332c0-2.934-2.399-5.334-5.333-5.334zM26.189 10.682c0.010 0.229 0.015 0.46 0.015 0.692 0 7.069-5.288 15.221-14.958 15.221-2.969 0-5.732-0.886-8.059-2.404 0.411 0.050 0.83 0.075 1.254 0.075 2.463 0 4.73-0.855 6.529-2.29-2.3-0.043-4.242-1.59-4.911-3.715 0.321 0.063 0.65 0.096 0.989 0.096 0.479 0 0.944-0.066 1.385-0.188-2.405-0.492-4.217-2.654-4.217-5.245 0-0.023 0-0.045 0-0.067 0.709 0.401 1.519 0.641 2.381 0.669-1.411-0.959-2.339-2.597-2.339-4.453 0-0.98 0.259-1.899 0.712-2.689 2.593 3.237 6.467 5.366 10.836 5.589-0.090-0.392-0.136-0.8-0.136-1.219 0-2.954 2.354-5.349 5.257-5.349 1.512 0 2.879 0.65 3.838 1.689 1.198-0.24 2.323-0.685 3.338-1.298-0.393 1.249-1.226 2.298-2.311 2.96 1.063-0.129 2.077-0.417 3.019-0.842-0.705 1.073-1.596 2.015-2.623 2.769z",
 
  "github":
  "M16 0c-8.837 0-16 7.163-16 16s7.163 16 16 16 16-7.163 16-16-7.163-16-16-16zM25.502 25.502c-1.235 1.235-2.672 2.204-4.272 2.881-0.406 0.172-0.819 0.323-1.238 0.453v-2.398c0-1.26-0.432-2.188-1.297-2.781 0.542-0.052 1.039-0.125 1.492-0.219s0.932-0.229 1.438-0.406 0.958-0.388 1.359-0.633 0.786-0.563 1.156-0.953 0.68-0.833 0.93-1.328 0.448-1.089 0.594-1.781 0.219-1.456 0.219-2.289c0-1.615-0.526-2.99-1.578-4.125 0.479-1.25 0.427-2.609-0.156-4.078l-0.391-0.047c-0.271-0.031-0.758 0.083-1.461 0.344s-1.492 0.688-2.367 1.281c-1.24-0.344-2.526-0.516-3.859-0.516-1.344 0-2.625 0.172-3.844 0.516-0.552-0.375-1.075-0.685-1.57-0.93s-0.891-0.411-1.188-0.5-0.573-0.143-0.828-0.164-0.419-0.026-0.492-0.016-0.125 0.021-0.156 0.031c-0.583 1.479-0.635 2.839-0.156 4.078-1.052 1.135-1.578 2.51-1.578 4.125 0 0.833 0.073 1.596 0.219 2.289s0.344 1.286 0.594 1.781 0.56 0.938 0.93 1.328 0.755 0.708 1.156 0.953 0.854 0.456 1.359 0.633 0.984 0.313 1.438 0.406 0.95 0.167 1.492 0.219c-0.854 0.583-1.281 1.51-1.281 2.781v2.445c-0.472-0.14-0.937-0.306-1.394-0.5-1.6-0.677-3.037-1.646-4.272-2.881s-2.204-2.672-2.881-4.272c-0.7-1.655-1.055-3.414-1.055-5.23s0.355-3.575 1.055-5.23c0.677-1.6 1.646-3.037 2.881-4.272s2.672-2.204 4.272-2.881c1.655-0.7 3.415-1.055 5.23-1.055s3.575 0.355 5.23 1.055c1.6 0.677 3.037 1.646 4.272 2.881s2.204 2.672 2.881 4.272c0.7 1.655 1.055 3.415 1.055 5.23s-0.355 3.575-1.055 5.23c-0.677 1.6-1.646 3.037-2.881 4.272z",
 
  "tumblr":
  "M26.668 0h-21.334c-2.934 0-5.334 2.4-5.334 5.334v21.332c0 2.936 2.4 5.334 5.334 5.334h21.334c2.933 0 5.332-2.398 5.332-5.334v-21.332c-0-2.933-2.399-5.334-5.332-5.334zM22.866 25.771c-0.942 0.443-1.798 0.756-2.563 0.936-0.765 0.178-1.593 0.267-2.481 0.267-1.010 0-1.605-0.127-2.381-0.381-0.775-0.256-1.438-0.621-1.984-1.090-0.549-0.473-0.928-0.975-1.14-1.506s-0.317-1.303-0.317-2.313v-7.744h-3v-3.127c0.867-0.281 1.873-0.685 2.49-1.211 0.62-0.527 1.116-1.158 1.49-1.896 0.375-0.736 0.633-1.676 0.774-2.815h3.141v5.108h5.105v3.941h-5.106v5.662c0 1.281-0.017 2.020 0.119 2.383 0.135 0.361 0.473 0.736 0.841 0.953 0.489 0.293 1.047 0.439 1.676 0.439 1.118 0 2.231-0.363 3.336-1.090v3.482z",
 
  "apple":
  "M24.734 17.003c-0.040-4.053 3.305-5.996 3.454-6.093-1.88-2.751-4.808-3.127-5.851-3.171-2.492-0.252-4.862 1.467-6.127 1.467-1.261 0-3.213-1.43-5.28-1.392-2.716 0.040-5.221 1.579-6.619 4.012-2.822 4.897-0.723 12.151 2.028 16.123 1.344 1.944 2.947 4.127 5.051 4.049 2.026-0.081 2.793-1.311 5.242-1.311s3.138 1.311 5.283 1.271c2.18-0.041 3.562-1.981 4.897-3.931 1.543-2.255 2.179-4.439 2.216-4.551-0.048-0.022-4.252-1.632-4.294-6.473zM20.705 5.11c1.117-1.355 1.871-3.235 1.665-5.11-1.609 0.066-3.559 1.072-4.713 2.423-1.036 1.199-1.942 3.113-1.699 4.951 1.796 0.14 3.629-0.913 4.747-2.264z",
 
  "android":
  "M27 10c-1.1 0-2 0.9-2 2v8c0 1.1 0.9 2 2 2s2-0.9 2-2v-8c0-1.1-0.9-2-2-2zM3 10c-1.1 0-2 0.9-2 2v8c0 1.1 0.9 2 2 2s2-0.9 2-2v-8c0-1.1-0.9-2-2-2zM6 23c0 1.657 1.343 3 3 3h1v4c0 1.1 0.9 2 2 2s2-0.9 2-2v-4h2v4c0 1.1 0.9 2 2 2s2-0.9 2-2v-4h1c1.657 0 3-1.343 3-3v-11h-18v11zM18.706 2.797l1.266-2.431c0.064-0.122 0.016-0.274-0.106-0.337s-0.274-0.016-0.337 0.106l-1.285 2.468c-1.006-0.389-2.1-0.603-3.244-0.603s-2.237 0.214-3.244 0.603l-1.285-2.468c-0.063-0.122-0.215-0.17-0.337-0.106s-0.17 0.215-0.106 0.337l1.266 2.432c-2.832 1.282-4.883 3.987-5.238 7.203h17.889c-0.355-3.216-2.406-5.921-5.238-7.203zM11 8.45c-0.801 0-1.45-0.649-1.45-1.45s0.649-1.45 1.45-1.45 1.45 0.649 1.45 1.45c-0 0.801-0.649 1.45-1.45 1.45zM19 8.45c-0.801 0-1.45-0.649-1.45-1.45s0.649-1.45 1.45-1.45 1.45 0.649 1.45 1.45c0 0.801-0.649 1.45-1.45 1.45z",
 
  "windows8":
  "M0.011 16l-0.011-9.752 12-1.63v11.382zM14 4.328l15.996-2.328v14h-15.996zM30 18l-0.004 14-15.996-2.25v-11.75zM12 29.495l-11.99-1.644-0.001-9.851h11.991z",
 
  "html5":
  "M1.892 0l2.567 28.801 11.524 3.199 11.554-3.204 2.572-28.796h-28.216zM24.52 9.42h-13.517l0.322 3.617h12.874l-0.97 10.844-7.245 2.008-7.237-2.008-0.495-5.547h3.547l0.252 2.82 3.933 1.060 0.009-0.002 3.935-1.062 0.408-4.58h-12.242l-0.953-10.681h17.694l-0.316 3.532z",
 
  "chrome":
  "M8.071 13.954l-4.579-7.931c2.932-3.671 7.445-6.023 12.508-6.023 5.857 0 10.978 3.148 13.767 7.844h-13.055c-0.235-0.020-0.472-0.031-0.711-0.031-3.809 0-7.018 2.614-7.929 6.142zM21.728 10.156h9.171c0.711 1.81 1.101 3.781 1.101 5.844 0 8.776-7.066 15.9-15.818 15.998l6.544-11.334c0.921-1.324 1.462-2.932 1.462-4.664 0-2.287-0.943-4.357-2.459-5.844zM10.188 16c0-3.205 2.607-5.813 5.813-5.813s5.813 2.607 5.813 5.813c0 3.205-2.608 5.813-5.813 5.813s-5.813-2.608-5.813-5.813zM18.193 23.889l-4.581 7.934c-7.704-1.153-13.613-7.797-13.613-15.822 0-2.851 0.746-5.526 2.053-7.845l6.532 11.314c1.308 2.785 4.14 4.718 7.415 4.718 0.759 0 1.495-0.104 2.193-0.299z",
 
  "firefox":
  "M31.954 10.442l-0.371 2.377c0 0-0.53-4.402-1.179-6.047-0.995-2.521-1.438-2.501-1.441-2.498 0.667 1.694 0.546 2.604 0.546 2.604s-1.181-3.219-4.303-4.243c-3.459-1.134-5.33-0.824-5.547-0.765-0.033-0-0.064-0-0.095-0 0.026 0.002 0.050 0.005 0.076 0.007-0.001 0.001-0.003 0.001-0.003 0.002 0.014 0.017 3.822 0.666 4.497 1.594 0 0-1.617 0-3.227 0.464-0.073 0.021 5.923 0.749 7.148 6.74 0 0-0.657-1.371-1.47-1.604 0.535 1.626 0.397 4.712-0.112 6.245-0.066 0.197-0.133-0.853-1.135-1.305 0.321 2.301-0.019 5.952-1.616 6.957-0.124 0.078 1.001-3.603 0.226-2.18-4.46 6.838-9.731 3.155-12.101 1.535 1.215 0.264 3.52-0.041 4.541-0.8 0.001-0.001 0.002-0.002 0.004-0.003 1.108-0.758 1.765-1.311 2.354-1.18s0.982-0.46 0.524-0.985c-0.459-0.526-1.572-1.249-3.079-0.855-1.063 0.278-2.379 1.454-4.389 0.264-1.543-0.914-1.688-1.673-1.702-2.199 0.038-0.186 0.086-0.361 0.143-0.52 0.178-0.496 0.716-0.646 1.015-0.764 0.508 0.087 0.946 0.246 1.405 0.481 0.006-0.153 0.008-0.356-0.001-0.586 0.044-0.088 0.017-0.352-0.054-0.674-0.041-0.322-0.107-0.655-0.211-0.959 0-0 0.001-0 0.001-0 0.002-0.001 0.003-0.001 0.005-0.002s0.005-0.004 0.007-0.006c0-0.001 0.001-0.001 0.001-0.002 0.003-0.004 0.005-0.008 0.006-0.015 0.032-0.144 0.376-0.423 0.804-0.722 0.383-0.268 0.834-0.553 1.19-0.774 0.314-0.195 0.554-0.34 0.605-0.378 0.019-0.015 0.042-0.032 0.068-0.051 0.005-0.004 0.009-0.007 0.014-0.011 0.003-0.002 0.006-0.005 0.009-0.007 0.169-0.135 0.421-0.389 0.474-0.924 0-0.001 0-0.002 0-0.004 0.002-0.016 0.003-0.032 0.004-0.048 0.001-0.011 0.002-0.023 0.002-0.034 0-0.009 0.001-0.018 0.001-0.027 0.001-0.021 0.002-0.043 0.002-0.065 0-0.001 0-0.002 0-0.004 0.001-0.052-0-0.106-0.003-0.163-0.002-0.032-0.004-0.060-0.009-0.086-0-0.001-0.001-0.003-0.001-0.004-0.001-0.003-0.001-0.005-0.002-0.008-0.001-0.005-0.002-0.009-0.004-0.013-0-0.001-0-0.001-0.001-0.001-0.002-0.005-0.004-0.010-0.005-0.014-0-0-0-0-0-0.001-0.055-0.128-0.26-0.177-1.108-0.191-0.001-0-0.002-0-0.002-0v0c-0.346-0.006-0.798-0.006-1.391-0.004-1.039 0.004-1.613-1.016-1.797-1.41 0.251-1.389 0.977-2.379 2.17-3.051 0.023-0.013 0.018-0.023-0.009-0.031 0.233-0.141-2.82-0.004-4.225 1.782-1.247-0.31-2.333-0.289-3.269-0.069-0.18-0.005-0.404-0.027-0.67-0.083-0.623-0.564-1.514-1.606-1.562-2.85 0 0-0.003 0.002-0.008 0.006-0.001-0.012-0.002-0.024-0.002-0.036 0 0-1.897 1.458-1.613 5.434-0.001 0.064-0.002 0.125-0.004 0.184-0.514 0.696-0.768 1.282-0.787 1.411-0.455 0.926-0.917 2.32-1.292 4.437 0 0 0.263-0.833 0.79-1.777-0.388 1.188-0.693 3.036-0.514 5.808 0 0 0.047-0.615 0.215-1.5 0.131 1.719 0.704 3.841 2.152 6.337 2.78 4.791 7.052 7.211 11.775 7.582 0.839 0.069 1.689 0.071 2.544 0.006 0.079-0.006 0.157-0.011 0.236-0.018 0.968-0.068 1.942-0.214 2.914-0.449 13.287-3.212 11.842-19.256 11.842-19.256z",
 
  "IE":
  "M22.944 19.651h7.377c0.057-0.512 0.080-1.034 0.080-1.569 0-2.507-0.673-4.858-1.848-6.883 1.215-3.228 1.172-5.968-0.455-7.606-1.547-1.54-5.697-1.29-10.388 0.787-0.347-0.026-0.697-0.040-1.051-0.040-6.439 0-11.841 4.431-13.335 10.402 2.020-2.586 4.145-4.461 6.984-5.826-0.258 0.242-1.764 1.739-2.018 1.993-7.486 7.484-9.847 17.26-7.306 19.8 1.931 1.93 5.43 1.604 9.449-0.364 1.869 0.952 3.984 1.488 6.226 1.488 6.035 0 11.15-3.885 13.003-9.295h-7.433c-1.023 1.887-3.023 3.171-5.319 3.171s-4.296-1.284-5.319-3.171c-0.455-0.852-0.716-1.83-0.716-2.864v-0.023h12.071zM10.884 16.025c0.171-3.035 2.694-5.456 5.774-5.456s5.604 2.421 5.774 5.456h-11.548zM28.030 5.119c1.048 1.059 1.021 3.007 0.125 5.438-1.535-2.341-3.766-4.186-6.4-5.239 2.816-1.207 5.106-1.367 6.274-0.199zM2.921 30.227c-1.337-1.337-0.934-4.144 0.788-7.526 1.072 3.008 3.161 5.534 5.854 7.161-2.982 1.354-5.423 1.584-6.643 0.365z",
 
  "opera":
  "M15.939 0c-8.741 0-15.023 6.34-15.023 15.851 0 8.463 6.109 16.149 15.024 16.149 9.002 0 15.144-7.684 15.144-16.149 0-9.586-6.483-15.851-15.146-15.851zM21.511 15.579c-0.002 5.292-0.284 12.828-5.571 12.828v0.001c-5.212 0-5.42-7.54-5.42-12.822 0-6.199 0.58-12.143 5.42-12.143s5.571 6.018 5.571 12.136z",
 
  "safari":
  "M16 2c-0.752 0-1.491 0.056-2.213 0.163-0.009-0.024-0.020-0.048-0.031-0.072 0.401-0.313 0.611-0.745 0.52-1.173-0.117-0.549-0.7-0.918-1.451-0.918-0.162 0-0.327 0.018-0.49 0.052-0.943 0.2-1.567 0.894-1.421 1.58 0.089 0.417 0.447 0.729 0.943 0.856-0.001 0.030-0.001 0.061 0.001 0.092-6.269 1.798-10.857 7.573-10.857 14.42 0 8.284 6.716 15 15 15s15-6.716 15-15c0-8.284-6.716-15-15-15zM11.403 1.528c-0.085-0.398 0.39-0.85 1.036-0.987 0.129-0.027 0.259-0.041 0.386-0.041 0.501 0 0.897 0.215 0.962 0.522 0.050 0.235-0.096 0.488-0.356 0.684-0.22-0.155-0.501-0.223-0.784-0.162-0.283 0.060-0.511 0.235-0.649 0.464-0.318-0.077-0.547-0.253-0.595-0.48zM24.043 25.043c-1.374 1.374-3.038 2.352-4.853 2.88l-1.325-2.149-0.336 2.499c-0.503 0.067-1.013 0.102-1.529 0.102-3.038 0-5.895-1.183-8.043-3.332-1.374-1.374-2.352-3.038-2.88-4.853l2.149-1.325-2.499-0.336c-0.067-0.503-0.102-1.013-0.102-1.529 0-3.038 1.183-5.895 3.332-8.043 1.374-1.374 3.038-2.352 4.853-2.88l1.325 2.149 0.336-2.499c0.503-0.067 1.013-0.102 1.529-0.102 3.038 0 5.895 1.183 8.043 3.332 1.374 1.374 2.352 3.038 2.88 4.853l-2.149 1.325 2.499 0.336c0.067 0.503 0.102 1.013 0.102 1.529 0 3.038-1.183 5.895-3.332 8.043zM23.778 9.222l-6.156 4.678c-0.458-0.239-0.965-0.377-1.482-0.398l-1.596-3.349-0.096 3.708c-0.415 0.204-0.784 0.489-1.090 0.842l-1.972-0.699 1.44 1.517c-0.198 0.422-0.308 0.876-0.326 1.338l-3.349 1.596 3.711 0.096c0.012 0.024 0.024 0.048 0.037 0.071l-4.678 6.156 6.156-4.678c0.458 0.239 0.965 0.377 1.482 0.398l1.596 3.349 0.096-3.708c0.415-0.204 0.785-0.489 1.090-0.842l1.972 0.699-1.44-1.517c0.198-0.422 0.308-0.876 0.326-1.338l3.349-1.596-3.71-0.096c-0.012-0.024-0.024-0.048-0.037-0.071l4.678-6.156zM16.003 13.892v0zM15.376 14.066c0.21-0.045 0.42-0.066 0.627-0.066 0.13 0 0.258 0.008 0.384 0.025l0.003 0.001-0-0.001c0.273 0.036 0.537 0.109 0.785 0.216l-2.236 1.699-1.699 2.236c-0.074-0.175-0.133-0.359-0.174-0.552-0.345-1.621 0.69-3.214 2.311-3.558zM17.566 19.559v0 0c-0.283 0.173-0.599 0.303-0.942 0.376-0.21 0.045-0.42 0.066-0.627 0.066-0.13 0-0.258-0.009-0.385-0.025l-0.002-0c-0.273-0.036-0.537-0.109-0.785-0.215l2.236-1.699 1.699-2.236c0.074 0.175 0.133 0.359 0.174 0.552 0.272 1.278-0.314 2.538-1.368 3.183z"
};
 
 
Code coverage report for node-npmtest-gojs/node_modules/gojs/samples/indexList.js

npmtest-gojs (v0.0.1)

Code coverage report for node-npmtest-gojs/node_modules/gojs/samples/indexList.js

Statements: 100% (186 / 186)      Branches: 100% (0 / 0)      Functions: 100% (0 / 0)      Lines: 100% (186 / 186)      Ignored: none     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546                  1                                                                                         1     1               1               1               1               1             1               1               1                 1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1             1               1               1               1               1                 1               1               1               1                 1               1               1               1               1               1               1               1                 1               1               1               1               1               1               1               1               1               1                 1               1               1               1               1               1                 1               1               1               1                 1               1               1               1               1               1               1               1               1               1                 1               1               1                 1               1               1               1               1                 1               1                 1               1               1               1               1               1                 1               1               1               1               1               1               1               1               1                   1               1               1               1               1               1               1               1                   1               1               1               1               1               1                 1             1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1                 1               1                 1               1               1               1               1               1               1               1               1               1               1               1               1               1                 1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1               1              
/**
 * Be sure to add any new samples to this list, to assets/js/goSamples.js, and to samples/all.html.
 */
 
/**
 * Full array of all tags
 * This is useful for both creating an initial tag list and keeping the list in a consistent order
 * in case we use tag filtering.
 */
var tags = [
  "all",
  "featured",
  "tables",
  "itemarrays",
  "collections",
  "links",
  "ports",
  "gridlayout",
  "treelayout",
  "forcedirectedlayout",
  "layereddigraphlayout",
  "circularlayout",
  "customlayout",
  "groups",
  "tooltips",
  "contextmenus",
  "tools",
  "palette",
  "overview",
  "buttons",
  "extensions",
  "geometries",
  "grid",
  "svg",
  "performance",
  "circle-like",
  "process",
  "monitoring",
  "gauges",
  "charts",
  "html",
  "inspector",
  "frameworks"
];
 
/**
 * Full array of all samples
 * Each sample is made up of:
 * [0]: relative path
 * [1]: title
 * [2]: description
 * [3]: screenshot name
 * [4]: tags
 */
var arr = [];
// SAMPLES
// Featured
arr.push([
  "flowchart",
  "Flowchart",
  "A standard flowchart, showing different node templates and several data bindings. Each node has 3 or 4 port elements. Links are orthogonal and avoid nodes.",
  "flowchart",
  ["featured", "palette", "svg", "process"]
]);
 
arr.push([
  "orgChartStatic",
  "OrgChart (Static)",
  "Shows an organizational chart, uses an in-laid Overview to aid the user in navigation, and allows the user to search by example.",
  "orgChartStatic",
  ["featured", "tables", "treelayout", "overview"]
]);
 
arr.push([
  "orgChartEditor",
  "OrgChart Editor",
  "An organizational chart that allows user editing and re-organizing of the hierarchy.",
  "orgChartEditor",
  ["featured", "tables", "treelayout", "contextmenus", "buttons", "inspector"]
]);
 
arr.push([
  "stateChart",
  "State Chart",
  "A state chart diagram that also shows dynamic creation of new nodes and links on a button press.",
  "stateChart",
  ["featured", "buttons", "process"]
]);
 
arr.push(["minimal",
  "Minimal",
  "Shows default Diagram interactivity and basic data binding. Select, move, copy, delete, undo, redo with keyboard or touch.",
  "minimal",
  ["featured"]
]);
 
arr.push([
  "basic",
  "Basic",
  "Shows many of the commands possible in GoJS, templates for Links and for Groups, plus tooltips and context menus for Nodes, for Links, for Groups, and for the Diagram.",
  "basic",
  ["featured", "groups", "tooltips", "contextmenus", "buttons"]
]);
 
arr.push([
  "shapes",
  "Shapes",
  "Showcases all pre-defined GoJS figures. You can define your own named Shape figures.",
  "shapes",
  ["featured", "gridlayout", "geometries"]
]);
 
arr.push([
  "icons",
  "SVG Icons",
  "Create your own custom Shapes using SVG path strings. This sample uses SVG strings from a free icon set.",
  "icons",
  ["featured", "gridlayout", "treelayout", "tooltips", "geometries", "svg"]
]);
 
// Commonly Used Charts/Diagrams
arr.push([
  "sankey",
  "Sankey",
  "Sankey diagrams show the amount of flow between nodes by the width of the links.",
  "sankey",
  ["links", "layereddigraphlayout", "customlayout"]
]);
 
arr.push([
  "PERT",
  "PERT",
  "A simple PERT chart, showcasing GoJS table panels and RowColumnDefinition properties.",
  "pert",
  ["tables", "layereddigraphlayout"]
]);
 
arr.push([
  "gantt",
  "Gantt",
  "Demonstrates a simple Gantt chart.",
  "gantt",
  ["grid"]
]);
 
arr.push([
  "euler",
  "Euler Diagram",
  "A read-only diagram where clicking on a node will open a new webpage.",
  "euler",
  ["extensions"]
]);
 
arr.push([
  "entityRelationship",
  "Entity Relationship",
  "An entity relationship diagram, showcasing data binding with item arrays.",
  "entityRelationship",
  ["tables", "itemarrays", "forcedirectedlayout", "buttons"]
]);
 
arr.push([
  "umlClass",
  "UML Class",
  "A UML Class diagram shows software classes and their properties and methods, and the relationships between them.",
  "umlClass",
  ["tables", "itemarrays", "treelayout", "buttons"]
]);
 
arr.push(["planogram",
  "Planogram",
  "Drag-and-drop items from the Palette onto racks in the Diagram.",
  "planogram",
  ["groups", "palette", "grid", "frameworks"]
]);
 
// Trees
arr.push([
  "classHierarchy",
  "Class Hierarchy",
  "Displays the GoJS Class Hierarchy as a series of trees. Double-click to go to the class's API documentation.",
  "classHierarchy",
  ["treelayout"]
]);
 
arr.push([
  "DOMTree",
  "DOM Tree",
  "Shows the DOM of this page displayed as a tree. Selection highlights the DOM element in the page.",
  "DOMTree",
  ["treelayout", "buttons"]
]);
 
arr.push([
  "visualTree",
  "Visual Tree",
  "This sample shows the actual visual tree of a running Diagram, using a second Diagram.",
  "visualTree",
  ["treelayout"]
]);
 
arr.push([
  "familyTree",
  "Family Tree",
  "Shows a standard family tree.",
  "familyTree",
  ["tables", "treelayout", "tooltips"]
]);
 
arr.push([
  "familyTreeJP",
  "Family Tree (Japanese)",
  "Shows a standard family tree.",
  "familyTreeJP",
  ["tables", "treelayout", "tooltips"]
]);
 
arr.push([
  "orgChartExtras",
  "Org Chart Extras",
  "Shows an org chart with extra links and expand/collapse functionality.",
  "orgChartExtras",
  ["tables", "treelayout", "tooltips", "buttons"]
]);
 
arr.push([
  "orgChartAssistants",
  "Org Chart Assistants",
  "Shows an org chart with assistant nodes at the side, above regular child nodes.",
  "orgChartAssistants",
  ["tables", "treelayout", "tooltips", "buttons"]
]);
 
arr.push([
  "localView",
  "Local View",
  "Two diagrams, the one on top showing a full tree and the one below focusing on a specific node in the tree and those nodes that are logically \"near\" it.",
  "localView",
  ["treelayout"]
]);
 
arr.push([
  "decisionTree",
  "Decision Tree",
  "Allows a user to make progressive decisions.",
  "decisionTree",
  ["treelayout", "tooltips", "buttons"]
]);
 
arr.push([
  "incrementalTree",
  "Incremental Tree",
  "Demonstrates the expansion of a tree where nodes are only created \"on-demand\", when the user clicks on the \"expand\" Button.",
  "incrementalTree",
  ["forcedirectedlayout", "buttons"]
]);
 
arr.push([
  "doubleTree",
  "Double Tree",
  "Displays a single diagram of two trees sharing a single root node growing in opposite directions, using two layouts.",
  "doubleTree",
  ["collections", "treelayout"]
]);
 
arr.push([
  "doubleTreeJSON",
  "Double Tree JSON",
  "Double Tree, loading JSON from server.",
  "doubleTree",
  ["collections", "treelayout", "frameworks"]
]);
 
arr.push([
  "mindMap",
  "Mind Map",
  "A Mind Map, a double-tree whose nodes have an \"add\" button when selected and a context menu.",
  "mindMap",
  ["collections", "treelayout", "contextmenus", "buttons"]
]);
 
arr.push([
  "tournament",
  "Tournament",
  "Tournament bracket with dynamic advancement as scores are entered.",
  "tournament",
  ["tables", "treelayout"]
]);
 
arr.push([
  "treeView",
  "Tree View",
  "Demonstrates a traditional \"Tree View\" in a GoJS diagram, with optional orthogonal links between the nodes.",
  "treeView",
  ["treelayout", "buttons"]
]);
 
arr.push([
  "triStateCheckBoxTree",
  "Tri-state CheckBox Tree",
  "Demonstrates a traditional \"Tree View\" in a GoJS diagram, where each item has a checkbox with three states.",
  "triStateCheckBoxTree",
  ["treelayout", "buttons"]
]);
 
arr.push([
  "treeMapper",
  "Tree Mapper",
  "Displays two trees, allowing the user to dynamically draw or reconnect links mapping one tree node to another.",
  "treeMapper",
  ["groups", "treelayout", "buttons"]]);
 
arr.push([
  "parseTree",
  "Parse Tree",
  "A Parse tree representing the syntactic structure of a sentence. The leaf nodes are shown in a horizontal line.",
  "parseTree",
  ["treelayout", "customlayout", "buttons"]
]);
 
arr.push([
  "pipeTree",
  "Pipe Tree",
  "A tree layout with rectangular nodes at alternating angles and no links.",
  "pipeTree",
  ["treelayout"]
]);
 
arr.push([
  "faultTree",
  "Fault Tree",
  "A fault tree diagram with collapsing/expanding subtrees and gates at each non-root node.",
  "faultTree",
  ["treelayout", "buttons"]
]);
 
arr.push([
  "IVRtree",
  "IVR Tree",
  "Diagram representation of an Interactive Voice Response Tree (IVR tree). Nodes may have a collapsible list of details.",
  "ivrTree",
  ["tables", "itemarrays", "treelayout", "buttons"]
]);
 
arr.push([
  "genogram",
  "Genogram",
  "A genogram or pedigree chart is an extended family tree diagram that show information about each person or each relationship.",
  "genogram",
  ["itemarrays", "collections", "layereddigraphlayout", "customlayout", "geometries"]
]);
 
// Graph Links
arr.push([
  "beatPaths",
  "Beat Paths",
  "Demonstrates reading JSON data describing the relative rankings of NFL teams at a particular moment in time and generating a diagram from that data.",
  "beatPaths",
  ["layereddigraphlayout"]
]);
 
arr.push([
  "conceptMap",
  "Concept Map",
  "A web of interlinked concepts displayed with a ForceDirected Layout, showcasing link labels.",
  "conceptMap",
  ["forcedirectedlayout"]
]);
 
arr.push([
  "pathAnimation",
  "Path Animation",
  "Animation of diagram parts (tokens) along link paths.",
  "pathAnimation",
  ["collections", "forcedirectedlayout"]
]);
 
arr.push([
  "distances",
  "Distances & Paths",
  "Show distances between two nodes and highlights one of all possible paths between the nodes.",
  "distances",
  ["collections", "forcedirectedlayout", "html"]
]);
 
// Linking
arr.push([
  "arrowheads",
  "Arrowheads",
  "Showcases all pre-defined Link arrowheads. You can define your own named arrowhead geometries.",
  "arrowheads",
  ["links", "circularlayout", "tooltips", "geometries", "circle-like"]
]);
 
arr.push([
  "relationships",
  "Relationships",
  "Shows how you can create custom renderings for Links by repeatedly drawing GraphObjects along the route.",
  "relationships",
  ["collections", "links", "treelayout", "geometries"]
]);
 
arr.push([
  "curviness",
  "Link Curviness",
  "An example customization of the Link.curviness property and having an arrowhead at the middle of the link route.",
  "curviness",
  ["links"]
]);
 
arr.push([
  "multiNodePathLinks",
  "Multi-Node Path Links",
  "Demonstrates custom routing for Links running through other Nodes.",
  "multiNodePathLinks",
  ["collections", "links"]
]);
 
arr.push([
  "taperedLinks",
  "Tapered Links",
  "Demonstrates a custom Geometry for Link paths.",
  "taperedLinks",
  ["links", "forcedirectedlayout", "geometries"]
]);
 
arr.push([
  "multiArrow",
  "Multiple Arrowheads",
  "A custom orthogonal Link that draws arrowheads at the end of each segment.",
  "multiArrow",
  ["links", "forcedirectedlayout", "geometries"]
]);
 
arr.push([
  "draggableLink",
  "Draggable Link",
  "Showcases draggable disconnectable links that can be connected by dropping one or both ends at a valid port.",
  "draggableLink",
  ["collections", "links", "tools", "palette", "geometries", "grid"]
]);
 
arr.push([
  "linksToLinks",
  "Links to Links",
  "Demonstrates the ability for a Link to appear to connect with another Link, using label nodes that belong to links. ",
  "linksToLinks",
  ["links"]
]);
 
// Grouping
arr.push([
  "navigation",
  "Navigation",
  "Displays relationships between different parts of a diagram.",
  "navigation",
  ["collections", "groups", "tooltips"]
]);
 
arr.push([
  "grouping",
  "Grouping",
  "Demonstrates subgraphs that are created only as groups are expanded.",
  "grouping",
  ["treelayout", "groups", "buttons"]
]);
 
arr.push([
  "regrouping",
  "Regrouping",
  "Allows the user to drag nodes, including groups, into and out of groups, both from the Palette as well as from within the Diagram.",
  "regrouping",
  ["gridlayout", "groups", "palette", "buttons"]
]);
 
arr.push([
  "roundedGroups",
  "Rounded Groups",
  "Demonstrates subgraphs that have rounded headers and rounded footers.",
  "roundedGroups",
  ["groups", "geometries"]
]);
 
arr.push([
  "kanban",
  "Kanban Board",
  "A Kanban board editor, allowing the categorization of editable tasks.",
  "kanban",
  ["tables", "gridlayout", "customlayout", "groups", "buttons", "process"]
]);
 
arr.push([
  "swimBands",
  "Layer Bands",
  "Layer Bands are automatically created for each \"layer\" of a TreeLayout, and run perpendicular to the layout.",
  "swimBands",
  ["itemarrays", "treelayout", "customlayout"]
]);
 
arr.push([
  "swimLanes",
  "Swim Lanes",
  "Demonstrates collapsible, resizable, re-orderable swimlanes, a kind of process-flow diagram, with custom dragging rules that disallow nodes from leaving their lane.",
  "swimLanes",
  ["tables", "gridlayout", "layereddigraphlayout", "customlayout", "groups", "tools", "buttons"]
]);
 
arr.push([
  "swimLanesVertical",
  "Swim Lanes Vertical",
  "Demonstrates collapsible, resizable, re-orderable swimlanes, a kind of process-flow diagram, with custom dragging rules that disallow nodes from leaving their lane.",
  "swimLanesVertical",
  ["tables", "gridlayout", "layereddigraphlayout", "customlayout", "groups", "tools", "buttons"]
]);
 
arr.push([
  "visualTreeGrouping",
  "Visual Tree Using Groups",
  "This shows the same visual tree using nested Groups instead of nodes and links.",
  "visualTreeGrouping",
  ["gridlayout", "treelayout", "groups"]
]);
 
arr.push([
  "sharedStates",
  "Shared States",
  "As an alternative to using Groups, this manages Nodes that simultaneously belong to multiple containers.",
  "sharedStates",
  ["collections", "customlayout", "groups", "tools"]
]);
 
// Layouts
arr.push([
  "gLayout",
  "Grid Layout",
  "Shows GridLayout and options. Places all of the Parts in a grid-like arrangement, ordered, spaced apart, and wrapping as needed.",
  "gLayout",
  ["gridlayout", "html"]
]);
 
arr.push([
  "tLayout",
  "Tree Layout",
  "Shows TreeLayout and options. Positions nodes of a tree-structured graph in layers (rows or columns). ",
  "tLayout",
  ["collections", "treelayout", "html"]
]);
 
arr.push([
  "fdLayout",
  "Force Directed",
  "Shows ForceDirectedLayout and options. Treats the graph as if it were a system of physical bodies with forces acting on them and between them.",
  "fdLayout",
  ["collections", "forcedirectedlayout", "html"]
]);
 
arr.push([
  "ldLayout",
  "Layered Digraph",
  "Shows LayeredDigraphLayout and options. Arranges nodes of directed graphs into layers (rows or columns).",
  "ldLayout",
  ["collections", "layereddigraphlayout", "html"]
]);
 
arr.push([
  "cLayout",
  "Circular Layout",
  "Shows CircularLayout and options. This layout positions nodes in a circular arrangement.",
  "cLayout",
  ["collections", "circularlayout", "circle-like", "html"]
]);
 
arr.push([
  "interactiveForce",
  "Interactive Force",
  "A continuous ForceDirectedLayout that occurs as the user drags around a node.",
  "interactiveForce",
  ["forcedirectedlayout", "customlayout"]
]);
 
// Circle-like
arr.push([
  "doubleCircle",
  "Double Circle",
  "Multiple circles using repeated CircularLayouts.",
  "doubleCircle",
  ["collections", "circularlayout", "circle-like"]
]);
 
arr.push([
  "friendWheel",
  "Friend Wheel",
  "Demonstrates a customized CircularLayout.",
  "friendWheel",
  ["circularlayout", "customlayout", "circle-like"]
]);
 
arr.push([
  "radial",
  "Recentering Radial",
  "Arrange people in circles around a central person, in layers according to distance from the central person.",
  "radial",
  ["collections", "tooltips", "circle-like", "customlayout", "extensions"]
]);
 
arr.push([
  "radialPartition",
  "Radial Partition",
  "Arrange people in rings around a central person, in layers according to distance from the central person.",
  "radialPartition",
  ["collections", "tooltips", "geometries", "circle-like", "customlayout", "extensions"]
]);
 
// Processes
arr.push([
  "pageFlow",
  "Page Flow",
  "A diagram representation of webpage flow.",
  "pageFlow",
  ["itemarrays", "layereddigraphlayout", "palette", "buttons", "process"]
]);
 
arr.push([
  "processFlow",
  "Process Flow",
  "Tanks, valves, and pipes, with animated flow in the pipes.",
  "processFlow",
  ["geometries", "grid", "process", "monitoring"]
]);
 
arr.push([
  "productionProcess",
  "Production Process",
  "Partially describes the production process for converting natural gas and oil byproducts into their end products.",
  "productionProcess",
  ["tooltips", "geometries", "svg", "process", "monitoring", "html"]
]);
 
arr.push([
  "systemDynamics",
  "System Dynamics",
  "A System Dynamics diagram shows the storages and flows of material in some system, and the factors that influence the rates of flow.",
  "systemDynamics",
  ["process"]
]);
 
arr.push([
  "sequentialFunction",
  "Sequential Function",
  "A sequence diagram that shows different node templates, LayeredDigraphLayout and in-place text editing.",
  "sequentialFunction",
  ["layereddigraphlayout", "process"]
]);
 
arr.push([
  "grafcet",
  "Grafcet Diagrams",
  "A Grafcet is a kind of sequential function chart used in automation design.",
  "grafcet",
  ["links", "tooltips", "tools", "buttons", "geometries", "process"]
]);
 
arr.push([
  "sequenceDiagram",
  "Sequence Diagram",
  "A sequence diagram illustrates how different processes interact with one-another and in what order.",
  "sequenceDiagram",
  ["links", "groups", "tools", "grid", "process"]
]);
 
arr.push([
  "logicCircuit",
  "Logic Circuit",
  "A functioning logic circuit diagram, which allows the user to make circuits using gates and wires.",
  "logicCircuit",
  ["tooltips", "palette", "grid", "process"]
]);
 
arr.push([
  "dataFlow",
  "Data Flow",
  "Show the processing steps involved in a database transformation or query, with labeled ports.",
  "dataFlow",
  ["tables", "layereddigraphlayout", "ports", "process"]
]);
 
arr.push([
  "dataFlowVertical",
  "Data Flow Vertical",
  "Same as Data Flow, but vertically oriented, and with slightly different styling.",
  "dataFlowVertical",
  ["tables", "layereddigraphlayout", "ports", "process"]
]);
 
// Ports
arr.push([
  "dynamicPorts",
  "Dynamic Ports",
  "Add ports to a selected node by clicking buttons or by using a context menu. Draw links by dragging between ports. If you select a link you can relink or reshape it.",
  "dynamicPorts",
  ["tables", "itemarrays", "links", "ports", "contextmenus", "buttons"]
]);
 
arr.push([
  "selectablePorts",
  "Selectable Ports",
  "A Node with ports that can be selected and deleted.",
  "selectablePorts",
  ["itemarrays", "ports", "geometries"]
]);
 
arr.push([
  "draggablePorts",
  "Draggable Ports",
  "A Group with Nodes acting as ports that can be dragged within and between nodes.",
  "draggablePorts",
  ["ports", "customlayout", "groups", "geometries"]
]);
 
// Charts
arr.push([
  "barCharts",
  "Bar Charts",
  "Simple bar charts or histograms within nodes.",
  "barCharts",
  ["tables", "itemarrays", "tooltips", "charts" ]
]);
 
arr.push([
  "pieCharts",
  "Pie Charts",
  "Simple pie charts within nodes.",
  "pieCharts",
  ["itemarrays", "tooltips", "geometries", "charts"]
]);
 
arr.push([
  "candlestickCharts",
  "Candlestick Charts",
  "Simple candlestick or range charts within nodes.",
  "candlestickCharts",
  ["tables", "itemarrays", "geometries", "charts"]
]);
 
arr.push([
  "sparklineGraphs",
  "Sparkline Graphs",
  "Simple sparkline charts within nodes.",
  "sparklineGraphs",
  ["treelayout", "geometries", "charts"]
]);
 
arr.push([
  "dynamicPieChart",
  "Dynamic Pie Chart",
  "Dynamic pie chart with selectable slices that can change size.",
  "dynamicPieChart",
  ["tables", "itemarrays", "collections", "tooltips", "buttons", "geometries", "charts"]
]);
 
// Gauges
arr.push([
  "thermometer",
  "Thermometer",
  "Graduated thermometer scales using Graduated Panel.",
  "thermometer",
  ["gauges", "geometries"]
]);
 
arr.push([
  "instrumentGauge",
  "Instrument Gauge",
  "A gauge using a scale made with a Graduated Panel.",
  "instrumentGauge",
  ["gauges", "geometries"]
]);
 
// HTML
arr.push([
  "contentAlign",
  "Content Alignment",
  "Showcases alignment properties of the Diagram.",
  "contentAlign",
  ["html"]
]);
 
arr.push([
  "htmlInteraction",
  "HTML Interaction",
  "Contains two draggable HTML elements (using jQuery UI). One of the two HTML elements houses a panel that interacts with the main Diagram.",
  "htmlInteraction",
  ["palette", "html", "inspector", "frameworks"]
]);
 
arr.push([
  "customTextEditingTool",
  "Custom Text Editor",
  "Demonstrates using a custom HTML element for in-place editing of a TextBlock.",
  "customTextEditingTool",
  ["html"]
]);
 
arr.push([
  "customContextMenu",
  "Context Menu",
  "Demonstrates the implementation of a custom HTML context menu.",
  "customContextMenu",
  ["contextmenus", "html"]
]);
 
arr.push([
  "canvases",
  "Canvases",
  "Shows how HTML Canvas Elements, such as those created from other libraries, can be used inside of GoJS as Pictures.",
  "canvases",
  ["palette", "html", "frameworks"]
]);
 
arr.push([
  "dataVisualization",
  "Data Visualization",
  "A data-visualization demonstration that showcases GoJS interacting with other elements on the page.",
  "dataVisualization",
  ["tooltips", "html"]
]);
 
// Other
arr.push([
  "leaflet",
  "GoJS and Leaflet Map",
  "A GoJS diagram atop a Leaflet.js map, with nodes placed at latitude and longitude based locations.",
  "leaflet",
  ["tooltips", "tools"]
]);
 
arr.push([
  "seatingChart",
  "Seating Chart",
  "This sample demonstrates custom logic in a GoJS diagram - a \"Person\" node can be dropped onto a \"Table\" node, causing the person to be assigned a position at the closest empty seat at that table.",
  "seatingChart",
  ["tools", "palette"]
]);
 
arr.push([
  "pipes",
  "Pipes",
  "Showcasing nodes (Pipes) that can be joined, and will snap and drag together.",
  "pipes",
  ["itemarrays", "collections", "contextmenus", "tools", "palette", "buttons", "geometries"]
]);
 
arr.push([
  "adornmentButtons",
  "Adornment Buttons",
  "Selected nodes show a row of buttons that execute commands or start tools.",
  "adornmentButtons",
  ["buttons", "geometries"]
]);
 
arr.push([
  "timeline",
  "Timeline",
  "A simple timeline with events arranged along a line.",
  "timeline",
  ["tables", "itemarrays", "links", "customlayout", "grid"]
]);
 
arr.push([
  "ruleredDiagram",
  "Rulered Diagram",
  "A diagram with Graduated Panels at the edges acting as rulers.",
  "ruleredDiagram",
  ["geometries", "grid"]
]);
 
arr.push([
  "shopFloorMonitor",
  "Shop Floor Monitor",
  "Shows the continuously updating state of a number of stations on an imaginary shop floor.",
  "shopFloorMonitor",
  ["monitoring"]
]);
 
arr.push([
  "kittenMonitor",
  "Kitten Monitor",
  "A monitoring diagram where the nodes (kittens) move about a house, with tooltips for each kitten.",
  "kittenMonitor",
  ["tooltips", "monitoring"]
]);
 
arr.push([
  "spreadsheet",
  "Spreadsheet",
  "An example of nested Table Panels forming a spreadsheet-like grid.",
  "spreadsheet",
  ["tables", "itemarrays", "buttons", "geometries"]
]);
 
 
 
arr.push([
  "records",
  "Record Mapper",
  "Displays a variable number of fields for each record, with links mapping one field to another.",
  "records",
  ["tables", "itemarrays"]
]);
 
arr.push([
  "selectableFields",
  "Selectable Fields",
  "Records with fields that the user can select.",
  "selectableFields",
  ["tables", "itemarrays"]
]);
 
arr.push([
  "addRemoveColumns",
  "Add/Remove Table Columns",
  "Demonstrates adding and removing columns of a Table Panel.",
  "addRemoveColumns",
  ["tables", "itemarrays"]
]);
 
arr.push([
  "updateDemo",
  "Update Demo",
  "Showcases two Diagrams observing the same Model. Modifying positions in one Diagram will modify them in the model, updating the other Diagram as well.",
  "updateDemo",
  ["treelayout", "buttons", "html"]
]);
 
arr.push([
  "absolute",
  "Absolute Positioning",
  "A diagram that does not scroll or zoom or allow parts to be dragged out of a fixed area.",
  "absolute",
  []
]);
 
arr.push([
  "magnifier",
  "Magnifier",
  "An Overview used as a magnifying glass.",
  "magnifier",
  ["tables", "treelayout", "overview"]
]);
 
arr.push([
  "comments",
  "Comments",
  "GoJS supports the notion of \"Comments\", including the ability to create balloon-like comments.",
  "comments",
  ["links", "treelayout", "geometries"]
]);
 
arr.push([
  "tiger",
  "SVG Tiger",
  "Shows a tiger rendered in SVG.",
  "tiger",
  ["geometries", "svg"]
]);
 
// EXTENSIONS
// Layouts
arr.push([
  "../extensions/Fishbone",
  "Fishbone Layout",
  "The Fishbone or Ishikawa layout is a tree layout for cause-and-effect relationships.",
  "Fishbone",
  ["collections", "links", "treelayout", "customlayout", "extensions"]
]);
 
arr.push([
  "../extensions/Parallel",
  "Parallel Layout",
  "A custom Layout that assumes there is a single 'split' and a single 'merge' node with parallel lines of nodes connecting them.",
  "Parallel",
  ["treelayout", "customlayout", "groups", "buttons", "extensions"]
]);
 
arr.push([
  "../extensions/Serpentine",
  "Serpentine Layout",
  "A custom Layout that positions a chain of nodes in rows of alternating direction.",
  "Serpentine",
  ["customlayout", "extensions"]
]);
 
arr.push([
  "../extensions/Spiral",
  "Spiral Layout",
  "A custom Layout that positions a chain of nodes in a spiral.",
  "Spiral",
  ["customlayout", "extensions"]
]);
 
arr.push([
  "../extensions/TreeMap",
  "Tree Map Layout",
  "A custom Layout that renders nested Groups into the viewport with each Node having an area proportional to its declared 'size'.",
  "TreeMap",
  ["collections", "customlayout", "groups", "tooltips", "extensions", "html"]
]);
 
arr.push([
  "../extensions/Table",
  "Table Layout",
  "A custom Layout that arranges Nodes just as a Table Panel arranges GraphObjects.",
  "Table",
  ["tables", "collections", "customlayout", "groups", "tools", "palette", "extensions"]
]);
 
// Tools
arr.push([
  "../extensions/RealtimeDragSelecting",
  "Realtime Drag Selecting",
  "A custom Tool that lets a user drag and create a box to select nodes and links.",
  "realtimeDragSelecting",
  ["collections", "treelayout", "tools", "extensions"]]);
 
arr.push([
  "../extensions/DragCreating",
  "DragCreating",
  "A custom Tool that lets a user draw a box showing where and how large a new node should be.",
  "DragCreating",
  ["tools", "extensions"]
]);
 
arr.push([
  "../extensions/DragZooming",
  "Drag Zooming",
  "A custom Tool that lets a user draw a box showing what to zoom in to.",
  "DragZooming",
  ["treelayout", "tools", "extensions"]
]);
 
arr.push([
  "../extensions/ResizeMultiple",
  "Resize Multiple",
  "A custom ResizingTool that lets the user resize many selected objects at once.",
  "ResizeMultiple",
  ["tools", "extensions"]
]);
 
arr.push([
  "../extensions/RotateMultiple",
  "Rotate Multiple",
  "A custom RotatingTool that lets the user rotate many selected objects at once.",
  "RotateMultiple",
  ["tools", "extensions"]
]);
 
arr.push([
  "../extensions/CurvedLinkReshaping",
  "Curved Link Reshaping",
  "A custom Tool that lets the user reshape curved links with a single handle.",
  "CurvedLinkReshaping",
  ["links", "tools", "buttons", "extensions"]
]);
 
arr.push([
  "../extensions/OrthogonalLinkReshaping",
  "Orthogonal Link Reshaping",
  "A custom Tool that lets the user reshape orthogonal links by dragging entire segments.",
  "OrthogonalLinkReshaping",
  ["links", "tools", "extensions", "geometries"]
]);
 
arr.push([
  "../extensions/SnapLinkReshaping",
  "Snap Link Reshaping",
  "A custom Tool that allows reshaping links with grid snapping.",
  "SnapLinkReshaping",
  ["links", "tools", "palette", "extensions", "grid"]
]);
 
arr.push([
  "../extensions/GeometryReshaping",
  "Geometry Reshaping",
  "A custom Tool that supports interactive reshaping of Geometries.",
  "GeometryReshaping",
  ["tools", "extensions", "geometries"]
]);
 
arr.push([
  "../extensions/SectorReshaping",
  "Sector Reshaping",
  "A custom Tool that supports interactive reshaping of pie-shaped sectors of circles.",
  "SectorReshaping",
  ["tools", "extensions", "geometries"]
]);
 
arr.push([
  "../extensions/FreehandDrawing",
  "Freehand Drawing",
  "A custom Tool that lets the user interactively draw a line, converting it into a Shape.",
  "FreehandDrawing",
  ["tools", "extensions", "geometries"]
]);
 
arr.push([
  "../extensions/PolygonDrawing",
  "Polygon Drawing",
  "A custom Tool that lets the user interactively draw polygons and polyline Shapes.",
  "PolygonDrawing",
  ["tools", "extensions", "geometries"]
]);
 
arr.push([
  "../extensions/PolylineLinking",
  "Polyline Linking",
  "A custom LinkingTool that lets the user determine the route of a new Link by clicking.",
  "PolylineLinking",
  ["links", "tools", "extensions"]
]);
 
arr.push([
  "../extensions/LinkShifting",
  "Link Shifting",
  "A custom Tool that adds handles on Links to allow the user to shift the end point of the Link along the sides of the port without disconnecting it.",
  "LinkShifting",
  ["links", "tools", "extensions", "geometries"]
]);
 
arr.push([
  "../extensions/LinkLabelDragging",
  "Link Label Dragging",
  "A custom Tool that lets the user drag a label on a Link and that keeps its relative position to the link.",
  "LinkLabelDragging",
  ["tools", "buttons", "extensions"]
]);
 
arr.push([
  "../extensions/NodeLabelDragging",
  "Node Label Dragging",
  "A custom Tool that lets the user drag a label in a Spot Panel of a Node.",
  "NodeLabelDragging",
  ["tools", "buttons", "extensions"]
]);
 
arr.push([
  "../extensions/GuidedDragging",
  "Guided Dragging",
  "A custom DraggingTool that makes guidelines visible as a Part is dragged around a Diagram and is nearly aligned with another Part.",
  "GuidedDragging",
  ["tools", "extensions"]
]);
 
arr.push([
  "../extensions/PortShifting",
  "Port Shifting",
  "A custom Tool that lets the user drag a port in a Spot Panel of a Node.",
  "PortShifting",
  ["ports", "tooltips", "tools", "palette", "extensions", "grid"]
]);
 
arr.push([
  "../extensions/ColumnResizing",
  "Column Resizing",
  "Two custom Tools that let the user resize the width of columns or the height of rows in a Table Panel of a Node.",
  "ColumnResizing",
  ["tables", "itemarrays", "tools", "extensions", "geometries"]
]);
 
// Inspectors
arr.push([
  "../extensions/DataInspector",
  "Data Inspector",
  "A simple drop-in for inspecting and editing Part data.",
  "dataInspector",
  ["groups", "extensions", "inspector", "html"]
]);
 
arr.push([
  "../extensions/DebugInspector",
  "Debug Inspector",
  "A more complex inspector for inspecting all sorts of GraphObject, Node, Link, Shape, etc properties, and Part data.",
  "debugInspector",
  ["groups", "extensions", "inspector", "html"]
]);
 
// Other
arr.push([
  "../extensions/CheckBoxes",
  "Checkboxes",
  "Demonstrates simple uses of CheckBoxButtons.",
  "Checkboxes",
  ["tables", "itemarrays", "buttons", "extensions"]
]);
 
arr.push([
  "../extensions/Hyperlink",
  "Hyperlinks",
  "Demonstrates usage of the HyperlinkText extension.",
  "Hyperlink",
  ["extensions"]
]);
 
arr.push([
  "../extensions/TextEditor",
  "HTMLInfo Text Editor",
  "Demonstrates using an HTMLInfo that acts as a re-implementation of the default text editor.",
  "TextEditor",
  ["html", "extensions"]
]);
 
arr.push([
  "../extensions/ScrollingTable",
  "Scrolling Table",
  "Demonstrates a custom Table Panel with a scrollbar implemented in GoJS, including two AutoRepeatButtons.",
  "ScrollingTable",
  ["tables", "itemarrays", "buttons", "extensions"]
]);
 
arr.push([
  "twoHalves",
  "Two Halves",
  "Demonstrates a Node with a top half and a bottom half, with rounded corners.",
  "twoHalves",
  ["geometries"]
]);
 
arr.push([
  "../extensions/BalloonLink",
  "Balloon Links",
  "Demonstrates custom Links that create a \"Balloon\" around the fromNode.",
  "BalloonLink",
  ["links", "geometries", "extensions"]
]);
 
arr.push([
  "../extensions/Dimensioning",
  "Dimensioning",
  "Demonstrates custom Links that show the distance between two points.",
  "Dimensioning",
  ["links", "extensions"]
]);
 
arr.push([
  "../extensions/DrawCommandHandler",
  "Drawing Commands",
  "Demonstrates custom CommandHandler which provides alignment commands and additional behaviors for the arrow keys.",
  "DrawCommandHandler",
  ["extensions"]
]);
 
arr.push([
  "../extensions/LocalStorageCommandHandler",
  "Local Storage Commands",
  "Demonstrates custom CommandHandler which uses localStorage as the repository for the clipboard, rather than an in-memory global variable, allowing for copying between tabs and windows.",
  "minimal",
  ["extensions"]
]);
 
arr.push([
  "../extensions/Robot",
  "Simulating Input",
  "Demonstrates use of the Robot class to simulate mouse events.",
  "robot",
  ["collections", "contextmenus", "palette", "buttons", "extensions", "html"]
]);
 
arr.push([
  "../extensions/BPMN",
  "BPMN Editor",
  "The start of a Business Process Model and Notation editor.",
  "BPMN",
  ["tables", "itemarrays", "collections", "customlayout", "groups", "tooltips", "contextmenus", "tools", "palette", "overview", "buttons", "extensions", "geometries", "grid", "html", "frameworks"]
]);
 
arr.push([
  "../extensions/FloorPlanEditor",
  "Floor Plan Editor",
  "An editor for users to position, resize, and rotate furniture in a room.",
  "FloorPlanEditor",
  ["collections", "groups", "tooltips", "contextmenus", "tools", "palette", "overview", "buttons", "extensions", "geometries", "grid", "html"]
]);
 
arr.push([
  "../extensions/FloorPlanMonitor",
  "Floor Plan Monitor",
  "A tool to open plans made in Floor Pan Editor and watch simulated alerts.",
  "FloorPlanMonitor",
  ["groups", "tooltips", "overview", "extensions", "geometries", "monitoring", "html"]
]);
 
arr.push([
  "../extensions/FloorPlanner",
  "Floor Planner",
  "An editor for users to create robust, detailed floor plans.",
  "FloorPlanner",
  ["collections", "groups", "tooltips", "contextmenus", "tools", "palette", "overview", "buttons", "extensions", "geometries", "grid", "html"]
]);
 
// Previously unlisted samples
arr.push([
  "minimalJSON",
  "Minimal JSON",
  "Minimal, loading JSON from server.",
  "minimal",
  ["frameworks"]
]);
 
arr.push([
  "minimalXML",
  "Minimal XML",
  "Minimal, loading XML from server.",
  "minimal",
  ["frameworks"]
]);
 
arr.push([
  "minimalBlob",
  "Minimal Image Download",
  "Minimal, showing image Blob creation with Diagram.makeImageData, and download.",
  "minimal",
  []
]);
 
arr.push([
  "minimalSVG",
  "Minimal SVG Download",
  "Minimal, showing SVG creation with Diagram.makeSvg, and download.",
  "minimal",
  []
]);
 
arr.push([
  "require",
  "Minimal RequireJS",
  "Minimal, using RequireJS.",
  "minimal",
  ["frameworks"]
]);
 
arr.push([
  "angular",
  "Minimal AngularJS",
  "Minimal, using AngularJS.",
  "minimal",
  ["frameworks"]
]);
 
arr.push([
  "spacingZoom",
  "Spacing Zoom",
  "When zooming, change the spacing of the Nodes, not the Diagram.scale.",
  "minimal",
  []
]);
 
arr.push([
  "gestureBehavior",
  "Gesture Behavior",
  "Shows different options for ToolManager's gestureBehavior.",
  "minimal",
  []
]);
 
arr.push([
  "hoverButtons",
  "Hover Buttons",
  "Shows buttons in an Adornment upon hover over a node.",
  "hoverButtons",
  ["buttons"]
]);
 
arr.push([
  "scrollModes",
  "Scroll Modes",
  "Shows infinite scrolling and positionComputation.",
  "scrollModes",
  ["grid"]
]);
 
arr.push([
  "customExpandCollapse",
  "Custom Expand and Collapse",
  "Shows how to create Buttons with custom behavior for expanding/collapsing of a graph.",
  "customExpandCollapse",
  ["layereddigraphlayout", "buttons"]
]);
 
arr.push([
  "constantSize",
  "Constant Size",
  "Kitten Monitor with constant size markers and tooltips when zooming out.",
  "kittenMonitor",
  ["tooltips"]
]);
 
arr.push([
  "virtualized",
  "Virtualized",
  "Virtualized no Layout, an example of virtualization where the model holds 123,456 node data yet the diagram only creates a few nodes at a time.",
  "virtualized",
  ["collections", "groups", "tooltips", "buttons", "performance"]
]);
 
arr.push([
  "virtualizedTree",
  "Virtualized Tree",
  "An example of virtualization where the model holds 123,456 node data yet the diagram only creates a few nodes at a time.",
  "virtualizedTree",
  ["treelayout", "tooltips", "performance"]
]);
 
arr.push([
  "virtualizedTreeLayout",
  "Virtualized TreeLayout",
  "Shows a virtualized TreeLayout, with TreeModel.",
  "virtualizedTree",
  ["collections", "treelayout", "customlayout", "tooltips", "performance"]
]);
 
arr.push([
  "virtualizedForceLayout",
  "Virtualized ForceDirectedLayout",
  "Shows a virtualized ForceDirectedLayout, with GraphLinksModel.",
  "virtualizedForceLayout",
  ["collections", "forcedirectedlayout", "customlayout", "tooltips", "performance"]
]);
 
arr.push([
  "flowBuilder",
  "Flow Builder",
  "Demonstrates a flow builder where nodes/links can be created or dropped onto a recylcing node.",
  "flowBuilder",
  ["layereddigraphlayout", "contextmenus", "tools", "buttons"]
]);
 
arr.push([
  "flowgrammer",
  "Flowgrammer",
  "Demonstrates a flow-chart-like editor of a restricted syntax language.",
  "flowgrammer",
  ["collections", "layereddigraphlayout", "palette", "overview"]
]);
 
arr.push([
  "network",
  "Network",
  "Shows a network configurator with a Palette and Overview.",
  "network",
  ["links", "palette", "overview"]
]);
 
arr.push([
  "stateChartIncremental",
  "Incremental State Chart",
  "State Chart using incremental JSON.",
  "stateChart",
  ["buttons", "html"]
]);
 
arr.push([
  "regroupingScaled",
  "Regrouping Scaled",
  "Regrouping with nested groups scaled ever smaller.",
  "regroupingScaled",
  ["gridlayout", "groups", "palette", "buttons"]
]);
 
arr.push([
  "regroupingTreeView",
  "Regrouping Tree View",
  "Regrouping with tree view of grouping hierarchy.",
  "regrouping",
  ["collections", "gridlayout", "treelayout", "groups", "buttons"]
]);
 
arr.push([
  "dragOutFields",
  "Drag Out Fields",
  "Drag out fields from record Nodes to an HTML element.",
  "records",
  ["tables", "itemarrays", "collections", "tools", "html"]
]);
 
arr.push([
  "dragDropFields",
  "Drag and Drop Fields",
  "Drag and drop fields from/to record Nodes.",
  "records",
  ["tables", "itemarrays", "collections", "tools"]
]);
 
arr.push([
  "twoDiagrams",
  "Two Diagrams",
  "Demonstrates drag and drop between two different diagrams using a shared UndoManager.",
  "minimal",
  ["html"]
]);
 
arr.push([
  "htmlDragDrop",
  "HTML Drag and Drop",
  "Demonstrates dragging and dropping from HTML.",
  "htmlDragDrop",
  ["palette", "html"]
]);
 
arr.push([
  "jQueryDragDrop",
  "jQuery Drag and Drop",
  "Demonstrates dragging and dropping from HTML using jQuery.",
  "jQueryDragDrop",
  ["frameworks"]
]);
 
arr.push([
  "macros",
  "Macros",
  "Demonstrates an automatic ungrouping of nodes when dropping an element on the diagram.",
  "macros",
  ["groups", "palette"]
]);
 
arr.push([
  "dragUnoccupied",
  "Drag Unoccupied",
  "Demonstrates a function to avoid any overlapping of nodes during dragging.",
  "dragUnoccupied",
  []
]);
 
arr.push([
  "htmlLightBoxContextMenu",
  "HTML LightBox Context Menu",
  "Shows a LightBox style HTML Context Menu.",
  "htmlLightBoxContextMenu",
  ["contextmenus", "html"]
]);
 
arr.push([
  "tabs",
  "jQuery Tabs",
  "Shows how to create a Diagram within a jQuery UI Tab.",
  "tabs",
  ["frameworks"]
]);